fix(route): lang.live (#11343)

This commit is contained in:
Tony
2022-11-29 04:55:04 +08:00
committed by GitHub
parent 445594870d
commit 686b4062c0
8 changed files with 64 additions and 37 deletions
+2 -2
View File
@@ -50,11 +50,11 @@ pageClass: routes
<Route author="SettingDust xyqfer" example="/huya/live/edmunddzhang" path="/huya/live/:id" :paramsDesc="['直播间id或主播名(有一些id是名字,如上)']" radar="1" rssbud="1"/>
## 浪 Play (原 kingkong) 直播
## 浪 Play 直播
### 直播间开播
<Route author="MittWillson" example="/langlive/room/666666" path="/langlive/room/:id" :paramsDesc="['直播间 id, 可在主播直播间页 URL 中找到']"/>
<Route author="MittWillson" example="/lang/live/room/1352360" path="/lang/live/room/:id" :paramsDesc="['直播间 id, 可在主播直播间页 URL 中找到']"/>
## 猎趣 TV
+2 -2
View File
@@ -194,8 +194,8 @@ router.get('/dribbble/keyword/:keyword', lazyloadRouteHandler('./routes/dribbble
router.get('/huya/live/:id', lazyloadRouteHandler('./routes/huya/live'));
// 浪Play(原kingkong)直播
router.get('/kingkong/room/:id', lazyloadRouteHandler('./routes/langlive/room'));
router.get('/langlive/room/:id', lazyloadRouteHandler('./routes/langlive/room'));
// router.get('/kingkong/room/:id', lazyloadRouteHandler('./routes/langlive/room'));
// router.get('/langlive/room/:id', lazyloadRouteHandler('./routes/langlive/room'));
// SHOWROOM直播
router.get('/showroom/room/:id', lazyloadRouteHandler('./routes/showroom/room'));
-33
View File
@@ -1,33 +0,0 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const id = ctx.params.id;
const url = `https://play.lang.live/${id}`;
const api = `https://game-api.lang.live/webapi/v1/room/info?room_id=${id}`;
const response = await got({
method: 'get',
url: api,
});
let item = [];
let name = '';
if (response.data.data.live_info.live_status === 1) {
name = response.data.data.live_info.nickname;
item = [
{
title: response.data.data.live_info.nickname + '开播了',
link: url,
guid: response.data.data.live_info.live_id,
description: response.data.data.live_info.describe,
},
];
}
ctx.state.data = {
title: `${name}的浪Play直播`,
link: url,
item,
allowEmpty: true,
};
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/live/room/:id': ['MittWillson'],
};
+13
View File
@@ -0,0 +1,13 @@
module.exports = {
'lang.live': {
_name: '浪 Play 直播',
'.': [
{
title: '直播间开播',
docs: 'https://docs.rsshub.app/live.html#lang-play-yuan-zhi-bo',
source: ['/room/:id'],
target: '/lang/live/room/:id',
},
],
},
};
+40
View File
@@ -0,0 +1,40 @@
const got = require('@/utils/got');
const { art } = require('@/utils/render');
const path = require('path');
module.exports = async (ctx) => {
const id = ctx.params.id;
const url = `https://www.lang.live/room/${id}`;
const api = 'https://api.lang.live/langweb/v1/room/liveinfo';
const {
data: { data },
} = await got(api, {
searchParams: {
room_id: id,
},
});
let item = [];
const name = data.live_info.nickname;
if (data.live_info.live_status === 1) {
item = [
{
title: `${name} 开播了`,
link: url,
guid: `lang:live:room:${id}:${data.live_info.live_id}`,
description: art(path.join(__dirname, 'templates/room.art'), {
live_info: data.live_info,
}),
},
];
}
ctx.state.data = {
title: `${name} 的浪 Play 直播`,
description: data.live_info.sign,
link: url,
item,
allowEmpty: true,
};
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/live/room/:id', require('./room'));
};
+1
View File
@@ -0,0 +1 @@
<img src="{{ live_info.headimg }}">