feat: add meituan tech fulltext (#2642)
This commit is contained in:
+10
-10
@@ -335,16 +335,6 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
|
||||
<Route author="fengkx" example="/maitta" path="/maitta" supportPodcast="1" />
|
||||
|
||||
## 个人博客
|
||||
|
||||
### 敬维
|
||||
|
||||
<Route author="a180285" example="/blogs/jingwei.link" path="/blogs/jingwei.link"/>
|
||||
|
||||
### 王垠-当然我在扯淡
|
||||
|
||||
<Route author="junbaor" example="/blogs/wangyin" path="/blogs/wangyin"/>
|
||||
|
||||
## 财新博客
|
||||
|
||||
### 用户博客
|
||||
@@ -452,6 +442,16 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
|
||||
<Route author="junfengP" example="/metred/fuli" path="/metred/fuli" />
|
||||
|
||||
## 个人博客
|
||||
|
||||
### 敬维
|
||||
|
||||
<Route author="a180285" example="/blogs/jingwei.link" path="/blogs/jingwei.link"/>
|
||||
|
||||
### 王垠-当然我在扯淡
|
||||
|
||||
<Route author="junbaor" example="/blogs/wangyin" path="/blogs/wangyin"/>
|
||||
|
||||
## 古诗文网
|
||||
|
||||
### 首页推荐
|
||||
|
||||
@@ -409,6 +409,12 @@ GitHub 官方也提供了一些 RSS:
|
||||
| 最新主题 | latest |
|
||||
| 精华主题 | digest |
|
||||
|
||||
## 美团技术团队
|
||||
|
||||
### 最近更新
|
||||
|
||||
<Route author="kt286" example="/meituan/tech/home" path="/meituan/tech/home"/>
|
||||
|
||||
## 牛客网
|
||||
|
||||
### 讨论区
|
||||
|
||||
@@ -1512,4 +1512,7 @@ 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('/meituan/tech/home', require('./routes//meituan/tech/home'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -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('https://tech.meituan.com/feed/');
|
||||
|
||||
const ProcessFeed = async (link) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
addNoReferrer($, '.content');
|
||||
return $('.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