rss: add douyu room
This commit is contained in:
@@ -107,6 +107,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
||||
* 流行
|
||||
* 用户(团队)
|
||||
* 关键词
|
||||
* 斗鱼
|
||||
* 房间开播
|
||||
|
||||
## 参与我们
|
||||
|
||||
|
||||
@@ -846,3 +846,13 @@ key: 产品密钥
|
||||
路由: `/dribbble/keyword/:keyword`
|
||||
|
||||
参数: keyword,想要订阅的关键词
|
||||
|
||||
## 斗鱼
|
||||
|
||||
### 房间开播
|
||||
|
||||
举例: [https://rsshub.app/douyu/room/24422](https://rsshub.app/douyu/room/24422)
|
||||
|
||||
路由: `/douyu/room/:id`
|
||||
|
||||
参数: id,房间 id,可在主播房间页 URL 中找到
|
||||
|
||||
@@ -217,4 +217,7 @@ router.get('/dribbble/popular/:timeframe?', require('./routes/dribbble/popular')
|
||||
router.get('/dribbble/user/:name', require('./routes/dribbble/user'));
|
||||
router.get('/dribbble/keyword/:keyword', require('./routes/dribbble/keyword'));
|
||||
|
||||
// 斗鱼
|
||||
router.get('/douyu/room/:id', require('./routes/douyu/room'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
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://open.douyucdn.cn/api/RoomApi/room/${id}`,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
Referer: `https://www.douyu.com/${id}`,
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data.data;
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${data.owner_name}的斗鱼直播间`,
|
||||
link: `https://www.douyu.com/${id}`,
|
||||
item: [
|
||||
{
|
||||
title: data.room_name,
|
||||
pubDate: new Date(data.start_time).toUTCString(),
|
||||
guid: data.start_time,
|
||||
link: `https://www.douyu.com/${id}`,
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user