From b5210ac9d9b441eb88674f9fe7ee37548b8dab1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=89=E5=87=89?= Date: Tue, 6 Nov 2018 20:10:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=9A=E7=9F=A5=E4=B9=8E-?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=83=B3=E6=B3=95=20(#1071)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - #17 --- docs/README.md | 2 ++ router.js | 1 + routes/zhihu/pin/hotlist.js | 46 ++--------------------------------- routes/zhihu/pin/people.js | 19 +++++++++++++++ routes/zhihu/pin/utils.js | 48 +++++++++++++++++++++++++++++++++++++ 5 files changed, 72 insertions(+), 44 deletions(-) create mode 100644 routes/zhihu/pin/people.js create mode 100644 routes/zhihu/pin/utils.js diff --git a/docs/README.md b/docs/README.md index c9ce55613..b3807c0d7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -420,6 +420,8 @@ RSSHub 提供下列 API 接口: + + ### pixiv diff --git a/router.js b/router.js index 08a1f3324..1e05548e5 100644 --- a/router.js +++ b/router.js @@ -168,6 +168,7 @@ router.get('/zhihu/hotlist', require('./routes/zhihu/hotlist')); router.get('/zhihu/pin/hotlist', require('./routes/zhihu/pin/hotlist')); router.get('/zhihu/question/:questionId', require('./routes/zhihu/question')); router.get('/zhihu/topic/:topicId', require('./routes/zhihu/topic')); +router.get('/zhihu/people/pins/:id', require('./routes/zhihu/pin/people')); // 妹子图 router.get('/mzitu/home/:type?', require('./routes/mzitu/home')); diff --git a/routes/zhihu/pin/hotlist.js b/routes/zhihu/pin/hotlist.js index 9ab319979..dba8c5d1d 100644 --- a/routes/zhihu/pin/hotlist.js +++ b/routes/zhihu/pin/hotlist.js @@ -1,4 +1,5 @@ const axios = require('../../../utils/axios'); +const { generateData } = require('./utils'); module.exports = async (ctx) => { const { @@ -12,49 +13,6 @@ module.exports = async (ctx) => { title: '知乎想法热榜', link: 'https://www.zhihu.com/', 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 += `