mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 14:40:23 +08:00
@@ -525,3 +525,21 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
|
||||
<Route name="gradCafe result" author="liecn" example="/gradcafe/result" path="/gradcafe/result" />
|
||||
<Route name="gradCafe result by key words" author="liecn" example="/gradcafe/result/computer" path="/gradcafe/result/:type" :paramsDesc="['按关键词进行搜索,如 computer']/>
|
||||
|
||||
## 且听风吟福利(www.qtfyfl.com)
|
||||
|
||||
<Route name="分类" author="qiwihui" example="/qtfyfl/guoji" path="/qtfyfl/:category" :paramsDesc="['分类,可在 URL 中找到']">
|
||||
|
||||
| 最新文章 | 福利社 | 求出处 | 套图集 | 门事件 | 内涵图 | 电影下载 | 影视资讯 |
|
||||
| -------- | ------- | --------- | ------- | ---------- | -------- | -------------- | -------- |
|
||||
| latest | fulishe | qiuchuchu | taotuji | menshijian | neihantu | dianyingxiazai | yingshi |
|
||||
|
||||
| 电视剧下载 | 动漫下载 | 电影彩蛋 | 影视剧情 | 涨姿势 | 娱乐 | 明星八卦 | 音乐歌曲 |
|
||||
| ---------- | -------- | -------- | -------- | ---------- | ---- | -------- | -------- |
|
||||
| dianshiju | dongman | caidan | juqing | zhangzishi | yule | mingxing | music |
|
||||
|
||||
| 游戏 | 电脑软件 | 实时热点 | 心灵鸡汤 | 符号大全 | 国际新闻 | 科技苑 | 其他 |
|
||||
| ----- | -------- | ------------ | -------- | -------- | -------- | ------ | ----- |
|
||||
| games | software | shishiredian | xljt | fhdq | xljt | tech | other |
|
||||
|
||||
</Route>
|
||||
|
||||
@@ -1329,4 +1329,7 @@ router.get('/asahichinese-f/:category', require('./routes/asahichinese-f/index')
|
||||
// 7x24小时快讯
|
||||
router.get('/fx678/kx', require('./routes/fx678/kx'));
|
||||
|
||||
// 且听风吟福利
|
||||
router.get('/qtfyfl/:category', require('./routes/qtfyfl/category'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
101
lib/routes/qtfyfl/category.js
Normal file
101
lib/routes/qtfyfl/category.js
Normal file
@@ -0,0 +1,101 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const categoryCodes = {
|
||||
latest: '最新文章',
|
||||
fulishe: '福利社',
|
||||
qiuchuchu: '求出处',
|
||||
taotuji: '套图集',
|
||||
menshijian: '门事件',
|
||||
neihantu: '内涵图',
|
||||
// "zngirls":"宅男女神",
|
||||
dianyingxiazai: '电影下载',
|
||||
yingshi: '影视资讯',
|
||||
dianshiju: '电视剧下载',
|
||||
dongman: '动漫下载',
|
||||
caidan: '电影彩蛋',
|
||||
juqing: '影视剧情',
|
||||
zhangzishi: '涨姿势',
|
||||
yule: '娱乐',
|
||||
mingxing: '明星八卦',
|
||||
music: '音乐歌曲',
|
||||
games: '游戏',
|
||||
software: '电脑软件',
|
||||
shishiredian: '实时热点',
|
||||
xljt: '心灵鸡汤',
|
||||
fhdq: '符号大全',
|
||||
guoji: '国际新闻',
|
||||
tech: '科技苑',
|
||||
other: '其他',
|
||||
// "youqiubiying": "有求必应",
|
||||
};
|
||||
|
||||
const host = 'http://www.qtfyfl.com';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category;
|
||||
const iTitle = categoryCodes[category];
|
||||
let link;
|
||||
if (category === 'latest') {
|
||||
link = host;
|
||||
} else {
|
||||
link = host + `/${category}`;
|
||||
}
|
||||
const response = await axios.get(link);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $('article')
|
||||
.slice(0, 21)
|
||||
.map(function() {
|
||||
const info = {
|
||||
title: $(this)
|
||||
.find('header')
|
||||
.find('h2')
|
||||
.find('a')
|
||||
.attr('title'),
|
||||
link: $(this)
|
||||
.find('header')
|
||||
.find('h2')
|
||||
.find('a')
|
||||
.attr('href'),
|
||||
};
|
||||
return info;
|
||||
})
|
||||
.get();
|
||||
|
||||
const out = await Promise.all(
|
||||
list.map(async (info) => {
|
||||
const title = info.title;
|
||||
const itemUrl = info.link;
|
||||
|
||||
const cache = await ctx.cache.get(itemUrl);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await axios.get(itemUrl);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const description = $('div.txt')
|
||||
.html()
|
||||
.trim();
|
||||
const date = $('time').text();
|
||||
|
||||
const single = {
|
||||
title: title,
|
||||
link: itemUrl,
|
||||
description: description,
|
||||
pubDate: new Date(date).toUTCString(),
|
||||
};
|
||||
ctx.cache.set(itemUrl, JSON.stringify(single), 24 * 60 * 60);
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${iTitle}-且听风吟福利`,
|
||||
link: link,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user