mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 14:40:23 +08:00
@@ -486,6 +486,10 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
|
||||
<Route name="美国签证 check 动态" author="lalxyy" example="/checkee/2019-03" path="/checkee/:month" :paramsDesc="['签证被 check 的年份-月份,如 2019-03']" />
|
||||
|
||||
### 古诗文网
|
||||
|
||||
<Route name="首页推荐" author="LogicJake" example="/gushiwen/recommend" path="/gushiwen/recommend"/>
|
||||
|
||||
### 电商在线
|
||||
|
||||
<Route name="电商在线" author="LogicJake" example="/imaijia/category/xls" path="/imaijia/category/:category" :paramsDesc="['类别id,可在 URL 中找到']" />
|
||||
|
||||
@@ -1255,6 +1255,9 @@ router.get('/mobdata/report', require('./routes/mobdata/report'));
|
||||
// 谷雨
|
||||
router.get('/tencent/guyu/channel/:name', require('./routes/tencent/guyu/channel'));
|
||||
|
||||
// 古诗文网
|
||||
router.get('/gushiwen/recommend', require('./routes/gushiwen/recommend'));
|
||||
|
||||
// 电商在线
|
||||
router.get('/imaijia/category/:category', require('./routes/imaijia/category'));
|
||||
|
||||
|
||||
41
lib/routes/gushiwen/recommend.js
Normal file
41
lib/routes/gushiwen/recommend.js
Normal file
@@ -0,0 +1,41 @@
|
||||
const cheerio = require('cheerio');
|
||||
const axios = require('../../utils/axios');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://www.gushiwen.org/';
|
||||
const res = await axios.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
|
||||
const list = $('div.sons');
|
||||
const out = list
|
||||
.slice(0, 10)
|
||||
.map(function() {
|
||||
const title = $(this)
|
||||
.find('b')
|
||||
.text();
|
||||
const link = $(this)
|
||||
.find('p a')
|
||||
.attr('href');
|
||||
const description = $(this)
|
||||
.find('div.contson')
|
||||
.html();
|
||||
const author = $(this)
|
||||
.find('p.source')
|
||||
.text();
|
||||
const item = {
|
||||
title,
|
||||
link,
|
||||
description,
|
||||
author,
|
||||
};
|
||||
|
||||
return item;
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: '古诗文推荐',
|
||||
link: url,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user