From 4113b6892919734e80f706c92896d83da9b57680 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 28 Dec 2020 16:55:39 +0000 Subject: [PATCH 1/5] chore: update rebase CI token --- .github/workflows/rebase.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml index 947359ad2..917f6c0c4 100644 --- a/.github/workflows/rebase.yml +++ b/.github/workflows/rebase.yml @@ -18,4 +18,4 @@ jobs: name: Automatic Rebase uses: cirrus-actions/rebase@1.4 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.TOKEN_SUPER }} \ No newline at end of file From c10b43bf78ccd54929e372ecf82173c1ff2b3eae Mon Sep 17 00:00:00 2001 From: Toby Tso <7851076+tpnonthealps@users.noreply.github.com> Date: Tue, 29 Dec 2020 01:00:42 +0800 Subject: [PATCH 2/5] feat: Caixin latest (#6539) --- docs/traditional-media.md | 8 +++++ lib/router.js | 3 ++ lib/routes/caixin/latest.js | 71 +++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 lib/routes/caixin/latest.js diff --git a/docs/traditional-media.md b/docs/traditional-media.md index c9347c4f1..94db156ae 100644 --- a/docs/traditional-media.md +++ b/docs/traditional-media.md @@ -311,6 +311,14 @@ Category 列表: +### 最新文章 + + + +说明:此 RSS feed 会自动抓取财新网的最新文章,但不包含 FM 及视频内容。 + + + ## 第一财经 ### 直播区 diff --git a/lib/router.js b/lib/router.js index 2da2ee3d3..e797e1e7f 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3766,4 +3766,7 @@ router.get('/sciencenet/blog/:type?/:time?/:sort?', require('./routes/sciencenet // DailyArt router.get('/dailyart/:language?', require('./routes/dailyart/index')); +// Caixin Latest +router.get('/caixin/latest', require('./routes/caixin/latest')); + module.exports = router; diff --git a/lib/routes/caixin/latest.js b/lib/routes/caixin/latest.js new file mode 100644 index 000000000..8b5f9f042 --- /dev/null +++ b/lib/routes/caixin/latest.js @@ -0,0 +1,71 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const li_r = await got({ + method: 'get', + url: 'http://finance.caixin.com/2020-11-03/101622309.html', + }); + + const $ = cheerio.load(li_r.data); + const list = $('div.columnBox a[name="new_artical"]~ul.list li'); + + const tasks = []; + + list.map((_index, li) => $(li).find('a').first().attr('href')) + .filter((_index, link) => link.indexOf('fm.caixin.com') === -1 && link.indexOf('video.caixin.com') === -1) // content filter + .each((_index, link) => { + const entry = ctx.cache.tryGet(link, async () => { + const entry_r = await got.get(link); + const $ = cheerio.load(entry_r.data); + // title + const h1 = $('div#conTit h1').text(); + // desc items + const subhead = $('div#subhead.subhead').text(); + let pic_url = $('img.cx-img-loader').attr('src'); + if (pic_url === undefined) { + pic_url = $('img.cx-img-loader').attr('data-src'); + } + const pic_alt = $('dl.media_pic dd').text(); + const content = $('div#Main_Content_Val.text').html(); + + /* + const [, count] = + $('a.box_titlecontent.cost-uibtn') + .text() + .match(/本文共计(\d+)字/) || []; + if (count !== 0 && count !== undefined) { + content = `${content}

此乃财新通收费文章,全文共计${count}字。

`; + } + */ + // desc + let desc; + if (pic_url === undefined) { + desc = `

${subhead}

${content}`; + } else { + desc = `

${subhead}

${pic_alt}${content}`; + } + // time + const [, year, month, day, hour, minute] = $('div#artInfo.artInfo') + .text() + .match(/(\d+)年(\d+)月(\d+)日 *(\d+):(\d+)/); + const time = new Date(`${year}-${month}-${day}T${hour}:${minute}:00+0800`).toUTCString(); + + return { + title: h1, + description: desc, + pubDate: time, + link: link, + }; + }); + tasks.push(entry); + }); + + const rss = await Promise.all(tasks); + + ctx.state.data = { + title: '财新网 - 最新文章', + link: 'http://www.caixin.com/', + item: rss, + }; +}; From 342e9cf09011840dc5a08bf39f4bc5c7882909c2 Mon Sep 17 00:00:00 2001 From: LJason Date: Tue, 29 Dec 2020 01:01:14 +0800 Subject: [PATCH 3/5] feat: add juejin radar rule (#6540) --- assets/radar-rules.js | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/assets/radar-rules.js b/assets/radar-rules.js index 137e4cc56..47b97b290 100644 --- a/assets/radar-rules.js +++ b/assets/radar-rules.js @@ -463,12 +463,42 @@ 'juejin.cn': { _name: '掘金', '.': [ + { + title: '标签', + docs: 'https://docs.rsshub.app/programming.html#jue-jin-biao-qian', + source: '/tag/:tag', + target: '/juejin/tag/:tag', + }, + { + title: '小册', + docs: 'https://docs.rsshub.app/programming.html#jue-jin-xiao-ce', + source: '/books', + target: '/juejin/books', + }, + { + title: '沸点', + docs: 'https://docs.rsshub.app/programming.html#jue-jin-fei-dian', + source: ['/pins/:type', '/pins/topic/:type'], + target: (params) => (params.type !== 'recommended' ? '/juejin/pins/:type' : '/juejin/pins'), + }, { title: '专栏', - docs: 'https://docs.rsshub.app/programming.html#jue-jin', - source: '/user/:id/posts', + docs: 'https://docs.rsshub.app/programming.html#jue-jin-zhuan-lan', + source: ['/user/:id', '/user/:id/posts'], target: '/juejin/posts/:id', }, + { + title: '收藏集', + docs: 'https://docs.rsshub.app/programming.html#jue-jin-shou-cang-ji', + source: ['/user/:id', '/user/:id/collections'], + target: '/juejin/collections/:id', + }, + { + title: '单个收藏夹', + docs: 'https://docs.rsshub.app/programming.html#jue-jin-dan-ge-shou-cang-jia', + source: '/collection/:collectionId', + target: '/juejin/collection/:collectionId', + }, ], }, 'anime1.me': { From cac6f754729ddcbb8d651c5baea78f1883a290bd Mon Sep 17 00:00:00 2001 From: zphw <49032034+zphw@users.noreply.github.com> Date: Tue, 29 Dec 2020 01:02:51 +0800 Subject: [PATCH 4/5] fix: disable default debug info (#6544) --- docs/en/install/README.md | 2 +- docs/install/README.md | 2 +- lib/config.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/en/install/README.md b/docs/en/install/README.md index fab3c570d..460be758e 100644 --- a/docs/en/install/README.md +++ b/docs/en/install/README.md @@ -394,7 +394,7 @@ See the relation between access key/code and white/blacklisting. `REQUEST_RETRY`: retries allowed for failed requests, default to `2` -`DEBUG_INFO`: display route information on homepage for debugging purpose, default to `true` +`DEBUG_INFO`: display route information on homepage for debugging purpose, default to `false` `NODE_ENV`: display error message on pages for authentication failing, default to `production` (i.e. no display) diff --git a/docs/install/README.md b/docs/install/README.md index cfb12f1eb..a98da79d6 100644 --- a/docs/install/README.md +++ b/docs/install/README.md @@ -422,7 +422,7 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行 `REQUEST_RETRY`: 请求失败重试次数,默认 `2` -`DEBUG_INFO`: 是否在首页显示路由信息,默认 `true` +`DEBUG_INFO`: 是否在首页显示路由信息,默认 `false` `NODE_ENV`: 是否显示错误输出,默认 `production` (即关闭输出) diff --git a/lib/config.js b/lib/config.js index bda7dc67c..83112c8e7 100644 --- a/lib/config.js +++ b/lib/config.js @@ -40,7 +40,7 @@ const calculateValue = () => { listenInaddrAny: envs.LISTEN_INADDR_ANY || 1, // 是否允许公网连接,取值 0 1 requestRetry: parseInt(envs.REQUEST_RETRY) || 2, // 请求失败重试次数 // 是否显示 Debug 信息,取值 boolean 'false' 'key' ,取值为 'false' false 时永远不显示,取值为 'key' 时带上 ?debug=key 显示 - debugInfo: envs.DEBUG_INFO || true, + debugInfo: envs.DEBUG_INFO || false, disallowRobot: envs.DISALLOW_ROBOT !== '0' && envs.DISALLOW_ROBOT !== 'false', titleLengthLimit: parseInt(envs.TITLE_LENGTH_LIMIT) || 150, redis: { From 9b2d2c97bb7d17ba0e560b2e00b6d0119dfbc69d Mon Sep 17 00:00:00 2001 From: Ethan Shen Date: Tue, 29 Dec 2020 01:06:22 +0800 Subject: [PATCH 5/5] feat: add national association of colleges and employers blog (#6542) --- docs/en/new-media.md | 12 ++++++++++ docs/new-media.md | 12 ++++++++++ lib/router.js | 3 +++ lib/routes/nace/blog.js | 53 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 lib/routes/nace/blog.js diff --git a/docs/en/new-media.md b/docs/en/new-media.md index 4c88a78f7..070815cbe 100644 --- a/docs/en/new-media.md +++ b/docs/en/new-media.md @@ -215,6 +215,18 @@ Provides a better reading experience (full text articles) over the official one. +## National Association of Colleges and Employers + +### Blog + + + +| Most Recent | Top Rated | Most Read | +| - | - | - | +| | top-blogs | mostreadblogs | + + + ## Nautilus ### Topics diff --git a/docs/new-media.md b/docs/new-media.md index 52a9128e2..36c5e89aa 100644 --- a/docs/new-media.md +++ b/docs/new-media.md @@ -1404,6 +1404,18 @@ column 为 third 时可选的 category:
+## 美国大学和雇主协会 + +### 博客 + + + +| Most Recent | Top Rated | Most Read | +| ----------- | --------- | ------------- | +| | top-blogs | mostreadblogs | + + + ## 梅斯医学 MedSci ### 推荐 diff --git a/lib/router.js b/lib/router.js index e797e1e7f..41e4c6eae 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3766,6 +3766,9 @@ router.get('/sciencenet/blog/:type?/:time?/:sort?', require('./routes/sciencenet // DailyArt router.get('/dailyart/:language?', require('./routes/dailyart/index')); +// National Association of Colleges and Employers +router.get('/nace/blog/:sort?', require('./routes/nace/blog')); + // Caixin Latest router.get('/caixin/latest', require('./routes/caixin/latest')); diff --git a/lib/routes/nace/blog.js b/lib/routes/nace/blog.js new file mode 100644 index 000000000..6e428b8bc --- /dev/null +++ b/lib/routes/nace/blog.js @@ -0,0 +1,53 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const sort = ctx.params.sort || ''; + + const rootUrl = 'https://community.naceweb.org'; + const currentUrl = `${rootUrl}/browse/blogs/${sort}`; + const response = await got({ + method: 'get', + url: currentUrl, + }); + + const $ = cheerio.load(response.data); + + const list = $('.BlogTitle') + .slice(0, 10) + .map((_, item) => { + item = $(item); + const link = item.attr('href'); + const split = link.split('/'); + + return { + link, + title: item.text(), + pubDate: new Date(`${split[5]}-${split[6]}-${split[7]}`).toUTCString(), + }; + }) + .get(); + + const items = await Promise.all( + list.map( + async (item) => + await ctx.cache.tryGet(item.link, async () => { + const detailResponse = await got({ + method: 'get', + url: item.link, + }); + const content = cheerio.load(detailResponse.data); + + item.description = content('.blogs-block .col-md-12').html(); + + return item; + }) + ) + ); + + ctx.state.data = { + title: $('title').text(), + link: currentUrl, + item: items, + }; +};