From d00de3baaa045451fc7883227ddfff4a87abcd11 Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 8 Jun 2022 11:29:32 -0500 Subject: [PATCH] feat(route): 91porn (#9920) --- docs/en/multimedia.md | 16 +++++++++ docs/multimedia.md | 16 +++++++++ lib/v2/91porn/index.js | 58 +++++++++++++++++++++++++++++++ lib/v2/91porn/maintainer.js | 3 ++ lib/v2/91porn/radar.js | 13 +++++++ lib/v2/91porn/router.js | 3 ++ lib/v2/91porn/templates/index.art | 1 + 7 files changed, 110 insertions(+) create mode 100644 lib/v2/91porn/index.js create mode 100644 lib/v2/91porn/maintainer.js create mode 100644 lib/v2/91porn/radar.js create mode 100644 lib/v2/91porn/router.js create mode 100644 lib/v2/91porn/templates/index.art diff --git a/docs/en/multimedia.md b/docs/en/multimedia.md index d34b4ca384..c0562f4c2d 100644 --- a/docs/en/multimedia.md +++ b/docs/en/multimedia.md @@ -83,6 +83,22 @@ When `uncensored_makersr` as **Uncensored** is chosen as **Category**, the avail +## 91porn + +::: tip Tips + +91porn has multiple backup domains, routes use the permanent domain by default. If the domain is not accessible, you can add `?domain=` to specify the domain to be used. If you want to specify the backup domain to , 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) + +::: + + + +| English | 简体中文 | 繁體中文 | +| -- | -- | -- | +| en_US | cn_CN | zh_ZH | + + + ## 99% Invisible ### Transcript diff --git a/docs/multimedia.md b/docs/multimedia.md index ecdbd1a3f3..03046412bd 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -223,6 +223,22 @@ pageClass: routes +## 91porn + +::: tip 提示 + +91porn 有多个备用域名,路由默认使用永久域名 。若该域名无法访问,可以通过在路由最后加上 `?domain=<域名>` 指定路由访问的域名。如指定备用域名为 ,则在所有 91porn 路由最后加上 `?domain=0122.91p30.com` 即可,此时路由为 [`/91porn?domain=0122.91p30.com`](https://rsshub.app/91porn?domain=0122.91p30.com) + +::: + + + +| English | 简体中文 | 繁體中文 | +| ------- | ----- | ----- | +| en_US | cn_CN | zh_ZH | + + + ## 99% Invisible ### Transcript diff --git a/lib/v2/91porn/index.js b/lib/v2/91porn/index.js new file mode 100644 index 0000000000..5e5d0fe40e --- /dev/null +++ b/lib/v2/91porn/index.js @@ -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, + }; +}; diff --git a/lib/v2/91porn/maintainer.js b/lib/v2/91porn/maintainer.js new file mode 100644 index 0000000000..c45323d6a7 --- /dev/null +++ b/lib/v2/91porn/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/:lang?': ['TonyRL'], +}; diff --git a/lib/v2/91porn/radar.js b/lib/v2/91porn/radar.js new file mode 100644 index 0000000000..aeac305ff2 --- /dev/null +++ b/lib/v2/91porn/radar.js @@ -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', + }, + ], + }, +}; diff --git a/lib/v2/91porn/router.js b/lib/v2/91porn/router.js new file mode 100644 index 0000000000..7df06e0735 --- /dev/null +++ b/lib/v2/91porn/router.js @@ -0,0 +1,3 @@ +module.exports = (router) => { + router.get('/:lang?', require('./index')); +}; diff --git a/lib/v2/91porn/templates/index.art b/lib/v2/91porn/templates/index.art new file mode 100644 index 0000000000..09a735bf48 --- /dev/null +++ b/lib/v2/91porn/templates/index.art @@ -0,0 +1 @@ +