diff --git a/lib/v2/onehu/common.js b/lib/v2/onehu/common.js new file mode 100644 index 00000000000000..21cdb270985e09 --- /dev/null +++ b/lib/v2/onehu/common.js @@ -0,0 +1,27 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const timezone = require('@/utils/timezone'); +const { parseDate } = require('@/utils/parse-date'); + +module.exports = async (ctx) => { + const link = 'https://onehu.xyz'; + const response = await got(link); + const data = response.data; + const $ = cheerio.load(data); + const list = $('#board article').toArray().map((item) => { + item = $(item); + return { + title: item.find('.index-header').text(), + link: item.find('.index-header').children('a').attr('href'), + description: item.find('.index-excerpt.index-excerpt__noimg').children('div').text(), + pubDate: timezone(parseDate(item.find('.post-meta.mr-3').children('time').attr('datetime'), 'YYYY年MM月DD日 HH:mm'), +8), + }; + }); + + ctx.state.data = { + title: $('title').text(), + link, + item: list, + }; + +}; diff --git a/lib/v2/onehu/maintainer.js b/lib/v2/onehu/maintainer.js new file mode 100644 index 00000000000000..a407b2bade6c27 --- /dev/null +++ b/lib/v2/onehu/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/': ['ruoshui9527'], +}; diff --git a/lib/v2/onehu/radar.js b/lib/v2/onehu/radar.js new file mode 100644 index 00000000000000..e58232343583bb --- /dev/null +++ b/lib/v2/onehu/radar.js @@ -0,0 +1,11 @@ +module.exports = { + 'onehu.xyz': { + _name: '我不是盐神', + '.': [ + { + title: '我不是盐神', + docs: 'https://docs.rsshub.app/routes/new-media#wo-bu-shi-yan-shen', + }, + ], + }, +}; diff --git a/lib/v2/onehu/router.js b/lib/v2/onehu/router.js new file mode 100644 index 00000000000000..ebf2d27f70e0e0 --- /dev/null +++ b/lib/v2/onehu/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/', require('./common')); +}; diff --git a/website/docs/routes/new-media.mdx b/website/docs/routes/new-media.mdx index a4ee1d12781a04..b0a09c6a589dc5 100644 --- a/website/docs/routes/new-media.mdx +++ b/website/docs/routes/new-media.mdx @@ -5288,3 +5288,9 @@ ### 公众号 {#zi-you-wei-xin-gong-zhong-hao} + +## 我不是盐神 {#wo-bu-shi-yan-shen} + +### 首页 {#wo-bu-shi-yan-shen-shou-ye} + +