Skip to content

Commit 917e296

Browse files
authored
Merge pull request #600 from DIYgod/master
[pull] master from diygod:master
2 parents e6f7396 + e5bd5fc commit 917e296

File tree

12 files changed

+94
-50
lines changed

12 files changed

+94
-50
lines changed

docs/live.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ pageClass: routes
5050

5151
<Route author="SettingDust xyqfer" example="/huya/live/edmunddzhang" path="/huya/live/:id" :paramsDesc="['直播间id或主播名(有一些id是名字,如上)']" radar="1" rssbud="1"/>
5252

53-
## 浪 Play (原 kingkong) 直播
53+
## 浪 Play 直播
5454

5555
### 直播间开播
5656

57-
<Route author="MittWillson" example="/langlive/room/666666" path="/langlive/room/:id" :paramsDesc="['直播间 id, 可在主播直播间页 URL 中找到']"/>
57+
<Route author="MittWillson" example="/lang/live/room/1352360" path="/lang/live/room/:id" :paramsDesc="['直播间 id, 可在主播直播间页 URL 中找到']"/>
5858

5959
## 猎趣 TV
6060

lib/router.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ router.get('/dribbble/keyword/:keyword', lazyloadRouteHandler('./routes/dribbble
194194
router.get('/huya/live/:id', lazyloadRouteHandler('./routes/huya/live'));
195195

196196
// 浪Play(原kingkong)直播
197-
router.get('/kingkong/room/:id', lazyloadRouteHandler('./routes/langlive/room'));
198-
router.get('/langlive/room/:id', lazyloadRouteHandler('./routes/langlive/room'));
197+
// router.get('/kingkong/room/:id', lazyloadRouteHandler('./routes/langlive/room'));
198+
// router.get('/langlive/room/:id', lazyloadRouteHandler('./routes/langlive/room'));
199199

200200
// SHOWROOM直播
201201
router.get('/showroom/room/:id', lazyloadRouteHandler('./routes/showroom/room'));

lib/routes/langlive/room.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

lib/v2/javbus/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ const { parseDate } = require('@/utils/parse-date');
44
const { art } = require('@/utils/render');
55
const path = require('path');
66

7+
const toSize = (raw) => {
8+
const matches = raw.match(/(\d+(\.\d+)?)(\w+)/);
9+
return matches[3] === 'GB' ? matches[1] * 1024 : matches[1];
10+
};
11+
712
module.exports = async (ctx) => {
813
const isWestern = /^\/western/.test(ctx.path);
914

@@ -19,7 +24,7 @@ module.exports = async (ctx) => {
1924
const $ = cheerio.load(response.data);
2025

2126
let items = $('.movie-box')
22-
.slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 30)
27+
.slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 50)
2328
.toArray()
2429
.map((item) => {
2530
item = $(item);
@@ -98,11 +103,12 @@ module.exports = async (ctx) => {
98103
link: td.first().attr('href'),
99104
size: td.eq(1).text().trim(),
100105
date: td.last().text().trim(),
106+
score: content(tr).find('a').length ** 8 * toSize(td.eq(1).text().trim()),
101107
};
102108
});
103109

104110
if (magnets) {
105-
item.enclosure_url = magnets[0].link;
111+
item.enclosure_url = magnets.sort((a, b) => b.score - a.score)[0].link;
106112
item.enclosure_type = 'application/x-bittorrent';
107113
}
108114
} catch (e) {

lib/v2/javbus/templates/description.art

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,20 @@
99
{{/if}}
1010
<br>
1111
<h4>磁力連結投稿</h4>
12+
<table>
13+
<tr>
14+
<th>磁力名稱</th>
15+
<th>檔案大小</th>
16+
<th>分享日期</th>
17+
</tr>
1218
{{each magnets magnet}}
13-
<li><a href="{{ magnet.link }}">{{ magnet.title }} [{{ magnet.size }}] ({{ magnet.date }})</a></li>
19+
<tr>
20+
<td><a href="{{ magnet.link }}">{{ magnet.title }}</a></td>
21+
<td>{{ magnet.size }}</td>
22+
<td>{{ magnet.date }}</td>
23+
</tr>
1424
{{/each}}
25+
</table>
1526
<h4>樣品圖像</h4>
1627
{{each thumbs}}
1728
<img src="{{ $value }}">

lib/v2/lang/maintainer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
'/live/room/:id': ['MittWillson'],
3+
};

lib/v2/lang/radar.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
'lang.live': {
3+
_name: '浪 Play 直播',
4+
'.': [
5+
{
6+
title: '直播间开播',
7+
docs: 'https://docs.rsshub.app/live.html#lang-play-yuan-zhi-bo',
8+
source: ['/room/:id'],
9+
target: '/lang/live/room/:id',
10+
},
11+
],
12+
},
13+
};

lib/v2/lang/room.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const got = require('@/utils/got');
2+
const { art } = require('@/utils/render');
3+
const path = require('path');
4+
5+
module.exports = async (ctx) => {
6+
const id = ctx.params.id;
7+
const url = `https://www.lang.live/room/${id}`;
8+
9+
const api = 'https://api.lang.live/langweb/v1/room/liveinfo';
10+
const {
11+
data: { data },
12+
} = await got(api, {
13+
searchParams: {
14+
room_id: id,
15+
},
16+
});
17+
18+
let item = [];
19+
const name = data.live_info.nickname;
20+
if (data.live_info.live_status === 1) {
21+
item = [
22+
{
23+
title: `${name} 开播了`,
24+
link: url,
25+
guid: `lang:live:room:${id}:${data.live_info.live_id}`,
26+
description: art(path.join(__dirname, 'templates/room.art'), {
27+
live_info: data.live_info,
28+
}),
29+
},
30+
];
31+
}
32+
33+
ctx.state.data = {
34+
title: `${name} 的浪 Play 直播`,
35+
description: data.live_info.sign,
36+
link: url,
37+
item,
38+
allowEmpty: true,
39+
};
40+
};

lib/v2/lang/router.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = (router) => {
2+
router.get('/live/room/:id', require('./room'));
3+
};

lib/v2/lang/templates/room.art

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<img src="{{ live_info.headimg }}">

0 commit comments

Comments
 (0)