mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-19 09:52:21 +08:00
feat:add showroom live (#4226)
This commit is contained in:
@@ -10,6 +10,12 @@ pageClass: routes
|
||||
|
||||
<Route author="LogicJake" example="/kingkong/room/2133342" path="/kingkong/room/:id" :paramsDesc="['直播间 id, 可在主播直播间页 URL 中找到']"/>
|
||||
|
||||
## SHOWROOM 直播
|
||||
|
||||
### 直播间开播
|
||||
|
||||
<Route author="nwindz" example="/showroom/room/93401" path="/showroom/room/:id" :paramsDesc="['直播间 id, 打开浏览器控制台,刷新页面,找到请求中的room_id参数']"/>
|
||||
|
||||
## 哔哩哔哩直播
|
||||
|
||||
### 直播开播
|
||||
|
||||
@@ -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