feat(route): add dmzj news (#11538)

This commit is contained in:
vzz64
2023-01-02 21:01:34 +08:00
committed by GitHub
parent fb68956739
commit 0b4c6581c3
5 changed files with 111 additions and 0 deletions

View File

@@ -574,6 +574,18 @@ Sources
<Route author="machsix" path="/dongmanmanhua/:category/:name/:id" example="/dongmanmanhua/COMEDY/xin-xinlingdeshengyin/381" :paramsDesc="['类别','名称','ID']"/>
## 动漫之家
### 新闻站
<Route author="vzz64" path="/dmzj/news/:category?" example="/dmzj/news/donghuaqingbao" :paramsDesc="['类别']" radar="1">
| 漫画情报 | 轻小说情报 | 动漫周边 | 声优情报 | 音乐资讯 | 游戏资讯 | 美图欣赏 | 漫展情报 | 大杂烩 |
| ------------- | ------------------- | -------------- | --------------- | ----------- | ---------- | ------------- | -------------- | ------- |
| manhuaqingbao | qingxiaoshuoqingbao | manhuazhoubian | shengyouqingbao | yinyuezixun | youxizixun | meituxinshang | manzhanqingbao | dazahui |
</Route>
## 動畫瘋
### 最後更新

View File

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

26
lib/v2/dmzj/news.js Normal file
View File

@@ -0,0 +1,26 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
module.exports = async (ctx) => {
const url = `https://news.dmzj.com/${ctx.params.category || ''}`;
const $ = cheerio.load((await got(url)).data);
ctx.state.data = {
title: $('title').text(),
link: url,
item: $('.briefnews_con_li .li_img_de')
.map((_, item) => ({
title: $(item).find('h3 a').text(),
link: $(item).find('h3 a').attr('href'),
author: $(item).find('.head_con_p_o span:nth-child(3)').text().split('')[1],
pubDate: timezone(parseDate($(item).find('.head_con_p_o span').first().text(), 'YYYY-MM-DD HH:mm'), +8),
description: $(item).find('p.com_about').text(),
category: $(item)
.find('.u_comfoot a .bqwarp')
.map((_, item) => $(item).text())
.get(),
}))
.get(),
};
};

67
lib/v2/dmzj/radar.js Normal file
View File

@@ -0,0 +1,67 @@
module.exports = {
'dmzj.com': {
_name: '动漫之家',
news: [
{
title: '宅新闻',
docs: 'https://docs.rsshub.app/anime.html#dong-man-zhi-jia',
source: '/',
target: '/dmzj/news',
},
{
title: '漫画情报',
docs: 'https://docs.rsshub.app/anime.html#dong-man-zhi-jia',
source: '/manhuaqingbao',
target: '/dmzj/news/manhuaqingbao',
},
{
title: '轻小说情报',
docs: 'https://docs.rsshub.app/anime.html#dong-man-zhi-jia',
source: '/qingxiaoshuoqingbao',
target: '/dmzj/news/qingxiaoshuoqingbao',
},
{
title: '动漫周边',
docs: 'https://docs.rsshub.app/anime.html#dong-man-zhi-jia',
source: '/manhuazhoubian',
target: '/dmzj/news/manhuazhoubian',
},
{
title: '声优情报',
docs: 'https://docs.rsshub.app/anime.html#dong-man-zhi-jia',
source: '/shengyouqingbao',
target: '/dmzj/news/shengyouqingbao',
},
{
title: '音乐资讯',
docs: 'https://docs.rsshub.app/anime.html#dong-man-zhi-jia',
source: '/yinyuezixun',
target: '/dmzj/news/yinyuezixun',
},
{
title: '游戏资讯',
docs: 'https://docs.rsshub.app/anime.html#dong-man-zhi-jia',
source: '/youxizixun',
target: '/dmzj/news/youxizixun',
},
{
title: '美图欣赏',
docs: 'https://docs.rsshub.app/anime.html#dong-man-zhi-jia',
source: '/meituxinshang',
target: '/dmzj/news/meituxinshang',
},
{
title: '漫展情报',
docs: 'https://docs.rsshub.app/anime.html#dong-man-zhi-jia',
source: '/manzhanqingbao',
target: '/dmzj/news/manzhanqingbao',
},
{
title: '大杂烩',
docs: 'https://docs.rsshub.app/anime.html#dong-man-zhi-jia',
source: '/dazahui',
target: '/dmzj/news/dazahui',
},
],
},
};

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

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