diff --git a/docs/en/program-update.md b/docs/en/program-update.md index 30862a436..aed6e51a3 100644 --- a/docs/en/program-update.md +++ b/docs/en/program-update.md @@ -104,6 +104,10 @@ The owner of the official image fills in the library, for example: https://rsshu +## ManicTime + + + ## Microsoft Edge ### Addons Update diff --git a/docs/program-update.md b/docs/program-update.md index e38532661..e10dd06ea 100644 --- a/docs/program-update.md +++ b/docs/program-update.md @@ -156,6 +156,10 @@ pageClass: routes +## ManicTime + + + ## Microsoft Edge ### 外接程序更新 diff --git a/lib/router.js b/lib/router.js index 72025a64d..496e3ac8c 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3404,6 +3404,9 @@ router.get('/dev.to/top/:period', require('./routes/dev.to/top')); router.get('/gameres/hot', require('./routes/gameres/hot')); router.get('/gameres/list/:id', require('./routes/gameres/list')); +// ManicTime +router.get('/manictime/releases', require('./routes/manictime/releases')); + // Deutsche Welle 德国之声 router.get('/dw/:lang?/:caty?', require('./routes/dw/index')); diff --git a/lib/routes/manictime/releases.js b/lib/routes/manictime/releases.js new file mode 100644 index 000000000..fe8058e56 --- /dev/null +++ b/lib/routes/manictime/releases.js @@ -0,0 +1,31 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const rootUrl = 'https://www.manictime.com/Releases'; + const response = await got({ + method: 'get', + url: rootUrl, + }); + + const $ = cheerio.load(response.data); + + const items = $('.col-md-4') + .slice(0, 10) + .map((_, item) => { + item = $(item); + return { + link: rootUrl, + title: item.find('h2').text(), + description: item.next().html(), + pubDate: new Date(item.find('p').eq(0).text().replace('Release date - ', '')).toUTCString(), + }; + }) + .get(); + + ctx.state.data = { + title: 'ManicTime releases', + link: rootUrl, + item: items, + }; +};