mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-02 18:18:06 +08:00
feat(route): hackertalk 黑客说 最新帖子 (#9999)
* feat(route): hackertalk 黑客说 最新帖子 * fix: about Parameters Limit Entries * Update docs/bbs.md
This commit is contained in:
@@ -218,6 +218,12 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="mengx8" example="/etoland/star01" path="/etoland/:boardId" :paramsDesc="['板块 id,可在板块 URL 找到']" radar="1" rssbud="1"/>
|
<Route author="mengx8" example="/etoland/star01" path="/etoland/:boardId" :paramsDesc="['板块 id,可在板块 URL 找到']" radar="1" rssbud="1"/>
|
||||||
|
|
||||||
|
## HACKER TALK 黑客说
|
||||||
|
|
||||||
|
### 最新帖子
|
||||||
|
|
||||||
|
<Route author="hyoban" example="/hackertalk" path="/hackertalk" radar="1" rssbud="1"/>
|
||||||
|
|
||||||
## LearnKu
|
## LearnKu
|
||||||
|
|
||||||
### 社区
|
### 社区
|
||||||
|
|||||||
23
lib/v2/hackertalk/index.js
Normal file
23
lib/v2/hackertalk/index.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const md = require('markdown-it')();
|
||||||
|
const { parseDate } = require('@/utils/parse-date');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const limit = ctx.query.limit ?? 25;
|
||||||
|
|
||||||
|
const response = await got(`https://api.hackertalk.net/v1/posts?limit=${limit}&orderBy=time`);
|
||||||
|
|
||||||
|
const data = response.data.data;
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: '黑客说的最新帖子',
|
||||||
|
link: 'https://hackertalk.net/?tab=new',
|
||||||
|
description: '黑客说 - 技术驱动优质交流',
|
||||||
|
item: data.map((item) => ({
|
||||||
|
title: item.title,
|
||||||
|
description: md.render(item.content),
|
||||||
|
pubDate: parseDate(item.createdAt),
|
||||||
|
link: `https://hackertalk.net/posts/${item.id}`,
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
};
|
||||||
3
lib/v2/hackertalk/maintainer.js
Normal file
3
lib/v2/hackertalk/maintainer.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
'/': ['hyoban'],
|
||||||
|
};
|
||||||
13
lib/v2/hackertalk/radar.js
Normal file
13
lib/v2/hackertalk/radar.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
module.exports = {
|
||||||
|
'hackertalk.net': {
|
||||||
|
_name: 'Hacker Talk 黑客说',
|
||||||
|
'.': [
|
||||||
|
{
|
||||||
|
title: '最新的帖子',
|
||||||
|
docs: 'https://docs.rsshub.app/bbs.html#hacker-talk-hei-ke-shuo',
|
||||||
|
source: ['/?tab=new', '/'],
|
||||||
|
target: '/hackertalk',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
3
lib/v2/hackertalk/router.js
Normal file
3
lib/v2/hackertalk/router.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = function (router) {
|
||||||
|
router.get('/', require('./index'));
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user