mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(route): add 弯弯字幕组 (#7408)
Co-authored-by: NeverBehave <gayhub@never.pet>
This commit is contained in:
co-authored by
NeverBehave
parent
9e6aaf2c94
commit
a87ecdfed2
@@ -979,6 +979,22 @@ pageClass: routes
|
||||
|
||||
<Route author="Andiedie" example="/tencentvideo/playlist/jx7g4sm320sqm7i" path="/tencentvideo/playlist/:id" :paramsDesc="['播放列表 ID,可以在 URL 中找到']" radar="1" />
|
||||
|
||||
## 弯弯字幕组
|
||||
|
||||
### 分类
|
||||
|
||||
<Route author="nczitzk" example="/wanwansub/139" path="/wanwansub/:id?" :paramsDesc="['分类 id,见下表,默认为 ALL']" >
|
||||
|
||||
| ALL | 英语小分队 | 日语小分队 | 韩语小分队 | 葡语小分队 | 西语小分队 | 法语小分队 | 意语小分队 | 德语小分队 | 泰语小分队 | 其他语种 |
|
||||
| --- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | -------- |
|
||||
| 139 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 153 | 117 | 154 |
|
||||
|
||||
</Route>
|
||||
|
||||
### 剧集
|
||||
|
||||
<Route author="nczitzk" example="/wanwansub/info/393" path="/wanwansub/info/:id" :paramsDesc="['剧集 id,可在剧集页 URL 中找到']" />
|
||||
|
||||
## 网易云音乐
|
||||
|
||||
### 歌单歌曲
|
||||
|
||||
@@ -4067,6 +4067,10 @@ router.get('/jisilu/topic/:user', require('./routes/jisilu/topic'));
|
||||
// Constitutional Court of Baden-Württemberg (Germany)
|
||||
router.get('/verfghbw/press/:keyword?', require('./routes/verfghbw/press'));
|
||||
|
||||
// 弯弯字幕组
|
||||
router.get('/wanwansub/info/:id', require('./routes/wanwansub/info'));
|
||||
router.get('/wanwansub/:id?', require('./routes/wanwansub/index'));
|
||||
|
||||
// FIX 字幕侠
|
||||
router.get('/zimuxia/portfolio/:id', require('./routes/zimuxia/portfolio'));
|
||||
router.get('/zimuxia/:category?', require('./routes/zimuxia/index'));
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id || '139';
|
||||
|
||||
const rootUrl = 'http://wanwansub.com';
|
||||
const currentUrl = `${rootUrl}/node/${id}`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $('.pg-item a')
|
||||
.slice(0, 10)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.text(),
|
||||
link: `${rootUrl}${item.attr('href')}`,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
content('.button').remove();
|
||||
|
||||
const links = detailResponse.data.match(/<a href="magnet:(.*?)" target="_self">磁力<\/a>/g);
|
||||
|
||||
if (links) {
|
||||
item.enclosure_type = 'application/x-bittorrent';
|
||||
item.enclosure_url = links.pop().match(/<a href="(.*)" target="_self">磁力<\/a>/)[1];
|
||||
}
|
||||
|
||||
item.description = content('.content-box').html();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const rootUrl = 'http://wanwansub.com';
|
||||
const currentUrl = `${rootUrl}/info/${id}`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const items = $('.lightbox-image')
|
||||
.nextAll('p')
|
||||
.slice(3)
|
||||
.map((_, item) => {
|
||||
const i = {};
|
||||
|
||||
item = $(item);
|
||||
|
||||
item.find('a').each(function () {
|
||||
if ($(this).text() === '磁力') {
|
||||
i.enclosure_url = $(this).attr('href');
|
||||
i.enclosure_type = 'application/x-bittorrent';
|
||||
}
|
||||
});
|
||||
|
||||
i.description = `<p>${item.html()}</p>`;
|
||||
i.title = item.text().split(' ')[0];
|
||||
i.link = currentUrl;
|
||||
|
||||
return i;
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user