mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 12:21:31 +08:00
feat(route): add csdnblogs route (#11532)
* feat(route): add csdnblogs route * fix: maintainer
This commit is contained in:
26
docs/blog.md
26
docs/blog.md
@@ -30,6 +30,32 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="nczitzk" example="/google/sites/recentChanges/outlierseconomics" path="/google/sites/recentChanges/:id" :paramsDesc="['Site ID, 可在 URL 中找到']"/>
|
<Route author="nczitzk" example="/google/sites/recentChanges/outlierseconomics" path="/google/sites/recentChanges/:id" :paramsDesc="['Site ID, 可在 URL 中找到']"/>
|
||||||
|
|
||||||
|
## 博客园
|
||||||
|
|
||||||
|
### 10天推荐排行榜
|
||||||
|
|
||||||
|
<Route author="hujingnb" example="/cnblogs/aggsite/topdiggs" path="/cnblogs/aggsite/topdiggs" radar="1" rssbud="1"/>
|
||||||
|
|
||||||
|
### 48小时阅读排行
|
||||||
|
|
||||||
|
<Route author="hujingnb" example="/cnblogs/aggsite/topviews" path="/cnblogs/aggsite/topviews" radar="1" rssbud="1"/>
|
||||||
|
|
||||||
|
### 编辑推荐
|
||||||
|
|
||||||
|
<Route author="hujingnb" example="/cnblogs/aggsite/headline" path="/cnblogs/aggsite/headline" radar="1" rssbud="1"/>
|
||||||
|
|
||||||
|
### 分类
|
||||||
|
|
||||||
|
<Route author="hujingnb" example="/cnblogs/cate/go" path="/cnblogs/cate/:type" :paramsDesc="['类型']" radar="1" rssbud="1">
|
||||||
|
|
||||||
|
在博客园主页的分类出可查看所有类型. 例如, go的分类地址为: `https://www.cnblogs.com/cate/go/`, 则: [`/cnblogs/cate/go`](https://rsshub.app/cnblogs/cate/go)
|
||||||
|
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
### 精华区
|
||||||
|
|
||||||
|
<Route author="hujingnb" example="/cnblogs/pick" path="/cnblogs/pick" radar="1" rssbud="1"/>
|
||||||
|
|
||||||
## Gwern Branwen
|
## Gwern Branwen
|
||||||
|
|
||||||
### 博客
|
### 博客
|
||||||
|
|||||||
38
lib/v2/cnblogs/common.js
Normal file
38
lib/v2/cnblogs/common.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
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 link = `https://www.cnblogs.com${ctx.path}`;
|
||||||
|
const response = await got(link);
|
||||||
|
const data = response.data;
|
||||||
|
|
||||||
|
const $ = cheerio.load(data);
|
||||||
|
const list = $('#post_list article')
|
||||||
|
.toArray()
|
||||||
|
.map((item) => {
|
||||||
|
item = $(item);
|
||||||
|
return {
|
||||||
|
title: item.find('.post-item-title').text(),
|
||||||
|
link: item.find('.post-item-title').attr('href'),
|
||||||
|
pubDate: timezone(
|
||||||
|
parseDate(
|
||||||
|
item.find('.post-item-foot .post-meta-item span').text() ||
|
||||||
|
item.find('.editorpick-item-meta').text(),
|
||||||
|
['YYYY-MM-DD HH:mm', 'YYYY-MM-DD']
|
||||||
|
),
|
||||||
|
+8
|
||||||
|
),
|
||||||
|
description: item.find('.post-item-summary').text(),
|
||||||
|
author: item.find('.post-item-author span').text(),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: $('title').text(),
|
||||||
|
link,
|
||||||
|
item: list,
|
||||||
|
};
|
||||||
|
};
|
||||||
7
lib/v2/cnblogs/maintainer.js
Normal file
7
lib/v2/cnblogs/maintainer.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
module.exports = {
|
||||||
|
'/aggsite/topdiggs': ['hujingnb'],
|
||||||
|
'/aggsite/topviews': ['hujingnb'],
|
||||||
|
'/aggsite/headline': ['hujingnb'],
|
||||||
|
'/cate/:type': ['hujingnb'],
|
||||||
|
'/pick': ['hujingnb'],
|
||||||
|
};
|
||||||
37
lib/v2/cnblogs/radar.js
Normal file
37
lib/v2/cnblogs/radar.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
module.exports = {
|
||||||
|
'cnblogs.com': {
|
||||||
|
_name: '博客园',
|
||||||
|
www: [
|
||||||
|
{
|
||||||
|
title: '10天推荐排行榜',
|
||||||
|
docs: 'https://docs.rsshub.app/blog.html#博客园',
|
||||||
|
source: ['/aggsite/topdiggs'],
|
||||||
|
target: '/cnblogs/aggsite/topdiggs',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '48小时阅读排行',
|
||||||
|
docs: 'https://docs.rsshub.app/blog.html#博客园',
|
||||||
|
source: ['/aggsite/topviews'],
|
||||||
|
target: '/cnblogs/aggsite/topviews',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '编辑推荐',
|
||||||
|
docs: 'https://docs.rsshub.app/blog.html#博客园',
|
||||||
|
source: ['/aggsite/headline'],
|
||||||
|
target: '/cnblogs/aggsite/headline',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '分类',
|
||||||
|
docs: 'https://docs.rsshub.app/blog.html#博客园',
|
||||||
|
source: ['/cate/:type'],
|
||||||
|
target: '/cnblogs/cate/:type',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '精华区',
|
||||||
|
docs: 'https://docs.rsshub.app/blog.html#博客园',
|
||||||
|
source: ['/pick'],
|
||||||
|
target: '/cnblogs/pick',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
7
lib/v2/cnblogs/router.js
Normal file
7
lib/v2/cnblogs/router.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
module.exports = (router) => {
|
||||||
|
router.get('/aggsite/topdiggs', require('./common'));
|
||||||
|
router.get('/aggsite/topviews', require('./common'));
|
||||||
|
router.get('/aggsite/headline', require('./common'));
|
||||||
|
router.get('/cate/:type', require('./common'));
|
||||||
|
router.get('/pick', require('./common'));
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user