feat(route): add BT之家1LOU站 (#14219)
* route: BT之家1LOU * 1. using new routers. 2. If path is empty, visit correct main page of website. 3. roll back deleted doc by mistake. * Update lib/v2/1lou/radar.js * Update website/docs/routes/multimedia.mdx * Update website/docs/routes/multimedia.mdx ---------
This commit is contained in:
@@ -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}`;
|
||||
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);
|
||||
item.description = content('.message.break-all').html();
|
||||
const torrents = content('.attachlist').find('a');
|
||||
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,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/:path?': ['falling'],
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'1lou.me': {
|
||||
_name: 'BT之家 1LOU站',
|
||||
'.': [
|
||||
{
|
||||
title: '搜索',
|
||||
docs: 'https://docs.rsshub.app/routes/multimedia#bt-zhi-jia-1lou-zhan',
|
||||
source: ['/:path'],
|
||||
target: '/1lou/:path',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/:path?', require('./index'));
|
||||
};
|
||||
@@ -1598,3 +1598,21 @@ Refer to [https://developers.themoviedb.org/3/getting-started/languages](https:/
|
||||
| ---- | ---- | ---- |
|
||||
| | kr | dl |
|
||||
</Route>
|
||||
|
||||
## BT之家 1LOU站 {#bt-zhi-jia-1lou-zhan}
|
||||
|
||||
### 搜索 {#bt-zhi-ji-1Lou-sou-suo}
|
||||
|
||||
<Route author="falling" example="/1lou/search-繁花.htm" path="/1lou/:path?" paramsDesc={['路径信息在URL里找到,主页为 index']}>
|
||||
:::tip
|
||||
将1lou.me/后的内容作为参数传入到path即可
|
||||
|
||||
www.1lou.me/search-繁花.htm --> /1lou/search-繁花.htm
|
||||
|
||||
www.1lou.me/forum-1.htm --> /1lou/forum-1.htm
|
||||
|
||||
www.1lou.me/ --> /1lou/
|
||||
:::
|
||||
|
||||
</Route>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user