Files
RSSHub/lib/v2/issuehunt/funded.js
奔跑的小草 22b19f2a4f feat(route): 增加Issue Hunt订阅 (#11818)
* feat(route): 增加Issue Hunt订阅

* feat(route): 增加英文文档和Markdown解析

* Update lib/v2/issuehunt/maintainer.js

* Update docs/en/programming.md

* Update lib/v2/issuehunt/radar.js

* Update docs/programming.md

* Update lib/v2/issuehunt/radar.js

* Update docs/programming.md

---------
2023-02-09 22:14:49 -06:00

29 lines
940 B
JavaScript

const got = require('@/utils/got');
const MarkdownIt = require('markdown-it');
module.exports = async (ctx) => {
const { username, repo } = ctx.params;
const response = await got(`https://issuehunt.io/apis/pages/repos/show?repositoryOwnerName=${username}&repositoryName=${repo}`);
const { issues } = response.data;
if (issues === undefined) {
throw new Error('没有获取到数据');
}
const md = MarkdownIt({
html: true,
});
ctx.state.data = {
title: `Issue Hunt 的悬赏 -- ${username}/${repo}`,
link: `https://issuehunt.io/r/${username}/${repo}`,
description: ``,
item: issues.map((item) => ({
title: item.title,
description: md.render(item.body),
pubDate: item.fundedAt,
link: `https://issuehunt.io/r/${username}/${repo}/issues/${item.number}`,
author: item.userName,
})),
};
};