mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-19 06:38:55 +08:00
bilibili video replay: avid -> aid; use template module
This commit is contained in:
@@ -154,11 +154,11 @@ s
|
|||||||
|
|
||||||
### 视频评论
|
### 视频评论
|
||||||
|
|
||||||
举例: https://rss.now.sh/bilibili/video/reply/7
|
举例: https://rss.now.sh/bilibili/video/reply/21669336
|
||||||
|
|
||||||
路由: `/bilibili/video/reply/:avid`
|
路由: `/bilibili/video/reply/:aid`
|
||||||
|
|
||||||
参数: avid,视频 AV 号(仅数字)
|
参数: aid,可在视频页 URL 中找到
|
||||||
|
|
||||||
## 微博
|
## 微博
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ router.get('/bilibili/user/followers/:uid', require('./routes/bilibili/followers
|
|||||||
router.get('/bilibili/user/followings/:uid', require('./routes/bilibili/followings'));
|
router.get('/bilibili/user/followings/:uid', require('./routes/bilibili/followings'));
|
||||||
router.get('/bilibili/partion/:tid', require('./routes/bilibili/partion'));
|
router.get('/bilibili/partion/:tid', require('./routes/bilibili/partion'));
|
||||||
router.get('/bilibili/bangumi/:seasonid', require('./routes/bilibili/bangumi'));
|
router.get('/bilibili/bangumi/:seasonid', require('./routes/bilibili/bangumi'));
|
||||||
router.get('/bilibili/video/reply/:avid', require('./routes/bilibili/videoReply'));
|
router.get('/bilibili/video/reply/:aid', require('./routes/bilibili/reply'));
|
||||||
|
|
||||||
// // 微博
|
// // 微博
|
||||||
router.get('/weibo/user/:uid', require('./routes/weibo/user'));
|
router.get('/weibo/user/:uid', require('./routes/weibo/user'));
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
const art = require('art-template');
|
const template = require('../../utils/template');
|
||||||
const path = require('path');
|
|
||||||
const config = require('../../config');
|
const config = require('../../config');
|
||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
const iconv = require('iconv-lite');
|
const iconv = require('iconv-lite');
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
const avid = ctx.params.avid;
|
const aid = ctx.params.aid;
|
||||||
|
|
||||||
const nameResponse = await axios({
|
const nameResponse = await axios({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: `https://www.bilibili.com/video/av${avid}`,
|
url: `https://www.bilibili.com/video/av${aid}`,
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': config.ua,
|
'User-Agent': config.ua,
|
||||||
},
|
},
|
||||||
@@ -23,25 +22,24 @@ module.exports = async (ctx) => {
|
|||||||
|
|
||||||
const response = await axios({
|
const response = await axios({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: `https://api.bilibili.com/x/v2/reply?type=1&oid=${avid}&sort=0`,
|
url: `https://api.bilibili.com/x/v2/reply?type=1&oid=${aid}&sort=0`,
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': config.ua,
|
'User-Agent': config.ua,
|
||||||
'Referer': `https://www.bilibili.com/video/av${avid}`,
|
'Referer': `https://www.bilibili.com/video/av${aid}`,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = response.data.data.replies;
|
const data = response.data.data.replies;
|
||||||
|
|
||||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
ctx.body = template({
|
||||||
title: `${name} 的 评论`,
|
title: `${name} 的 评论`,
|
||||||
link: `https://www.bilibili.com/video/av${avid}`,
|
link: `https://www.bilibili.com/video/av${aid}`,
|
||||||
description: `${name} 的 评论`,
|
description: `${name} 的评论`,
|
||||||
lastBuildDate: new Date().toUTCString(),
|
|
||||||
item: data.map((item) => ({
|
item: data.map((item) => ({
|
||||||
title: `${item.member.uname} : ${item.content.message}`,
|
title: `${item.member.uname} : ${item.content.message}`,
|
||||||
description: `#${item.floor}<br> ${item.member.uname} : ${item.content.message}`,
|
description: `#${item.floor}<br> ${item.member.uname} : ${item.content.message}`,
|
||||||
pubDate: new Date(item.ctime * 1000).toUTCString(),
|
pubDate: new Date(item.ctime * 1000).toUTCString(),
|
||||||
link: `https://www.bilibili.com/video/av${avid}/#reply${item.rpid}`
|
link: `https://www.bilibili.com/video/av${aid}/#reply${item.rpid}`
|
||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user