feat(route): netflav (#13426)
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
const { join } = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const baseUrl = 'https://netflav.com';
|
||||
const { data } = await got(baseUrl);
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const nextData = JSON.parse($('#__NEXT_DATA__').text());
|
||||
const {
|
||||
head,
|
||||
props: { initialState },
|
||||
} = nextData;
|
||||
|
||||
const items = [...initialState.censored.docs, ...initialState.uncensored.docs, ...initialState.chinese.docs, ...initialState.trending.docs].map((item) => ({
|
||||
title: item.title,
|
||||
description: art(join(__dirname, 'templates/description.art'), {
|
||||
description: item.description,
|
||||
images: [...new Set([item.preview_hp, item.preview, item.previewImagesUrl, ...(item.previewImages || [])])].filter(Boolean),
|
||||
}),
|
||||
link: `https://netflav.com/video?id=${item.videoId}`,
|
||||
pubDate: parseDate(item.sourceDate),
|
||||
author: [...new Set(item.actors.map((a) => a.replace(/^(\w{2}:)/, '')))].join(', '),
|
||||
category: [...new Set(item.tags?.map((t) => t.replace(/^(\w{2}:)/, '')))],
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: head.find((h) => h[0] === 'title')[1].children,
|
||||
description: head.find((h) => h[0] === 'meta' && h[1].name === 'description')[1].content,
|
||||
logo: `${baseUrl}${head.find((h) => h[0] === 'meta' && h[1].property === 'og:image')[1].content}`,
|
||||
image: `${baseUrl}${head.find((h) => h[0] === 'meta' && h[1].property === 'og:image')[1].content}`,
|
||||
link: baseUrl,
|
||||
item: items,
|
||||
allowEmpty: true,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
'': ['TonyRL'],
|
||||
'/': ['TonyRL'],
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'netflav.com': {
|
||||
_name: 'Netflav',
|
||||
'.': [
|
||||
{
|
||||
title: 'Index',
|
||||
docs: 'https://docs.rsshub.app/multimedia#netflav',
|
||||
source: ['/'],
|
||||
target: '/netflav',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/', require('./'));
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
{{ if images }}
|
||||
{{ each images img }}
|
||||
<img src="{{ img }}">
|
||||
{{ /each }}
|
||||
{{ /if }}
|
||||
{{ if description }}
|
||||
<p>{{ description }}</p>
|
||||
{{ /if }}
|
||||
@@ -1023,6 +1023,12 @@ See [Directory](https://www.javlibrary.com/en/star_list.php) to view all stars.
|
||||
|
||||
<Route author="hoilc" example="/mqube/tag/UTAU" path="/mqube/tag/:tag" paramsDesc={['标签名称, 可参考`https://mqube.net/search/tag`']} radar="1" rssbud="1"/>
|
||||
|
||||
## Netflav {#netflav}
|
||||
|
||||
### Index {#netflav-index}
|
||||
|
||||
<Route author="TonyRL" example="/netflav" path="/netflav" radar="1"/>
|
||||
|
||||
## NEW 字幕组 {#new-zi-mu-zu}
|
||||
|
||||
### 分类 {#new-zi-mu-zu-fen-lei}
|
||||
|
||||
Reference in New Issue
Block a user