mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-02 10:08:02 +08:00
feat(route): add 企鹅直播直播间开播 (#8345)
This commit is contained in:
@@ -62,6 +62,12 @@ pageClass: routes
|
||||
|
||||
<Route author="hoilc" example="/egameqq/room/497383565" path="/egameqq/room/:id" :paramsDesc="['直播间 id, 可在主播直播间页 URL 中找到']"/>
|
||||
|
||||
## 企鹅直播
|
||||
|
||||
### 直播间开播
|
||||
|
||||
<Route author="nczitzk" example="/qq/live/10012045" path="/qq/live/:id" :paramsDesc="['直播间 id, 可在主播直播间页 URL 中找到']"/>
|
||||
|
||||
## 战旗直播
|
||||
|
||||
### 直播间开播
|
||||
|
||||
36
lib/v2/qq/live.js
Normal file
36
lib/v2/qq/live.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const rootUrl = 'https://live.qq.com';
|
||||
const currentUrl = `${rootUrl}/${id}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const data = response.data.match(/"is_live":(\d),"game_count".*"nickname":"(.*)","child_name".*"show_time":(\d+),"activity".*"room_name":"(.*)","user_chat_level"/);
|
||||
|
||||
const items =
|
||||
data[1] === '1'
|
||||
? [
|
||||
{
|
||||
author: data[2],
|
||||
guid: data[3],
|
||||
title: data[4],
|
||||
pubDate: parseDate(data[3] * 1000),
|
||||
link: currentUrl,
|
||||
},
|
||||
]
|
||||
: [];
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${data[2]}直播间 - 企鹅直播`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
allowEmpty: true,
|
||||
};
|
||||
};
|
||||
3
lib/v2/qq/maintainer.js
Normal file
3
lib/v2/qq/maintainer.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/live/:id': ['nczitzk'],
|
||||
};
|
||||
13
lib/v2/qq/radar.js
Normal file
13
lib/v2/qq/radar.js
Normal file
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'qq.com': {
|
||||
_name: '腾讯网',
|
||||
live: [
|
||||
{
|
||||
title: '企鹅直播',
|
||||
docs: 'https://docs.rsshub.app/live.html#qi-e-zhi-bo-zhi-bo-jian-ti-xing',
|
||||
source: ['/:id', '/'],
|
||||
target: '/qq/live/:id',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
3
lib/v2/qq/router.js
Normal file
3
lib/v2/qq/router.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/live/:id', require('./live'));
|
||||
};
|
||||
Reference in New Issue
Block a user