diff --git a/docs/README.md b/docs/README.md index 7348ae84a9..6917f38421 100644 --- a/docs/README.md +++ b/docs/README.md @@ -402,6 +402,8 @@ RSSHub 提供下列 API 接口: + + ### pixiv diff --git a/router.js b/router.js index fc668799a2..67401c73a6 100644 --- a/router.js +++ b/router.js @@ -162,6 +162,7 @@ router.get('/zhihu/people/answers/:id', require('./routes/zhihu/answers')); router.get('/zhihu/zhuanlan/:id', require('./routes/zhihu/zhuanlan')); router.get('/zhihu/daily', require('./routes/zhihu/daily')); router.get('/zhihu/hotlist', require('./routes/zhihu/hotlist')); +router.get('/zhihu/pin/hotlist', require('./routes/zhihu/pin/hotlist')); // 妹子图 router.get('/mzitu', require('./routes/mzitu/category')); diff --git a/routes/zhihu/pin/hotlist.js b/routes/zhihu/pin/hotlist.js new file mode 100644 index 0000000000..236af869d2 --- /dev/null +++ b/routes/zhihu/pin/hotlist.js @@ -0,0 +1,59 @@ +const axios = require('../../../utils/axios'); + +module.exports = async (ctx) => { + const { + data: { data }, + } = await axios({ + method: 'get', + url: 'https://api.zhihu.com/pins/hot_list?reverse_order=0', + }); + + ctx.state.data = { + title: '知乎想法热榜', + description: '整点更新', + item: data.map(({ target }) => { + const pubDate = new Date(target.created * 1000).toUTCString(); + const author = target.author.name; + const title = `${author}:${target.excerpt_title}`; + const link = `https://www.zhihu.com/pin/${target.id}`; + const description = target.content.reduce((description, item) => { + switch (item.type) { + case 'text': + description += `
${item.content}
`; + break; + + case 'image': + description += ``; + break; + + case 'video': + description += `