diff --git a/docs/programming.md b/docs/programming.md index e512d86342..57b10dbbf6 100644 --- a/docs/programming.md +++ b/docs/programming.md @@ -345,11 +345,19 @@ GitHub 官方也提供了一些 RSS: +### 招聘 + + + ## GoCN ### 文章 - + + +### 招聘 + + ## Hacker News diff --git a/lib/v2/bilibili/maintainer.js b/lib/v2/bilibili/maintainer.js index bd1aebfde5..30dfe7a4b3 100644 --- a/lib/v2/bilibili/maintainer.js +++ b/lib/v2/bilibili/maintainer.js @@ -32,6 +32,7 @@ module.exports = { '/user/followers/:uid': ['Qixingchen'], '/user/followings/:uid': ['Qixingchen'], '/user/video/:uid/:disableEmbed?': ['DIYgod'], + '/user/video-all/:uid/:disableEmbed?': ['CcccFz'], '/video/danmaku/:bvid/:pid?': ['Qixingchen'], '/video/page/:bvid/:disableEmbed?': ['sxzz'], '/video/reply/:bvid': ['Qixingchen'], diff --git a/lib/v2/gocn/jobs.js b/lib/v2/gocn/jobs.js new file mode 100644 index 0000000000..4faeeb68c1 --- /dev/null +++ b/lib/v2/gocn/jobs.js @@ -0,0 +1,23 @@ +const got = require('@/utils/got'); +const util = require('./util'); + +module.exports = async (ctx) => { + const base_url = 'https://gocn.vip/topics'; + const api_url = 'https://gocn.vip/apiv3/topic/jobs?currentPage=1&grade=new'; + + const response = await got({ + url: api_url, + headers: { + Referer: base_url, + }, + }); + + const list = response.data.data.list; + + ctx.state.data = { + title: `GoCN社区-招聘`, + link: base_url, + description: `获取GoCN站点最新招聘`, + item: await Promise.all(list.map((item) => ctx.cache.tryGet(`${base_url}/${item.guid}`, () => util.getFeedItem(item)))), + }; +}; diff --git a/lib/v2/gocn/maintainer.js b/lib/v2/gocn/maintainer.js index b0e69d17de..37b10046a4 100644 --- a/lib/v2/gocn/maintainer.js +++ b/lib/v2/gocn/maintainer.js @@ -1,3 +1,4 @@ module.exports = { - '/': ['AtlanCI'], + '/': ['AtlanCI', 'CcccFz'], + '/jobs': ['CcccFz'], }; diff --git a/lib/v2/gocn/radar.js b/lib/v2/gocn/radar.js index 8932a1374b..cf5748b6e8 100644 --- a/lib/v2/gocn/radar.js +++ b/lib/v2/gocn/radar.js @@ -8,6 +8,12 @@ module.exports = { source: ['/'], target: '/gocn', }, + { + title: '招聘', + docs: 'https://docs.rsshub.app/programming.html#GoCN', + source: ['/'], + target: '/gocn/jobs', + }, ], }, }; diff --git a/lib/v2/gocn/router.js b/lib/v2/gocn/router.js index dd75f3bd3e..3574e546ad 100644 --- a/lib/v2/gocn/router.js +++ b/lib/v2/gocn/router.js @@ -1,3 +1,4 @@ module.exports = function (router) { router.get('/', require('./topics')); + router.get('/jobs', require('./jobs')); }; diff --git a/lib/v2/gocn/topics.js b/lib/v2/gocn/topics.js index 32d7f92238..4491a4117f 100644 --- a/lib/v2/gocn/topics.js +++ b/lib/v2/gocn/topics.js @@ -1,28 +1,25 @@ const got = require('@/utils/got'); -const { parseDate } = require('@/utils/parse-date'); +const util = require("./util"); module.exports = async (ctx) => { - const api_url = 'https://gocn.vip/api/topic/list?currentPage=1&cate2Id=0&grade=new'; const base_url = 'https://gocn.vip/topics'; + const api_url = 'https://gocn.vip/apiv3/topic/list?currentPage=1&cate2Id=0&grade=new'; const response = await got({ - method: 'get', url: api_url, headers: { Referer: base_url, }, }); - const data = response.data.data.list; + + const list = response.data.data.list; ctx.state.data = { - title: `GoCN社区文章`, - link: `https://gocn.vip`, + title: `GoCN社区-文章`, + link: base_url, description: `获取GoCN站点最新文章`, - item: data.map((item) => ({ - title: item.title, - description: item.summary, - link: `${base_url}/${item.id}`, - pubDate: parseDate(item.ctime * 1000), - })), + item: await Promise.all( + list.map(async (item) => await ctx.cache.tryGet(`${base_url}/${item.guid}`, () => util.getFeedItem(item))), + ), }; }; diff --git a/lib/v2/gocn/util.js b/lib/v2/gocn/util.js new file mode 100644 index 0000000000..88ed672244 --- /dev/null +++ b/lib/v2/gocn/util.js @@ -0,0 +1,17 @@ +const got = require('@/utils/got'); +const { parseDate } = require('@/utils/parse-date'); + +async function getFeedItem(item) { + const response = await got(`https://gocn.vip/apiv3/topic/${item.guid}/info`); + + return { + link: `https://gocn.vip/topics/${item.guid}`, + title: item.title, + description: response.data.data.topic.contentHtml, + pubDate: parseDate(item.ctime, 'X'), + }; +} + +module.exports = { + getFeedItem, +}; diff --git a/lib/v2/studygolang/jobs.js b/lib/v2/studygolang/jobs.js new file mode 100644 index 0000000000..5702b8fe39 --- /dev/null +++ b/lib/v2/studygolang/jobs.js @@ -0,0 +1,37 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); +const timezone = require('@/utils/timezone'); +const base_url = 'https://studygolang.com'; + +module.exports = async (ctx) => { + const jobs_url = 'https://studygolang.com/go/jobs'; + + const response = await got({ + url: jobs_url, + headers: { + Referer: base_url, + }, + }); + + const $ = cheerio.load(response.data); + const list = $('.topics .topic').get(); + + ctx.state.data = { + title: 'Go语言中文网 | 招聘', + link: jobs_url, + description: `获取Go语言中文网的最新招聘`, + item: await Promise.all(list.map((item) => getFeedItem(item))), + }; +}; + +function getFeedItem(item) { + const $ = cheerio.load(item); + const title = $('.title a'); + + return { + title: title.attr('title'), + link: `${base_url}${title.attr('href')}`, + pubDate: timezone(parseDate($('.meta .timeago').attr('title'), 'YYYY-MM-DD hh:mm:ss'), +8), + }; +} diff --git a/lib/v2/studygolang/maintainer.js b/lib/v2/studygolang/maintainer.js new file mode 100644 index 0000000000..9320a26c19 --- /dev/null +++ b/lib/v2/studygolang/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/jobs': ['CcccFz'], +}; diff --git a/lib/v2/studygolang/radar.js b/lib/v2/studygolang/radar.js new file mode 100644 index 0000000000..c9f3105652 --- /dev/null +++ b/lib/v2/studygolang/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'studygolang.com': { + _name: 'Go 语言中文网', + '.': [ + { + title: '招聘', + docs: 'https://docs.rsshub.app/programming.html#go-yu-yan-zhong-wen-wang', + source: ['/'], + target: '/studygolang/jobs', + }, + ], + }, +}; diff --git a/lib/v2/studygolang/router.js b/lib/v2/studygolang/router.js new file mode 100644 index 0000000000..8165a758f4 --- /dev/null +++ b/lib/v2/studygolang/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/jobs', require('./jobs')); +};