mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(route): add nogizaka46 blog (#9161)
* feat: add nogizaka46 blog * perf: use parseDate() * perf: specify guid
This commit is contained in:
@@ -1232,6 +1232,10 @@ Supported sub-sites:
|
||||
|
||||
<Route author="crispgm Fatpandac" example="/nogizaka46/news" path="/nogizaka46/news" />
|
||||
|
||||
### 乃木坂 46 博客
|
||||
|
||||
<Route author="Kasper4649" example="/nogizaka46/blog" path="/nogizaka46/blog" />
|
||||
|
||||
### 欅坂 46 新闻
|
||||
|
||||
<Route author="crispgm" example="/keyakizaka46/news" path="/keyakizaka46/news" />
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const rootUrl = 'https://www.nogizaka46.com';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `${rootUrl}/s/n46/api/list/blog`,
|
||||
});
|
||||
|
||||
const list = JSON.parse(response.data.slice(4).slice(0, -2)).data;
|
||||
|
||||
ctx.state.data = {
|
||||
allowEmpty: true,
|
||||
title: '乃木坂46 公式ブログ',
|
||||
link: 'https://www.nogizaka46.com/s/n46/diary/MEMBER',
|
||||
item:
|
||||
list &&
|
||||
list.map((item) => ({
|
||||
title: item.title,
|
||||
link: item.link,
|
||||
pubDate: parseDate(item.date),
|
||||
author: item.name,
|
||||
description: item.text,
|
||||
guid: rootUrl + new URL(item.link).pathname,
|
||||
})),
|
||||
};
|
||||
};
|
||||
@@ -1,3 +1,4 @@
|
||||
module.exports = {
|
||||
'/news': ['crispgm', 'Fatpandac'],
|
||||
'/blog': ['Kasper4649'],
|
||||
};
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
module.exports = {
|
||||
'nogizaka46.com': {
|
||||
_name: '乃木坂46',
|
||||
'.': [
|
||||
news: [
|
||||
{
|
||||
title: '新闻',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#ban-dao-xi-lie-guan-wang-zi-xun-nai-mu-ban-46-xin-wen',
|
||||
source: ['/', '/s/n46/news/list'],
|
||||
source: ['/s/n46/news/list'],
|
||||
target: '/nogizaka46/news',
|
||||
},
|
||||
],
|
||||
blog: [
|
||||
{
|
||||
title: '博客',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#ban-dao-xi-lie-guan-wang-zi-xun-nai-mu-ban-46-bo-ke',
|
||||
source: ['/s/n46/diary/MEMBER'],
|
||||
target: '/nogizaka46/blog',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/news', require('./news'));
|
||||
router.get('/blog', require('./blog'));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user