diff --git a/docs/game.md b/docs/game.md index fc6836a6fa..c4b96ba5d8 100644 --- a/docs/game.md +++ b/docs/game.md @@ -38,6 +38,12 @@ pageClass: routes +## MaxNews + +### Dota 2 + + + ## Nintendo ### eShop 新发售游戏 @@ -198,9 +204,3 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的 ### 公告 - -## MaxNews - -### Dota 2 - - diff --git a/docs/other.md b/docs/other.md index cc57bfe5fd..333d718343 100644 --- a/docs/other.md +++ b/docs/other.md @@ -416,12 +416,6 @@ type 为 all 时,category 参数不支持 cost 和 free -## 数英网 - -### 数英网最新文章 - - - ## 果壳网 ### 科学人 @@ -686,6 +680,12 @@ type 为 all 时,category 参数不支持 cost 和 free +## 数英网 + +### 数英网最新文章 + + + ## 刷屏 ### 最新 @@ -846,3 +846,9 @@ type 为 all 时,category 参数不支持 cost 和 free ### 房源 + +## 紫竹张先生 + +### 全文 + + diff --git a/lib/router.js b/lib/router.js index 1d93e00ee7..5016255703 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1322,4 +1322,7 @@ router.get('/digitaling/index', require('./routes/digitaling/index')); // Steamgifts router.get('/steamgifts/discussions/:category?', require('./routes/steamgifts/discussions')); +// Steamgifts +router.get('/zzz', require('./routes/zzz/index')); + module.exports = router; diff --git a/lib/routes/zzz/index.js b/lib/routes/zzz/index.js new file mode 100644 index 0000000000..156872a324 --- /dev/null +++ b/lib/routes/zzz/index.js @@ -0,0 +1,46 @@ +const axios = require('@/utils/axios'); +const cheerio = require('cheerio'); +const Parser = require('rss-parser'); +const parser = new Parser(); + +module.exports = async (ctx) => { + const feed = await parser.parseURL('https://z-z-z.vip/feed'); + + const ProcessFeed = (data) => { + const $ = cheerio.load(data); + + const content = $('div.bpp-post-content'); + + content.find('img').each((i, e) => { + $(e).attr('src', $(e).attr('data-echo')); + }); + + return content.html(); + }; + + const items = await Promise.all( + feed.items.map(async (item) => { + const response = await axios({ + method: 'get', + url: item.link, + }); + + const single = { + guid: item.guid, + title: item.title, + description: ProcessFeed(response.data), + pubDate: item.pubDate, + link: item.link, + author: item['dc:creator'], + }; + return Promise.resolve(single); + }) + ); + + ctx.state.data = { + title: '紫竹张先生', + link: 'https://z-z-z.vip', + description: '紫竹张先生', + item: items, + }; +};