feat: add OneJAV (supportBT)(radar) (#5298)

This commit is contained in:
Monst.x
2020-08-01 21:42:06 +08:00
committed by GitHub
parent 3fa7e78522
commit 6e2c0821ea
4 changed files with 126 additions and 0 deletions

View File

@@ -1925,6 +1925,44 @@
},
],
},
'onejav.com': {
_name: 'OneJAV BT',
'.': [
{
title: '今日种子',
docs: 'https://docs.rsshub.app/multimedia.html#onejav',
source: '/',
target: (params, url, document) => {
const today = document.querySelector('div.card.mb-1.card-overview').getAttribute('data-date').replace(/-/g, '');
return `/onejav/day/${today}`;
},
},
{
title: '今日演员',
docs: 'https://docs.rsshub.app/multimedia.html#onejav',
source: '/',
target: (params, url, document) => {
const star = document.querySelector('div.card-content > div > a').getAttribute('href');
return `/onejav${star}`;
},
},
{
title: '页面种子',
docs: 'https://docs.rsshub.app/multimedia.html#onejav',
source: ['/:type', '/:type/:key', '/:type/:key/:morekey'],
target: (params, url, document) => {
const itype = params.morekey === undefined ? `${params.type}` : params.type === 'tag' ? 'tag' : 'day';
let ikey = `${itype === 'day' ? params.type : ''}${params.key || ''}${params.morekey || ''}`;
if (ikey === '' && itype === 'tag') {
ikey = document.querySelector('div.thumbnail.is-inline > a').getAttribute('href').replace('/tag/', '').replace('/', '%2F');
} else if (ikey === '' && itype === 'actress') {
ikey = document.querySelector('div.card > a').getAttribute('href').replace('/actress/', '');
}
return `/onejav/${itype}/${ikey}`;
},
},
],
},
'sexinsex.net': {
_name: 'sexinsex',
'.': [

View File

@@ -215,6 +215,54 @@ pageClass: routes
<Route author="Lava-Swimmer" example="/nyaa/search/psycho-pass" path="/nyaa/search/:keyword" :paramsDesc="['搜索关键字']" supportBT="1"/>
## OneJAV
::: tip 提示
官方提供的订阅源不支持 BT 下载订阅,地址为 <https://onejav.com/feeds/>
:::
### OneJAV BT
<Route author="monsterxcn" example="/onejav/popular/30" path="/onejav/:type/:key?" :paramsDesc="['类型', '关键词']" supportBT="1" radar="1">
**类型**
| 最新 | 热门 | 随机 | 指定演员 | 指定标签 | 指定日期 |
| ---- | ------- | ------ | -------- | -------- | -------- |
| new | popular | random | actress | tag | day |
**关键词**
| 空 | 日期范围 | 演员名 | 标签名 | 日期 |
| -- | ----------- | ------------ | -------------- | -------- |
| | 7 / 30 / 60 | Yua%20Mikami | Adult%20Awards | YYYYMMDD |
**示例说明**
- `/onejav/new`
仅当类型为 `new` `popular``random` 时关键词可为 **空**
- `/onejav/popular/30`
`popular` `random` 类型的关键词可填写 `7` `30``60` 三个 **日期范围** 之一
- `/onejav/actress/Yua%20Mikami`
`actress` 类型的关键词必须填写 **演员名** ,可在 [此处](https://onejav.com/actress/) 演员单页链接中获取
- `/onejav/tag/Adult%20Awards`
`tag` 类型的关键词必须填写 **标签名** 且标签中的 `/` 必须替换为 `%2F` ,可在 [此处](https://onejav.com/tag/) 标签单页链接中获取
- `/onejav/day/20200730`
`day` 类型的关键词必须填写 **日期** ,按照示例写成形如 `20200730` 的格式
</Route>
## rs05 人生 05 电影
### rs05 电影列表

View File

@@ -3037,4 +3037,7 @@ router.get('/hfut/tzgg', require('./routes/universities/hfut/tzgg'));
// Darwin Awards
router.get('/darwinawards/all', require('./routes/darwinawards/articles'));
// OneJAV
router.get('/onejav/:type/:key?', require('./routes/onejav/one'));
module.exports = router;

37
lib/routes/onejav/one.js Normal file
View File

@@ -0,0 +1,37 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const type = ctx.params.type || 'new';
const key = type === 'day' ? ctx.params.key.slice(0, 4) + '/' + ctx.params.key.slice(4, 6) + '/' + ctx.params.key.slice(6, 8) : ctx.params.key || '';
const link = 'https://onejav.com' + `/${type === 'day' ? '' : type}${type === 'new' ? '' : '/' + key}`.replace('//', '/');
const response = await got({
method: 'get',
url: link,
});
const $ = cheerio.load(response.data);
const list = $('div.columns');
let itemPicUrl;
ctx.state.data = {
title: `OneJAV - ${type} ${key}`,
link: link,
item:
list &&
list
.map((index, item) => {
item = $(item);
itemPicUrl = item.find('img').attr('src');
return {
title: '【' + item.find('div.card-content.is-flex > h5 > a').text() + '】' + item.find('div.card-content.is-flex > h5 > span').text(),
description: `<img src="${itemPicUrl}"/><br/>Time: ${item.find('p.subtitle.is-6 > a').text()}<br/>Desc: ${item.find('p.level.has-text-grey-dark').text()}`,
link: item.find('div.card-content.is-flex > h5 > a').attr('href'),
enclosure_url: 'https://onejav.com' + item.find('p.control.is-expanded > a').attr('href'),
enclosure_type: 'application/x-bittorrent',
};
})
.get(),
};
};