feat(route): add foreverblog (#8455)

Co-authored-by: DIYgod <diy.d.god@gmail.com>
This commit is contained in:
7Wate
2021-11-27 08:45:40 +00:00
committed by GitHub
co-authored by DIYgod
parent 13a0c62567
commit 3023bd6381
4 changed files with 51 additions and 0 deletions
+9
View File
@@ -1328,4 +1328,13 @@
},
'macwk.com': { _name: 'MacWk', '.': [{ title: '应用更新', docs: 'https://docs.rsshub.app/program-update.html#macwk', source: '/soft/:name', target: '/macwk/soft/:name' }] },
'zyshow.net': { www: [{ title: '', docs: 'https://docs.rsshub.app/game.html#lv-fa-shi-ying-di', source: '/:name/', target: '/zyshow/:name' }] },
'foreverblog.cn': {
_name: 'foreverblog',
www: [
{
title: '十年之约',
docs: 'https://docs.rsshub.app/social-media.html#foreverblog',
},
],
},
});
+6
View File
@@ -205,3 +205,9 @@ pageClass: routes
### 文章
<Route author="junbaor SkiTiSu" example="/blogs/wangyin" path="/blogs/wangyin"/>
## 十年之约
### 文章
<Route author="7Wate" example="/blogs/foreverblog" path="/blogs/foreverblog" />
+3
View File
@@ -4230,6 +4230,9 @@ router.get('/now/news/rank', lazyloadRouteHandler('./routes/now/rank'));
// s-hentai
router.get('/s-hentai/:id?', lazyloadRouteHandler('./routes/s-hentai'));
// foreverblog
router.get('/blogs/foreverblog', lazyloadRouteHandler('./routes/blogs/foreverblog'));
// Netflix
router.get('/netflix/newsroom/:category?/:region?', lazyloadRouteHandler('./routes/netflix/newsroom'));
+33
View File
@@ -0,0 +1,33 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'https://www.foreverblog.cn/feeds.html',
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('article[class="post post-type-normal"]');
ctx.state.data = {
title: '十年之约 - 订阅',
link: 'https://www.foreverblog.cn/feeds.html',
language: 'zh-cn',
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('a.post-title-link>span').text(),
description: item.find('div.post-author').text(),
link: item.find('a.post-title-link').attr('href'),
pubDate: item.find('time.post-time').text(),
};
})
.get(),
};
};