feat(route): hackertalk 黑客说 最新帖子 (#9999)

* feat(route): hackertalk 黑客说 最新帖子

* fix: about Parameters Limit Entries

* Update docs/bbs.md
This commit is contained in:
Hyoban
2022-06-22 01:03:12 +08:00
committed by GitHub
parent 8cf4fe41f2
commit 1ed857ef16
5 changed files with 48 additions and 0 deletions

View File

@@ -218,6 +218,12 @@ pageClass: routes
<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
### 社区

View 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}`,
})),
};
};

View File

@@ -0,0 +1,3 @@
module.exports = {
'/': ['hyoban'],
};

View 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',
},
],
},
};

View File

@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/', require('./index'));
};