feat(route): 番组计划用户想看 (#13922)
* feat(route): 番组计划用户想看 * add pubdate attr * fix
This commit is contained in:
parent
5aa726d658
commit
67bb2fa347
|
|
@ -16,4 +16,5 @@ module.exports = {
|
|||
'/tv/subject/:id/:type?/:showOriginalName?': ['JimenezLi'],
|
||||
'/tv/topic/:id': ['ylc395'],
|
||||
'/tv/user/blog/:id': ['nczitzk'],
|
||||
'/tv/user/wish/:id': ['honue'],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -61,6 +61,12 @@ const bangumiTV = {
|
|||
source: '/anime',
|
||||
target: '/bangumi/tv/followrank',
|
||||
},
|
||||
{
|
||||
title: '用户想看',
|
||||
docs: 'https://docs.rsshub.app/routes/anime#bangumi-fan-zu-ji-hua',
|
||||
source: '/anime/list/:id/wish',
|
||||
target: '/bangumi/tv/user/wish/:id',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -11,4 +11,5 @@ module.exports = function (router) {
|
|||
router.get('/tv/subject/:id/:type?/:showOriginalName?', require('./tv/subject'));
|
||||
router.get('/tv/topic/:id', require('./tv/group/reply'));
|
||||
router.get('/tv/user/blog/:id', require('./tv/user/blog'));
|
||||
router.get('/tv/user/wish/:id', require('./tv/user/wish'));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const config = require('@/config').value;
|
||||
module.exports = async (ctx) => {
|
||||
const userid = ctx.params.id;
|
||||
const url = `https://bgm.tv/anime/list/${userid}/wish`;
|
||||
const response = await got({
|
||||
url,
|
||||
method: 'get',
|
||||
headers: {
|
||||
'User-Agent': config.trueUA,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(response.body);
|
||||
|
||||
const username = $('.name').find('a').html();
|
||||
const items = $('#browserItemList')
|
||||
.find('li')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
const aTag = $(item).find('h3').children('a');
|
||||
const jdate = $(item).find('.collectInfo').find('span').html();
|
||||
return {
|
||||
title: aTag.html(),
|
||||
link: 'https://bgm.tv' + aTag.attr('href'),
|
||||
pubDate: timezone(parseDate(jdate), 0),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${username}想看的动画`,
|
||||
link: url,
|
||||
item: items,
|
||||
description: `${username}想看的动画列表`,
|
||||
};
|
||||
};
|
||||
|
|
@ -203,7 +203,11 @@ For more tags, please go to [Search torrent](https://bangumi.moe/search/index)
|
|||
|
||||
<Route author="nczitzk" example="/bangumi/tv/user/blog/sai" path="/bangumi/tv/user/blog/:id" paramsDesc={['用户 id, 在用户页面地址栏查看']} radar="1"/>
|
||||
|
||||
### 成员关注动画榜 {#bangumi-fan-zu-ji-hua-cheng-yuan-guan-zhu-dong-hua-bang}
|
||||
### 用户想看 {#bangumi-fan-zu-ji-hua-yong-hu-xiang-kan}
|
||||
|
||||
<Route author="honue" example="/bangumi/tv/user/wish/23333" path="/bangumi/tv/user/wish/:id" paramsDesc={['用户 id, 在用户页面地址栏查看']} radar="1"/>
|
||||
|
||||
### 成员关注动画榜 {#bangumi-cheng-yuan-guan-zhu-dong-hua-bang}
|
||||
|
||||
<Route author="honue" example="/bangumi/tv/followrank" path="/bangumi/tv/followrank" radar="1"/>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue