mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
虎扑bbs增加精华分类 (#1689)
This commit is contained in:
+1
-1
@@ -642,7 +642,7 @@ RSSHub 提供下列 API 接口:
|
||||
|
||||
### 虎扑
|
||||
|
||||
<route name="虎扑BBS论坛" author="LogicJake" example="/hupu/bbs/bxj/2" path="/hupu/bbs/:id/:order?" :paramsDesc="['板块id,可在板块 URL 找到', '排序方式,1最新回帖(默认),2最新发帖']"/>
|
||||
<route name="虎扑BBS论坛" author="LogicJake" example="/hupu/bbs/bxj/2" path="/hupu/bbs/:id/:order?" :paramsDesc="['板块id,可在板块 URL 找到', '排序方式,1最新回帖(默认),2最新发帖,3精华帖']"/>
|
||||
|
||||
### Dcard
|
||||
|
||||
|
||||
+11
-3
@@ -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(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user