feat(route): add 78动漫 (#10331)
* feat(route): add 78动漫 * docs: fix typo
This commit is contained in:
parent
e8bc6a6301
commit
77cd9df1d4
|
|
@ -83,6 +83,50 @@ pageClass: routes
|
|||
|
||||
<Route author="jackyu1996" path="/1draw/" example="/1draw/" />
|
||||
|
||||
## 78 动漫
|
||||
|
||||
### 新品速递
|
||||
|
||||
<Route author="nczitzk" example="/78dm/news" path="/78dm/news/:path+" :paramsDesc="['参数,见说明,默认为空']">
|
||||
|
||||
::: tip 提示
|
||||
|
||||
若订阅 [新品速递](https://www.78dm.net/news),网址为 <https://www.78dm.net/news>。截取 `https://www.78dm.net` 到末尾的部分 `/news` 作为参数,此时路由为 [`/78dm/news`](https://rsshub.app/78dm/news)。
|
||||
|
||||
若订阅子分类 [新品速递 - 综合](https://www.78dm.net/news/0/9/0/0/0/0/0/1.html),网址为 <https://www.78dm.net/news/0/9/0/0/0/0/0/1.html>。截取 `https://www.78dm.net` 到末尾 `.html` 的部分 `/news/0/9/0/0/0/0/0/1` 作为参数,路由为 [`/78dm/news/0/9/0/0/0/0/0/1`](https://rsshub.app/78dm/news/0/9/0/0/0/0/0/1)。
|
||||
|
||||
:::
|
||||
|
||||
</Route>
|
||||
|
||||
### 精彩评测
|
||||
|
||||
<Route author="nczitzk" example="/78dm/eval_list" path="/78dm/eval_list/:path+" :paramsDesc="['参数,见说明,默认为空']">
|
||||
|
||||
::: tip 提示
|
||||
|
||||
若订阅 [精彩评测](https://www.78dm.net/eval_list),网址为 <https://www.78dm.net/eval_list>。截取 `https://www.78dm.net` 到末尾的部分 `/eval_list` 作为参数,此时路由为 [`/78dm/eval_list`](https://rsshub.app/78dm/eval_list)。
|
||||
|
||||
若订阅子分类 [精彩评测 - 综合](https://www.78dm.net/eval_list/120/0/0/1.html),网址为 <https://www.78dm.net/eval_list/120/0/0/1.html>。截取 `https://www.78dm.net` 到末尾 `.html` 的部分 `/eval_list/120/0/0/1` 作为参数,路由为 [`/78dm/eval_list/120/0/0/1`](https://rsshub.app/78dm/eval_list/120/0/0/1)。
|
||||
|
||||
:::
|
||||
|
||||
</Route>
|
||||
|
||||
### 好帖推荐
|
||||
|
||||
<Route author="nczitzk" example="/78dm/ht_list" path="/78dm/ht_list/:path+" :paramsDesc="['参数,见说明,默认为空']">
|
||||
|
||||
::: tip 提示
|
||||
|
||||
若订阅 [好帖推荐](https://www.78dm.net/ht_list),网址为 <https://www.78dm.net/ht_list>。截取 `https://www.78dm.net` 到末尾的部分 `/ht_list` 作为参数,此时路由为 [`/78dm/ht_list`](https://rsshub.app/78dm/ht_list)。
|
||||
|
||||
若订阅子分类 [好帖推荐 - 综合](https://www.78dm.net/ht_list/107/0/0/1.html),网址为 <https://www.78dm.net/ht_list/107/0/0/1.html>。截取 `https://www.78dm.net` 到末尾 `.html` 的部分 `/ht_list/107/0/0/1` 作为参数,路由为 [`/78dm/ht_list/107/0/0/1`](https://rsshub.app/78dm/ht_list/107/0/0/1)。
|
||||
|
||||
:::
|
||||
|
||||
</Route>
|
||||
|
||||
## AcFun
|
||||
|
||||
### 番剧
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://www.78dm.net';
|
||||
const currentUrl = `${rootUrl}${ctx.path === '/' ? '/news' : /\/[0-9]+$/.test(ctx.path) ? `${ctx.path}.html` : ctx.path}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
let items = $('.card-title')
|
||||
.slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 30)
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
||||
const link = item.attr('href');
|
||||
|
||||
return {
|
||||
title: item.text(),
|
||||
link: /^\/\//.test(link) ? `https:${link}` : link,
|
||||
};
|
||||
});
|
||||
|
||||
items = await Promise.all(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
content('.tag, .level').remove();
|
||||
content('.lazy').each(function () {
|
||||
content(this).replaceWith(
|
||||
art(path.join(__dirname, 'templates/image.art'), {
|
||||
image: content(this).attr('data-src'),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
item.author = content('.push-username').first().text().split('楼主')[0];
|
||||
item.pubDate = timezone(
|
||||
parseDate(
|
||||
content('.push-time')
|
||||
.first()
|
||||
.text()
|
||||
.match(/(\d{4}-\d{2}-\d{2} \d{2}:\d{2})/)[1]
|
||||
),
|
||||
+8
|
||||
);
|
||||
item.description = content('.image-text-content').first().html();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `78动漫 - ${$('title').text().split('_')[0]} - ${$('.actived').first().text()}`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
'/eval_list/:path+': ['nczitzk'],
|
||||
'/ht_list/:path+': ['nczitzk'],
|
||||
'/news/:path+': ['nczitzk'],
|
||||
};
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
module.exports = {
|
||||
'78dm.net': {
|
||||
_name: '78动漫',
|
||||
'.': [
|
||||
{
|
||||
title: '新品速递',
|
||||
docs: 'https://docs.rsshub.app/anime.html#_78-dong-man-xin-pin-su-di',
|
||||
source: ['/news', '/'],
|
||||
target: (params, url) =>
|
||||
`/78dm${new URL(url)
|
||||
.toString()
|
||||
.match(/78dm\.net(.*)$/)[1]
|
||||
.replace(/\.html$/, '')}`,
|
||||
},
|
||||
{
|
||||
title: '精彩评测',
|
||||
docs: 'https://docs.rsshub.app/anime.html#_78-dong-man-jing-cai-ping-ce',
|
||||
source: ['/eval_list', '/'],
|
||||
target: (params, url) =>
|
||||
`/78dm${new URL(url)
|
||||
.toString()
|
||||
.match(/78dm\.net(.*)$/)[1]
|
||||
.replace(/\.html$/, '')}`,
|
||||
},
|
||||
{
|
||||
title: '新品速递',
|
||||
docs: 'https://docs.rsshub.app/anime.html#_78-dong-man-hao-tie-tui-jian',
|
||||
source: ['/ht_list', '/'],
|
||||
target: (params, url) =>
|
||||
`/78dm${new URL(url)
|
||||
.toString()
|
||||
.match(/78dm\.net(.*)$/)[1]
|
||||
.replace(/\.html$/, '')}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w/-]+)?/, require('./index'));
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
<img src="{{ image }}">
|
||||
Loading…
Reference in New Issue