diff --git a/docs/anime.md b/docs/anime.md index d19dc9675..c0aef126d 100644 --- a/docs/anime.md +++ b/docs/anime.md @@ -717,12 +717,16 @@ Sources -| All | 资讯 | 专栏 | -| --- | ---- | ------ | -| all | news | column | +| 全部文章 | 资讯 | 专栏 | +| ---- | ---- | ------ | +| all | news | column | +### 本月新作 + + + ## 终点分享 ### 最新汉化 diff --git a/lib/v2/ymgal/article.js b/lib/v2/ymgal/article.js index 49097fd94..9b58871b4 100644 --- a/lib/v2/ymgal/article.js +++ b/lib/v2/ymgal/article.js @@ -54,7 +54,7 @@ module.exports = async (ctx) => { ctx.state.data = { title: `月幕 Galgame - ${info}`, - link: 'https://www.ymgal.games/co/article', + link: `${host}/co/article`, description: `月幕 Galgame - ${info}`, item: items, }; diff --git a/lib/v2/ymgal/game.js b/lib/v2/ymgal/game.js new file mode 100644 index 000000000..809513bf0 --- /dev/null +++ b/lib/v2/ymgal/game.js @@ -0,0 +1,39 @@ +const got = require('@/utils/got'); +const { art } = require('@/utils/render'); +const path = require('path'); +const cheerio = require('cheerio'); + +const host = 'https://www.ymgal.games'; + +const date = new Date(); +const year = date.getFullYear(); +const month = date.getMonth() + 1; + +module.exports = async (ctx) => { + const response = await got({ + method: 'get', + url: `${host}/release-list/${year}/${month}`, + }); + + const $ = cheerio.load(response.data); + const list = $('.game-view-card').toArray(); + + const items = + list && + list.map((item) => { + item = $(item); + const itemPicUrl = item.find('.lazy').first().attr('data-original'); + return { + title: item.attr('title'), + link: `${host}${item.attr('href')}`, + description: art(path.join(__dirname, 'templates/description.art'), { itemPicUrl }), + }; + }); + + ctx.state.data = { + title: `月幕 Galgame - 本月新作`, + link: `${host}/release-list/${year}/${month}`, + description: '月幕 Galgame - 本月新作', + item: items, + }; +}; diff --git a/lib/v2/ymgal/radar.js b/lib/v2/ymgal/radar.js index 6e2302912..08c29f969 100644 --- a/lib/v2/ymgal/radar.js +++ b/lib/v2/ymgal/radar.js @@ -20,6 +20,12 @@ module.exports = { source: ['/co/article'], target: '/ymgal/article/column', }, + { + title: '本月新作', + docs: 'https://docs.rsshub.app/anime.html#yue-mu-galgame', + source: ['/'], + target: '/ymgal/game/release', + }, ], }, }; diff --git a/lib/v2/ymgal/router.js b/lib/v2/ymgal/router.js index 8fcc9ea22..e3b8b87e1 100644 --- a/lib/v2/ymgal/router.js +++ b/lib/v2/ymgal/router.js @@ -1,3 +1,4 @@ module.exports = (router) => { router.get('/article/:type?', require('./article')); + router.get('/game/release', require('./game')); }; diff --git a/lib/v2/ymgal/templates/description.art b/lib/v2/ymgal/templates/description.art new file mode 100644 index 000000000..2ab9cf91b --- /dev/null +++ b/lib/v2/ymgal/templates/description.art @@ -0,0 +1,3 @@ +{{ if itemPicUrl }} + +{{ /if }} \ No newline at end of file