diff --git a/lib/v2/fuliba/latest.js b/lib/v2/fuliba/latest.js new file mode 100644 index 000000000..0bb1ea126 --- /dev/null +++ b/lib/v2/fuliba/latest.js @@ -0,0 +1,25 @@ +const got = require('@/utils/got'); +const { parseDate } = require('@/utils/parse-date'); + +module.exports = async (ctx) => { + const { data: response } = await got(`https://fuliba2023.net/wp-json/wp/v2/posts`, { + searchParams: { + per_page: ctx.query.limit ?? 100, + _embed: 1, + }, + }); + const items = response.map((item) => ({ + title: item.title.rendered, + link: item.link, + guid: item.guid.rendered, + description: item.content.rendered, + pubDate: parseDate(item.date_gmt), + author: item._embedded.author[0].name, + })); + + ctx.state.data = { + title: '福利吧', + link: `https://fuliba2023.net`, + item: items, + }; +}; diff --git a/lib/v2/fuliba/maintainer.js b/lib/v2/fuliba/maintainer.js new file mode 100644 index 000000000..b2e264a5b --- /dev/null +++ b/lib/v2/fuliba/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/latest': ['shinemoon'], +}; diff --git a/lib/v2/fuliba/radar.js b/lib/v2/fuliba/radar.js new file mode 100644 index 000000000..5868a52ad --- /dev/null +++ b/lib/v2/fuliba/radar.js @@ -0,0 +1,15 @@ +const fuliba = { + _name: '福利吧', + '.': [ + { + title: '最新', + docs: 'https://docs.rsshub.app/routes/new-media#fuliba', + source: '/', + target: '/fuliba/latest', + }, + ], +}; + +module.exports = { + 'fuliba2023.net': fuliba, +}; diff --git a/lib/v2/fuliba/router.js b/lib/v2/fuliba/router.js new file mode 100644 index 000000000..f70796a86 --- /dev/null +++ b/lib/v2/fuliba/router.js @@ -0,0 +1,3 @@ +module.exports = (router) => { + router.get('/latest', require('./latest')); +}; diff --git a/website/docs/routes/new-media.mdx b/website/docs/routes/new-media.mdx index c94ca05d0..189025c53 100644 --- a/website/docs/routes/new-media.mdx +++ b/website/docs/routes/new-media.mdx @@ -3293,6 +3293,12 @@ Type 栏目: +## 福利吧 {#fu-li-ba} + +### 最新 {#fu-li-ba-zui-xin} + + + ## 福利年 {#fu-li-nian} ### 文章 {#fu-li-nian-wen-zhang}