feat(route): 91porn (#9920)

This commit is contained in:
Tony 2022-06-08 11:29:32 -05:00 committed by GitHub
parent c316c7c20f
commit d00de3baaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 110 additions and 0 deletions

View File

@ -83,6 +83,22 @@ When `uncensored_makersr` as **Uncensored** is chosen as **Category**, the avail
</RouteEn>
## 91porn
::: tip Tips
91porn has multiple backup domains, routes use the permanent domain <https://91porn.com> by default. If the domain is not accessible, you can add `?domain=<domain>` to specify the domain to be used. If you want to specify the backup domain to <https://0122.91p30.com>, you can add `?domain=0122.91p30.com` to the end of all 91porn routes, then the route will become [`/91porn?domain=0122.91p30.com`](https://rsshub.app/91porn?domain=0122.91p30.com)
:::
<RouteEn author="TonyRL" example="/91porn" path="/91porn/:lang?" :paramsDesc="['Language, see below, `en_US` by default ']" radar="1" rssbud="1" anticrawler="1">
| English | 简体中文 | 繁體中文 |
| -- | -- | -- |
| en_US | cn_CN | zh_ZH |
</RouteEn>
## 99% Invisible
### Transcript

View File

@ -223,6 +223,22 @@ pageClass: routes
</Route>
## 91porn
::: tip 提示
91porn 有多个备用域名,路由默认使用永久域名 <https://91porn.com>。若该域名无法访问,可以通过在路由最后加上 `?domain=<域名>` 指定路由访问的域名。如指定备用域名为 <https://0122.91p30.com>,则在所有 91porn 路由最后加上 `?domain=0122.91p30.com` 即可,此时路由为 [`/91porn?domain=0122.91p30.com`](https://rsshub.app/91porn?domain=0122.91p30.com)
:::
<Route author="TonyRL" example="/91porn" path="/91porn/:lang?" :paramsDesc="['语言,见下表,默认 `en_US`']" radar="1" rssbud="1" anticrawler="1">
| English | 简体中文 | 繁體中文 |
| ------- | ----- | ----- |
| en_US | cn_CN | zh_ZH |
</Route>
## 99% Invisible
### Transcript

58
lib/v2/91porn/index.js Normal file
View File

@ -0,0 +1,58 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const { art } = require('@/utils/render');
const path = require('path');
module.exports = async (ctx) => {
const { domain = '91porn.com' } = ctx.query;
const siteUrl = `https://${domain}/index.php`;
const { lang = 'en_US' } = ctx.params;
const response = await got.post(siteUrl, {
form: {
session_language: lang,
},
headers: {
referer: siteUrl,
},
});
const $ = cheerio.load(response.data);
let items = $('.row .well')
.toArray()
.map((item) => {
item = $(item);
return {
title: item.find('.video-title').text(),
link: item.find('a').attr('href'),
poster: item.find('.img-responsive').attr('src'),
};
});
items = await Promise.all(
items.map((item) =>
ctx.cache.tryGet(`91porn:${lang}:${item.link}`, async () => {
const { data } = await got(item.link);
const $ = cheerio.load(data);
item.pubDate = parseDate($('.title-yakov').eq(0).text(), 'YYYY-MM-DD');
item.description = art(path.join(__dirname, 'templates/index.art'), {
link: item.link,
poster: item.poster,
});
item.author = $('.title-yakov a span').text();
delete item.poster;
return item;
})
)
);
ctx.state.data = {
title: `${$('.login_register_header').text()} - 91porn`,
link: siteUrl,
item: items,
};
};

View File

@ -0,0 +1,3 @@
module.exports = {
'/:lang?': ['TonyRL'],
};

13
lib/v2/91porn/radar.js Normal file
View File

@ -0,0 +1,13 @@
module.exports = {
'91porn.com': {
_name: '91porn',
'.': [
{
title: '91porn',
docs: 'https://docs.rsshub.app/multimedia.html#_91porn',
source: ['/index.php'],
target: '/91porn',
},
],
},
};

3
lib/v2/91porn/router.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/:lang?', require('./index'));
};

View File

@ -0,0 +1 @@
<a href="{{ link }}"><img src="{{ poster }} "></a>