rss: add panda room

This commit is contained in:
DIYgod
2018-05-23 16:43:46 +08:00
parent eea9294e12
commit 0201ee122d
4 changed files with 56 additions and 3 deletions
+3 -1
View File
@@ -108,7 +108,9 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
* 用户(团队)
* 关键词
* 斗鱼
* 房间开播
* 直播间开播
* 熊猫直播
* 直播间开播下播
## 参与我们
+12 -2
View File
@@ -849,10 +849,20 @@ key: 产品密钥
## 斗鱼
### 房间开播
### 直播间开播
举例: [https://rsshub.app/douyu/room/24422](https://rsshub.app/douyu/room/24422)
路由: `/douyu/room/:id`
参数: id,房间 id,可在主播房间页 URL 中找到
参数: id,直播间 id,可在主播直播间页 URL 中找到
## 熊猫直播
### 直播间开播下播
举例: [https://rsshub.app/panda/room/10300](https://rsshub.app/panda/room/10300)
路由: `/panda/room/:id`
参数: id,直播间 id,可在主播直播间页 URL 中找到
+3
View File
@@ -220,4 +220,7 @@ router.get('/dribbble/keyword/:keyword', require('./routes/dribbble/keyword'));
// 斗鱼
router.get('/douyu/room/:id', require('./routes/douyu/room'));
// 熊猫直播
router.get('/panda/room/:id', require('./routes/panda/room'));
module.exports = router;
+38
View File
@@ -0,0 +1,38 @@
const axios = require('../../utils/axios');
const config = require('../../config');
module.exports = async (ctx) => {
const id = ctx.params.id;
const response = await axios({
method: 'get',
url: `http://www.panda.tv/api_room?roomid=${id}`,
headers: {
'User-Agent': config.ua,
Referer: `https://www.panda.tv/${id}`,
},
});
const data = response.data.data;
ctx.state.data = {
title: `${data.hostinfo.name}的熊猫直播间`,
link: `https://www.panda.tv/${id}`,
item: [
{
title: `开播: ${data.roominfo.name}`,
description: `<img referrerpolicy="no-referrer" src="${data.roominfo.pictures.img}">`,
pubDate: new Date(parseInt(data.roominfo.start_time) * 1000).toUTCString(),
guid: data.roominfo.start_time,
link: `https://www.panda.tv/${id}`,
},
{
title: `下播: ${data.roominfo.name}`,
description: `<img referrerpolicy="no-referrer" src="${data.roominfo.pictures.img}">`,
pubDate: new Date(parseInt(data.roominfo.end_time) * 1000).toUTCString(),
guid: data.roominfo.end_time,
link: `https://www.panda.tv/${id}`,
},
],
};
};