From 60e4a1a7bb3986bb1a3353ed57ca4c5a80c26ddc Mon Sep 17 00:00:00 2001 From: falling Date: Wed, 10 Jan 2024 21:55:39 +0800 Subject: [PATCH] =?UTF-8?q?route:=20BT=E4=B9=8B=E5=AE=B61LOU?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/v2/1lou/index.js | 53 ++++++++++++++++++++++++++++++ lib/v2/1lou/maintainer.js | 3 ++ lib/v2/1lou/radar.js | 13 ++++++++ lib/v2/1lou/router.js | 3 ++ website/docs/routes/multimedia.mdx | 20 +++++++---- 5 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 lib/v2/1lou/index.js create mode 100644 lib/v2/1lou/maintainer.js create mode 100644 lib/v2/1lou/radar.js create mode 100644 lib/v2/1lou/router.js diff --git a/lib/v2/1lou/index.js b/lib/v2/1lou/index.js new file mode 100644 index 00000000000000..4556d68f86e91b --- /dev/null +++ b/lib/v2/1lou/index.js @@ -0,0 +1,53 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const timezone = require('@/utils/timezone'); +const { parseDate } = require('@/utils/parse-date'); + +module.exports = async (ctx) => { + const path = ctx.params.path ?? ''; + const rootUrl = `https://www.1lou.me`; + const currentUrl = `${rootUrl}/${path}.htm`; + const response = await got({ + method: 'get', + url: currentUrl, + }); + const $ = cheerio.load(response.data); + + let items = $('li.media.thread.tap:not(.hidden-sm)') + .toArray() + .map((item) => { + const title = $(item).find('.subject.break-all').children('a').first(); + const author = $(item).find('.username.text-grey.mr-1').text(); + const pubDate = $(item).find('.date.text-grey').text(); + return { + title: title.text(), + link: `${rootUrl}/${title.attr('href')}`, + author, + pubDate: timezone(parseDate(pubDate), +8), + }; + }); + items = await Promise.all( + items.map((item) => + ctx.cache.tryGet(item.link, async () => { + const detailResponse = await got({ + method: 'get', + url: item.link, + }); + const content = cheerio.load(detailResponse.data); + const torrents = content('.attachlist').find('a'); + item.description = content('.message.break-all').html(); + if (torrents.length > 0) { + item.enclosure_type = 'application/x-bittorrent'; + item.enclosure_url = `${rootUrl}/${torrents.first().attr('href')}`; + } + + return item; + }) + ) + ); + ctx.state.data = { + title: '1Lou', + link: currentUrl, + item: items, + }; +}; diff --git a/lib/v2/1lou/maintainer.js b/lib/v2/1lou/maintainer.js new file mode 100644 index 00000000000000..bdd3fde898af7b --- /dev/null +++ b/lib/v2/1lou/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/:path?': ['falling'], +}; diff --git a/lib/v2/1lou/radar.js b/lib/v2/1lou/radar.js new file mode 100644 index 00000000000000..a6f8e686ab979e --- /dev/null +++ b/lib/v2/1lou/radar.js @@ -0,0 +1,13 @@ +module.exports = { + '1lou.me': { + _name: 'BT之家 1LOU站', + '.': [ + { + title: '搜索', + docs: 'https://docs.rsshub.app/routes/multimedia#bt-zhi-ji-1Lou', + source: ['/:path'], + target: '/1lou/:path', + }, + ], + }, +}; diff --git a/lib/v2/1lou/router.js b/lib/v2/1lou/router.js new file mode 100644 index 00000000000000..4317c1e82b7aa9 --- /dev/null +++ b/lib/v2/1lou/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/:path?', require('./index')); +}; diff --git a/website/docs/routes/multimedia.mdx b/website/docs/routes/multimedia.mdx index 9f26a31db5d2f7..3c18d048307261 100644 --- a/website/docs/routes/multimedia.mdx +++ b/website/docs/routes/multimedia.mdx @@ -1587,14 +1587,20 @@ Refer to [https://developers.themoviedb.org/3/getting-started/languages](https:/ | mv | tv | -## 综艺秀 {#zong-yi-xiu} +## BT之家 1LOU站 {#bt-zhi-ji-1Lou} -### 综艺 {#zong-yi-xiu-zong-yi} +### 搜索 {#bt-zhi-ji-1Lou-sou-suo} - - 地区 + +:::tip + 将1lou.me/后,.htm 前的内容作为参数传入到path即可 + + www.1lou.me/search-繁花.htm --> /1lou/search-繁花 + + www.1lou.me/forum-1.htm --> /1lou/forum-1 + + www.1lou.me/ --> /1lou/index + ::: - | 台湾 | 韩国 | 大陆 | - | ---- | ---- | ---- | - | | kr | dl | +