mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +08:00
feat: add daxiaamu fulltext (#2643)
This commit is contained in:
@@ -367,6 +367,12 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
|
||||
<Route author="LogicJake" example="/cyzone/label/创业邦周报" path="/cyzone/label/:name" :paramsDesc="['标签名称']"/>
|
||||
|
||||
## 大侠阿木
|
||||
|
||||
### 首页
|
||||
|
||||
<Route author="kt286" example="/daxiaamu/home" path="/daxiaamu/home"/>
|
||||
|
||||
## 大众点评
|
||||
|
||||
### 用户
|
||||
|
||||
@@ -1512,6 +1512,9 @@ router.get('/ccdi/scdc', require('./routes/ccdi/scdc'));
|
||||
router.get('/nosetime/:id/:type/:sort?', require('./routes/nosetime/comment'));
|
||||
router.get('/nosetime/home', require('./routes/nosetime/home'));
|
||||
|
||||
// 大侠阿木
|
||||
router.get('/daxiaamu/home', require('./routes/daxiaamu/home'));
|
||||
|
||||
// 美团技术团队
|
||||
router.get('/meituan/tech/home', require('./routes//meituan/tech/home'));
|
||||
|
||||
|
||||
47
lib/routes/daxiaamu/home.js
Normal file
47
lib/routes/daxiaamu/home.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const parser = require('@/utils/rss-parser');
|
||||
const { addNoReferrer } = require('@/utils/common-utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const feed = await parser.parseURL('http://www.daxiaamu.com/rss');
|
||||
|
||||
const ProcessFeed = async (link) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
addNoReferrer($, '.main-content');
|
||||
return $('.main-content').html();
|
||||
};
|
||||
|
||||
const items = await Promise.all(
|
||||
feed.items.map(async (item) => {
|
||||
const cache = await ctx.cache.get(item.link);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const description = await ProcessFeed(item.link);
|
||||
|
||||
const single = {
|
||||
title: item.title,
|
||||
description,
|
||||
pubDate: item.pubDate,
|
||||
link: item.link,
|
||||
author: item.author,
|
||||
};
|
||||
ctx.cache.set(item.link, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: feed.title,
|
||||
link: feed.link,
|
||||
description: feed.description,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user