mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-15 18:30:53 +08:00
Fix bangumi eps date (#942) & 虎牙直播
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -13,3 +13,4 @@ yarn-error.log
|
|||||||
tmp
|
tmp
|
||||||
newrelic_agent.log
|
newrelic_agent.log
|
||||||
*.swp
|
*.swp
|
||||||
|
*.iml
|
||||||
|
|||||||
@@ -686,6 +686,10 @@ GitHub 官方也提供了一些 RSS:
|
|||||||
|
|
||||||
<route name="直播间开播下播" author="DIYgod" example="/panda/room/10300" path="/panda/room/:id" :paramsDesc="['直播间 id, 可在主播直播间页 URL 中找到']"/>
|
<route name="直播间开播下播" author="DIYgod" example="/panda/room/10300" path="/panda/room/:id" :paramsDesc="['直播间 id, 可在主播直播间页 URL 中找到']"/>
|
||||||
|
|
||||||
|
### 虎牙直播
|
||||||
|
|
||||||
|
<route name="直播间开播" author="SettingDust" example="/huya/live/edmunddzhang" path="/huya/live/:id" :paramsDesc="['直播间id或主播名(有一些id是名字,如上)']"/>
|
||||||
|
|
||||||
## 音视频
|
## 音视频
|
||||||
|
|
||||||
### bilibili
|
### bilibili
|
||||||
|
|||||||
@@ -265,6 +265,9 @@ router.get('/douyu/room/:id', require('./routes/douyu/room'));
|
|||||||
// 熊猫直播
|
// 熊猫直播
|
||||||
router.get('/panda/room/:id', require('./routes/panda/room'));
|
router.get('/panda/room/:id', require('./routes/panda/room'));
|
||||||
|
|
||||||
|
// 虎牙
|
||||||
|
router.get('/huya/live/:id', require('./routes/huya/live'));
|
||||||
|
|
||||||
// v2ex
|
// v2ex
|
||||||
router.get('/v2ex/topics/:type', require('./routes/v2ex/topics'));
|
router.get('/v2ex/topics/:type', require('./routes/v2ex/topics'));
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
const axios = require('../../../utils/axios');
|
const axios = require('../../../utils/axios');
|
||||||
const DateTime = require('luxon').DateTime;
|
|
||||||
|
|
||||||
module.exports = async (subjectID) => {
|
module.exports = async (subjectID) => {
|
||||||
const url = `https://api.bgm.tv/subject/${subjectID}?responseGroup=large`;
|
const url = `https://api.bgm.tv/subject/${subjectID}?responseGroup=large`;
|
||||||
@@ -19,7 +18,7 @@ module.exports = async (subjectID) => {
|
|||||||
item: activeEps.reverse().map((e) => ({
|
item: activeEps.reverse().map((e) => ({
|
||||||
title: `ep.${e.sort} ${e.name_cn}`,
|
title: `ep.${e.sort} ${e.name_cn}`,
|
||||||
description: `<img src="${epsInfo.images.common}" alt="ep.${e.sort} ${e.name_cn}"><p>${e.desc.replace(/\n+/g, '<br>')}</p>`,
|
description: `<img src="${epsInfo.images.common}" alt="ep.${e.sort} ${e.name_cn}"><p>${e.desc.replace(/\n+/g, '<br>')}</p>`,
|
||||||
pubDate: DateTime.fromFormat(e.airdate, 'yyyy-L-dd'),
|
pubDate: new Date(e.airdate).toUTCString(),
|
||||||
guid: e.id,
|
guid: e.id,
|
||||||
link: e.url,
|
link: e.url,
|
||||||
})),
|
})),
|
||||||
|
|||||||
31
routes/huya/live.js
Normal file
31
routes/huya/live.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
const axios = require('../../utils/axios');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const id = ctx.params.id;
|
||||||
|
const url = `https://search.cdn.huya.com/?m=Search&do=getSearchContent&q=${id}&typ=-5&rows=1`;
|
||||||
|
const response = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url: url,
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = response.data.response['1'].docs[0];
|
||||||
|
|
||||||
|
let items = [];
|
||||||
|
if (data.gameLiveOn) {
|
||||||
|
items = [
|
||||||
|
{
|
||||||
|
title: `${data.live_intro}`,
|
||||||
|
pubDate: new Date(data.rec_live_time).toUTCString(),
|
||||||
|
guid: data.uid,
|
||||||
|
link: url,
|
||||||
|
image: data.game_avatarUrl180,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${data.game_nick}的虎牙直播`,
|
||||||
|
link: url,
|
||||||
|
item: items,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user