diff --git a/docs/programming.md b/docs/programming.md index f5795ad4d..d0ef7080d 100644 --- a/docs/programming.md +++ b/docs/programming.md @@ -1300,3 +1300,15 @@ GitHub 官方也提供了一些 RSS: ### 热门 + +## 前端早早聊 + +### 文章 + + + +| 精品推荐 | 技术干货 | 职场成长 | 社区动态 | 组件物料 | 行业动态 | +| --------- | -------- | -------- | --------- | -------- | -------- | +| recommend | quality | growth | community | material | industry | + + \ No newline at end of file diff --git a/lib/v2/zaozao/article.js b/lib/v2/zaozao/article.js new file mode 100644 index 000000000..1d493f500 --- /dev/null +++ b/lib/v2/zaozao/article.js @@ -0,0 +1,36 @@ +const { parseDate } = require('@/utils/parse-date'); +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const { type = 'recommend' } = ctx.params; + const response = await got({ + method: 'put', + url: `https://e.zaozao.run/article/page/${type}`, + headers: { + Referer: `https://www.zaozao.run/`, + }, + body: JSON.stringify({ + pageNo: 1, + pageSize: 100, + }), + }); + + const { status, statusMessage } = response; + if (status !== 200) { + throw new Error(statusMessage); + } + + const { data } = response.data; + + ctx.state.data = { + title: `前端早早聊 - 文章`, + link: `https://www.zaozao.run/article/${type}`, + description: `前端早早聊 - 文章`, + item: data.map((item) => ({ + title: item.title, + link: item.url, + author: item.recommenderName, + pubDate: parseDate(item.updateAt), + })), + }; +}; diff --git a/lib/v2/zaozao/maintainer.js b/lib/v2/zaozao/maintainer.js new file mode 100644 index 000000000..7d96cb3e5 --- /dev/null +++ b/lib/v2/zaozao/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/article/:type?': ['shaomingbo'], +}; \ No newline at end of file diff --git a/lib/v2/zaozao/radar.js b/lib/v2/zaozao/radar.js new file mode 100644 index 000000000..c213e55c9 --- /dev/null +++ b/lib/v2/zaozao/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'zaozao.run': { + _name: '前端早早聊', + www: [ + { + title: '文章', + docs: 'https://docs.rsshub.app/programming.html#qian-duan-zao-zao-liao', + source: ['/article/:type'], + target: '/zaozao/article/:type', + }, + ], + }, +}; diff --git a/lib/v2/zaozao/router.js b/lib/v2/zaozao/router.js new file mode 100644 index 000000000..894cc4e31 --- /dev/null +++ b/lib/v2/zaozao/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/article/:type?', require('./article')); +};