feat(route): add 秋爸日字 (#7715)

* feat(route): add 秋爸日字

* refactor: migrate to v2

Co-authored-by: TonyRL <TonyRL@users.noreply.github.com>
This commit is contained in:
Ethan Shen 2022-02-22 21:39:10 +08:00 committed by GitHub
parent 0022ca1d2e
commit 1892e139a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 91 additions and 0 deletions

View File

@ -1238,6 +1238,18 @@ JavDB 有多个备用域名,本路由默认使用永久域名 <https://javdb.c
<Route author="nczitzk" example="/qingting/channel/293411" path="/qingting/channel/:id" :paramsDesc="['专辑id, 可在专辑页 URL 中找到']"/>
## 秋爸日字
### 分类
<Route author="nczitzk" example="/qq88" path="/qq88/:category?" :paramsDesc="['分类 id见下表默认为首页']">
| 首页 | オトナの土ドラ | 日剧 | 日剧 SP |
| ---- | -------------- | ---- | ------- |
| | 10 | 5 | 11 |
</Route>
## 人人影视
### 评测推荐

60
lib/v2/qq88/index.js Normal file
View File

@ -0,0 +1,60 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const category = ctx.params.category ?? '';
const rootUrl = 'https://qq88.info';
const currentUrl = category ? `${rootUrl}/?cat=${category}` : rootUrl;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.entry-title a')
.slice(0, 15)
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: item.attr('href'),
pubDate: parseDate(item.parent().next().find('.mh-meta-date').eq(-1).text().split('')[1]),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
const links = content('.entry-content').find('a[download]');
item.enclosure_type = 'video/mp4';
item.enclosure_url = links.eq(-1).attr('href');
item.description = `<video controls><source src="${item.enclosure_url}"></video><br>`;
links.each(function () {
item.description += `<li><a href="${content(this).attr('href')}">${content(this).text()}</a></li>`;
});
return item;
})
)
);
ctx.state.data = {
title: `${$('.page-title').text() || '首页'} - 秋爸日字`,
link: currentUrl,
item: items,
};
};

View File

@ -0,0 +1,3 @@
module.exports = {
'/:category?': ['nczitzk'],
};

13
lib/v2/qq88/radar.js Normal file
View File

@ -0,0 +1,13 @@
module.exports = {
'qq88.info': {
_name: '秋爸日字',
'.': [
{
title: '分类',
docs: 'https://docs.rsshub.app/multimedia.html#qiu-ba-ri-zi',
source: '/',
target: (_params, url) => (new URL(url).searchParams.get('cat') ? `/qq88/${new URL(url).searchParams.get('cat')}` : '/qq88'),
},
],
},
};

3
lib/v2/qq88/router.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/:category?', require('./'));
};