diff --git a/docs/en/game.md b/docs/en/game.md index b8da52bd25..699d2b5fd8 100755 --- a/docs/en/game.md +++ b/docs/en/game.md @@ -104,6 +104,14 @@ Sorting types, default to `date`: +### Feed The Beast Modpack Updates + + +| param | description | +| ------| ------------ | +| modpackEntry | The entry name of modpack, can be found in modpack\'s page link, for `https://www.feed-the-beast.com/modpack/ftb_presents_direwolf20_1_16`, use `ftb_presents_direwolf20_1_16`. | + + ## Nintendo ### eShop New Game Releases diff --git a/docs/game.md b/docs/game.md index 9ac14e389a..001a2ea32e 100644 --- a/docs/game.md +++ b/docs/game.md @@ -211,6 +211,14 @@ pageClass: routes +### Feed The Beast (FTB) 模组包更新 + + +| 参数 | 说明 | +| ------| ------------ | +| modpackEntry | 模组包的短名从模组包的页面链接中找到,例如 `https://www.feed-the-beast.com/modpack/ftb_presents_direwolf20_1_16`,短名就是 `ftb_presents_direwolf20_1_16`。 | + + ## Nintendo ### eShop 新发售游戏 diff --git a/lib/router.js b/lib/router.js index e039456b23..0bb181c5d7 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3855,4 +3855,7 @@ router.get('/rfa/:language?/:channel?/:subChannel?', require('./routes/rfa/index // booth.pm router.get('/booth.pm/shop/:subdomain', require('./routes/booth-pm/shop')); +// Minecraft feed the beast +router.get('/feed-the-beast/modpack/:modpackEntry', require('./routes/feed-the-beast/modpack')); + module.exports = router; diff --git a/lib/routes/feed-the-beast/modpack.js b/lib/routes/feed-the-beast/modpack.js new file mode 100644 index 0000000000..f1e7102d1f --- /dev/null +++ b/lib/routes/feed-the-beast/modpack.js @@ -0,0 +1,31 @@ +const got = require('got'); + +module.exports = async (ctx) => { + const modpackEntry = ctx.params.modpackEntry; + const ftbLink = `https://www.feed-the-beast.com/modpack/${modpackEntry}/`; + const { id } = await got({ + url: `https://api.sunekaer.com/modpack/${modpackEntry}`, + headers: { + Referer: ftbLink, + }, + }).json(); + const data = await got({ + url: `https://api.modpacks.ch/public/modpack/${id}`, + headers: { + Referer: ftbLink, + }, + }).json(); + + ctx.state.data = { + title: `${data.name} 模组包更新`, + link: ftbLink, + description: data.description, + item: data.versions.map((item) => ({ + title: item.name, + description: item.name, + pubDate: new Date(item.updated * 1000).toUTCString(), + link: ftbLink, + guid: `${id}-${item.id}`, + })), + }; +};