feat(route): idolypride企划新闻 (#12111)

* 增加idolypride.jp/news的rss规则

* fix

* 'fix2'

* 'morefix'

* 'fix4'

* 'fix5'

* 'fix7'

* 'fix8'
This commit is contained in:
Mingxia 2023-03-17 23:18:20 +08:00 committed by GitHub
parent bd0f740340
commit 3a0757bb87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 0 deletions

View File

@ -831,3 +831,9 @@ Sources
### 當季新番
<Route author="devinmugen" example="/bangumi/online" path="/bangumi/online"/>
## 偶像荣耀
### 新闻推送
<Route author="Mingxia1" example="/idolypride/news" path="/idolypride/news" radar="1" rssbud="1"/>

View File

@ -275,3 +275,9 @@ You can use some RSS parsing libraries (like `feedpraser` in `Python`) to receiv
### Origins Search
<RouteEn author="xueli-sherryli" example="/oreno3d/origins/3/latest/1" path="/oreno3d/origins/:originid/:sort/:pagelimit?" :paramsDesc="['Origin id, can be found in URL' , 'Sort method, see the table above', 'The maximum number of pages to be crawled, the default is 1']" radar="1" rssbud="1"/>
## IDOLY PRIDE
### News
<RouteEn author="Mingxia1" example="/idolypride/news" path="/idolypride/news" radar="1" rssbud="1"/>

View File

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

32
lib/v2/idolypride/news.js Normal file
View File

@ -0,0 +1,32 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'https://idolypride.jp/wp-json/wp/v2/news',
});
const list = response.data;
ctx.state.data = {
title: '偶像荣耀-新闻',
link: 'https://idolypride.jp/news',
item:
list
.map((item) => {
const title = item.title.rendered;
const link = item.link;
const pubDate = timezone(parseDate(item.date_gmt), 0);
const rendered = item.content.rendered;
return {
title,
link,
pubDate,
description: rendered,
};
}),
};
};

View File

@ -0,0 +1,13 @@
module.exports = {
'idolypride.jp': {
_name: '偶像荣耀',
'.': [
{
title: '新闻',
docs: 'https://docs.rsshub.app/anime.html#ou-xiang-rong-yao',
source: '/news',
target: '/idolypride/news'
}
]
}
};

View File

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