mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat:add showroom live (#4226)
This commit is contained in:
@@ -246,6 +246,9 @@ router.get('/huya/live/:id', require('./routes/huya/live'));
|
||||
// kingkong直播
|
||||
router.get('/kingkong/room/:id', require('./routes/kingkong/room'));
|
||||
|
||||
// SHOWROOM直播
|
||||
router.get('/showroom/room/:id', require('./routes/showroom/room'));
|
||||
|
||||
// v2ex
|
||||
router.get('/v2ex/topics/:type', require('./routes/v2ex/topics'));
|
||||
router.get('/v2ex/post/:postid', require('./routes/v2ex/post'));
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://www.showroom-live.com/api/room/profile?room_id=${id}`,
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
|
||||
let item;
|
||||
if (data.is_onlive) {
|
||||
item = [
|
||||
{
|
||||
title: `${data.room_name}`,
|
||||
pubDate: new Date(data.current_live_started_at * 1000).toUTCString(),
|
||||
guid: new Date(data.current_live_started_at * 1000).toUTCString(),
|
||||
link: data.share_url_live,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${data.room_name}的SHOWROOM直播间`,
|
||||
link: data.share_url_live,
|
||||
item: item,
|
||||
allowEmpty: true,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user