Skip to content

Commit

Permalink
Merge pull request #51 from DIYgod/master
Browse files Browse the repository at this point in the history
[pull] master from diygod:master
  • Loading branch information
pull[bot] authored Jan 12, 2024
2 parents 929b83a + 34cc84b commit 4518b93
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 3 deletions.
53 changes: 53 additions & 0 deletions lib/v2/1lou/index.js
Original file line number Diff line number Diff line change
@@ -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,
};
};
3 changes: 3 additions & 0 deletions lib/v2/1lou/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/:path?': ['falling'],
};
13 changes: 13 additions & 0 deletions lib/v2/1lou/radar.js
Original file line number Diff line number Diff line change
@@ -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',
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/1lou/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/:path?', require('./index'));
};
2 changes: 1 addition & 1 deletion lib/v2/tiktok/maintainer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
'/user/:user': ['TonyRL'],
'/user/:user/:iframe?': ['TonyRL'],
};
2 changes: 1 addition & 1 deletion website/docs/routes/game.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@

### 公告 {#hoyolab-gong-gao}

<Route author="ZenoTian" example="/hoyolab/news/zh-cn/2/2" path="/news/:language/:gids/:type" paramsDesc={['语言', '游戏', '公告类型']} radar="1">
<Route author="ZenoTian" example="/hoyolab/news/zh-cn/2/2" path="/hoyolab/news/:language/:gids/:type" paramsDesc={['语言', '游戏', '公告类型']} radar="1">
语言 language

| Language | Code |
Expand Down
16 changes: 16 additions & 0 deletions website/docs/routes/multimedia.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,22 @@ Full transcript support for better user experience.
可空,默认为 base
:::

## BT 之家 1LOU 站 {#bt-zhi-jia-1lou-zhan}

### 搜索 {#bt-zhi-jia-1lou-zhan-sou-suo}

<Route author="falling" example="/1lou/search-繁花.htm" path="/1lou/:path?" paramsDesc={['路径信息在URL里找到,主页为 index']}>
:::tip
将 1lou.me/ 后的内容作为参数传入到 path 即可

[www.1lou.me/search - 繁花.htm](http://www.1lou.me/search-繁花.htm) --> /1lou/search - 繁花.htm

[www.1lou.me/forum-1.htm](http://www.1lou.me/forum-1.htm) --> /1lou/forum-1.htm

[www.1lou.me/](http://www.1lou.me/) --> /1lou/
:::
</Route>

## CNTV {#cntv}

### 栏目 {#cntv-lan-mu}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/routes/shopping.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ For instance, in `https://www.zagg.com/en_us/new-arrivals?brand=164&cat=3038%2C3

### 演出搜索 {#xiu-dong-wang-yan-chu-sou-suo}

<Route author="lchtao26" example="/showstart/search/live" path="/showstart/search/:keyword" paramsDesc={['搜索关键词']} />
<Route author="lchtao26" example="/showstart/search/live" path="/showstart/search/:type/:keyword?" paramsDesc={['类别', '搜索关键词']} />

### 音乐人 - 演出更新 {#xiu-dong-wang-yin-yue-ren-yan-chu-geng-xin}

Expand Down

0 comments on commit 4518b93

Please sign in to comment.