Skip to content

Commit

Permalink
feat(route): idolypride企划新闻 (#12111)
Browse files Browse the repository at this point in the history
* 增加idolypride.jp/news的rss规则

* fix

* 'fix2'

* 'morefix'

* 'fix4'

* 'fix5'

* 'fix7'

* 'fix8'
  • Loading branch information
Mingxia1 authored Mar 17, 2023
1 parent bd0f740 commit 3a0757b
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/anime.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
6 changes: 6 additions & 0 deletions docs/en/anime.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
3 changes: 3 additions & 0 deletions lib/v2/idolypride/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/news': ['Mingxia1'],
};
32 changes: 32 additions & 0 deletions lib/v2/idolypride/news.js
Original file line number Diff line number Diff line change
@@ -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,
};
}),
};
};
13 changes: 13 additions & 0 deletions lib/v2/idolypride/radar.js
Original file line number Diff line number Diff line change
@@ -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'
}
]
}
};
3 changes: 3 additions & 0 deletions lib/v2/idolypride/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/news', require('./news'));
};

0 comments on commit 3a0757b

Please sign in to comment.