diff --git a/docs/other.md b/docs/other.md index dd0acf744..7a2be0fc3 100644 --- a/docs/other.md +++ b/docs/other.md @@ -335,16 +335,6 @@ type 为 all 时,category 参数不支持 cost 和 free -## 个人博客 - -### 敬维 - - - -### 王垠-当然我在扯淡 - - - ## 财新博客 ### 用户博客 @@ -452,6 +442,16 @@ type 为 all 时,category 参数不支持 cost 和 free +## 个人博客 + +### 敬维 + + + +### 王垠-当然我在扯淡 + + + ## 古诗文网 ### 首页推荐 diff --git a/docs/programming.md b/docs/programming.md index 5402fc16d..08e4b505a 100644 --- a/docs/programming.md +++ b/docs/programming.md @@ -409,6 +409,12 @@ GitHub 官方也提供了一些 RSS: | 最新主题 | latest | | 精华主题 | digest | +## 美团技术团队 + +### 最近更新 + + + ## 牛客网 ### 讨论区 diff --git a/lib/router.js b/lib/router.js index 39a38ab85..1f536072b 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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; diff --git a/lib/routes/meituan/tech/home.js b/lib/routes/meituan/tech/home.js new file mode 100644 index 000000000..d8790c813 --- /dev/null +++ b/lib/routes/meituan/tech/home.js @@ -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, + }; +};