From dc903ab7da1595d8ac2e7d569781f2dca355b7a6 Mon Sep 17 00:00:00 2001 From: Chenyang Shi Date: Wed, 6 Mar 2019 12:13:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=99=8E=E6=89=91bbs=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=B2=BE=E5=8D=8E=E5=88=86=E7=B1=BB=20(#1689)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 2 +- lib/routes/hupu/bbs.js | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/README.md b/docs/README.md index df8377e186..1454d5e94e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -642,7 +642,7 @@ RSSHub 提供下列 API 接口: ### 虎扑 - + ### Dcard diff --git a/lib/routes/hupu/bbs.js b/lib/routes/hupu/bbs.js index 814a0a22a6..f2c0c92654 100644 --- a/lib/routes/hupu/bbs.js +++ b/lib/routes/hupu/bbs.js @@ -13,9 +13,12 @@ module.exports = async (ctx) => { let order_name; if (parseInt(order) === 1) { order_name = '最新回帖'; - } else { + } else if (parseInt(order) === 2) { order_name = '最新发帖'; link += '-postdate-1'; + } else if (parseInt(order) === 3) { + order_name = '精华'; + link += '-digest'; } const response = await axios.get(link); @@ -29,12 +32,15 @@ module.exports = async (ctx) => { .map(function() { const info = { title: $(this) - .find('div.titlelink.box > a') + .find('div.titlelink.box > a.truetit') .text() .trim(), link: $(this) - .find('div.titlelink.box > a') + .find('div.titlelink.box > a.truetit') .attr('href'), + author: $(this) + .find('a.aulink') + .text(), }; return info; }) @@ -50,6 +56,7 @@ module.exports = async (ctx) => { list.map(async (info) => { const title = info.title; const itemUrl = url.resolve(host, info.link); + const author = info.author; const cache = await ctx.cache.get(itemUrl); if (cache) { @@ -65,6 +72,7 @@ module.exports = async (ctx) => { const single = { title: title, link: itemUrl, + author: author, description: description, pubDate: new Date(date).toUTCString(), };