mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-19 06:38:55 +08:00
@@ -35,7 +35,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||||||
- UP 主投币视频
|
- UP 主投币视频
|
||||||
- UP 主粉丝
|
- UP 主粉丝
|
||||||
- UP 主关注用户
|
- UP 主关注用户
|
||||||
- 分区视频
|
- 分区视频(投稿时间排序)
|
||||||
|
- 分区视频(视频热度排序)
|
||||||
- 视频评论
|
- 视频评论
|
||||||
- link 公告
|
- link 公告
|
||||||
- 直播开播
|
- 直播开播
|
||||||
|
|||||||
@@ -464,7 +464,7 @@ fid,收藏夹 ID,可在收藏夹的 URL 中找到,默认收藏夹建议使用
|
|||||||
|
|
||||||
参数: uid,用户 id,可在 UP 主主页中找到
|
参数: uid,用户 id,可在 UP 主主页中找到
|
||||||
|
|
||||||
### 分区视频 <Author uid="DIYgod"/>
|
### 分区视频(投稿时间排序) <Author uid="DIYgod"/>
|
||||||
|
|
||||||
举例: [https://rsshub.app/bilibili/partion/33](https://rsshub.app/bilibili/partion/33)
|
举例: [https://rsshub.app/bilibili/partion/33](https://rsshub.app/bilibili/partion/33)
|
||||||
|
|
||||||
@@ -472,6 +472,18 @@ fid,收藏夹 ID,可在收藏夹的 URL 中找到,默认收藏夹建议使用
|
|||||||
|
|
||||||
参数: tid,分区 id
|
参数: tid,分区 id
|
||||||
|
|
||||||
|
### 分区视频(视频热度排序) <Author uid="lengthmin"/>
|
||||||
|
|
||||||
|
举例: [https://rsshub.app/bilibili/partion/ranking/171/3](https://rsshub.app/bilibili/partion/ranking/171/3)
|
||||||
|
|
||||||
|
路由: `/bilibili/partion/ranking/:tid/:days?`
|
||||||
|
|
||||||
|
参数:
|
||||||
|
|
||||||
|
tid,分区 id
|
||||||
|
|
||||||
|
days, 可选, 缺省为 7, 指最近多少天内的热度排序
|
||||||
|
|
||||||
动画
|
动画
|
||||||
|
|
||||||
| MAD·AMV | MMD·3D | 短片·手书·配音 | 综合 |
|
| MAD·AMV | MMD·3D | 短片·手书·配音 | 综合 |
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ router.get('/bilibili/user/dynamic/:uid', require('./routes/bilibili/dynamic'));
|
|||||||
router.get('/bilibili/user/followers/:uid', require('./routes/bilibili/followers'));
|
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/partion/ranking/:tid/:days?', require('./routes/bilibili/partion-ranking'));
|
||||||
router.get('/bilibili/bangumi/:seasonid', require('./routes/bilibili/bangumi'));
|
router.get('/bilibili/bangumi/:seasonid', require('./routes/bilibili/bangumi'));
|
||||||
router.get('/bilibili/video/reply/:aid', require('./routes/bilibili/reply'));
|
router.get('/bilibili/video/reply/:aid', require('./routes/bilibili/reply'));
|
||||||
router.get('/bilibili/link/news/:product', require('./routes/bilibili/linkNews'));
|
router.get('/bilibili/link/news/:product', require('./routes/bilibili/linkNews'));
|
||||||
|
|||||||
56
routes/bilibili/partion-ranking.js
Normal file
56
routes/bilibili/partion-ranking.js
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
const axios = require('../../utils/axios');
|
||||||
|
const axios_ins = axios.create({
|
||||||
|
headers: {
|
||||||
|
Referer: 'https://www.bilibili.com/',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function formatDate(now) {
|
||||||
|
const year = now.getFullYear();
|
||||||
|
const month = now.getMonth() + 1;
|
||||||
|
const date = now.getDate();
|
||||||
|
const dateTime = year + '' + (month >= 10 ? month : '0' + month) + '' + (date >= 10 ? date : '0' + date);
|
||||||
|
return dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const tid = ctx.params.tid;
|
||||||
|
const days = ctx.params.days ? ctx.params.days : 7;
|
||||||
|
|
||||||
|
const responseApi = `https://api.bilibili.com/x/web-interface/newlist?ps=15&rid=${tid}&_=${+new Date()}`;
|
||||||
|
|
||||||
|
const response = await axios_ins.get(responseApi);
|
||||||
|
const items = [];
|
||||||
|
let name = '未知';
|
||||||
|
let list = {};
|
||||||
|
|
||||||
|
list = response.data.data.archives;
|
||||||
|
if (list && list[0] && list[0].tname) {
|
||||||
|
name = list[0].tname;
|
||||||
|
}
|
||||||
|
|
||||||
|
const time_from = formatDate(new Date(new Date().getTime() - 1000 * 60 * 60 * 24 * days)); // n天前的日期
|
||||||
|
const time_to = formatDate(new Date()); // 今天的日期
|
||||||
|
const HotRankResponseApi = `https://s.search.bilibili.com/cate/search?main_ver=v3&search_type=video&view_type=hot_rank&cate_id=${tid}&time_from=${time_from}&time_to=${time_to}&_=${+new Date()}`;
|
||||||
|
const HotRankResponse = await axios_ins.get(HotRankResponseApi);
|
||||||
|
const hotlist = HotRankResponse.data.result;
|
||||||
|
|
||||||
|
for (let i = 0; i < hotlist.length; i++) {
|
||||||
|
let item = hotlist[i];
|
||||||
|
|
||||||
|
item = {
|
||||||
|
title: `${item.title} - ${item.author}`,
|
||||||
|
description: `${item.description}<img referrerpolicy="no-referrer" src="${item.pic}"></br>Tags:${item.tag}`,
|
||||||
|
pubDate: new Date(item.pubdate).toUTCString(),
|
||||||
|
link: item.arcurl,
|
||||||
|
};
|
||||||
|
items.push(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `bilibili ${name} 最热视频`,
|
||||||
|
link: 'https://www.bilibili.com',
|
||||||
|
description: `bilibili ${name}分区 最热视频`,
|
||||||
|
item: items,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user