From 493b2baafa230d476ed0c938441faf6bbcb7e239 Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 15 Nov 2022 17:46:34 +0700 Subject: [PATCH 1/2] fix(route): nmpa stealth puppeteer (#11279) --- lib/v2/gov/nmpa/generic.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/v2/gov/nmpa/generic.js b/lib/v2/gov/nmpa/generic.js index f857a0c7ec2081..a57cd61d27bebd 100644 --- a/lib/v2/gov/nmpa/generic.js +++ b/lib/v2/gov/nmpa/generic.js @@ -7,7 +7,7 @@ const baseUrl = 'https://www.nmpa.gov.cn'; module.exports = async (ctx) => { const path = ctx.params[0]; const url = `${baseUrl}/${path.endsWith('/') ? path.slice(0, -1) : path}/index.html`; - const browser = await require('@/utils/puppeteer')(); + const browser = await require('@/utils/puppeteer')({ stealth: true }); const data = await ctx.cache.tryGet( url, async () => { From 4fa3faa59743b9b4faf4474efbc6a3cfd191798e Mon Sep 17 00:00:00 2001 From: Balazs Varkonyi Date: Tue, 15 Nov 2022 13:17:53 +0100 Subject: [PATCH 2/2] feat(route): Added TheVerge Hubs (#11276) * Added TheVerge Hubs https://www.theverge.com/2012/1/25/2732963/verge-rss-feeds * Fixed Lint warnings * Fixed string quotes * Updated maintainer and radar * Updated the docs * Update docs/en/new-media.md * Update docs/new-media.md * Update lib/v2/theverge/maintainer.js * docs: fix typo --- docs/en/new-media.md | 17 ++++++++++++++++- docs/new-media.md | 17 ++++++++++++++++- lib/v2/theverge/index.js | 10 +++++++++- lib/v2/theverge/maintainer.js | 2 +- lib/v2/theverge/radar.js | 4 ++-- lib/v2/theverge/router.js | 2 +- 6 files changed, 45 insertions(+), 7 deletions(-) diff --git a/docs/en/new-media.md b/docs/en/new-media.md index 1075e221f7fe0e..88c0747f26da2d 100644 --- a/docs/en/new-media.md +++ b/docs/en/new-media.md @@ -764,7 +764,22 @@ Compared to the official one, this feed: ### The Verge - + + +| Hub | Hub name | +| ----------- | ------------------- | +| | All Posts | +| android | Android | +| apple | Apple | +| apps | Apps & Software | +| blackberry | BlackBerry | +| culture | Culture | +| gaming | Gaming | +| hd | HD & Home | +| microsoft | Microsoft | +| photography | Photography & Video | +| policy | Policy & Law | +| web | Web & Social | Provides a better reading experience (full text articles) over the official one. diff --git a/docs/new-media.md b/docs/new-media.md index b633f71bd46169..b5963728f84d57 100644 --- a/docs/new-media.md +++ b/docs/new-media.md @@ -1359,7 +1359,22 @@ IPFS 网关有可能失效,那时候换成其他网关。 ### The Verge - + + +| Hub | Hub name | +| ----------- | ------------------- | +| | All Posts | +| android | Android | +| apple | Apple | +| apps | Apps & Software | +| blackberry | BlackBerry | +| culture | Culture | +| gaming | Gaming | +| hd | HD & Home | +| microsoft | Microsoft | +| photography | Photography & Video | +| policy | Policy & Law | +| web | Web & Social | 通过提取文章全文,以提供比官方源更佳的阅读体验. diff --git a/lib/v2/theverge/index.js b/lib/v2/theverge/index.js index f251db2d1b3071..68accd0bf31492 100644 --- a/lib/v2/theverge/index.js +++ b/lib/v2/theverge/index.js @@ -3,7 +3,15 @@ const parser = require('@/utils/rss-parser'); const cheerio = require('cheerio'); module.exports = async (ctx) => { - const feed = await parser.parseURL('https://www.theverge.com/rss/index.xml'); + let link; + + if (ctx.params.hub) { + link = `https://www.theverge.com/${ctx.params.hub}/rss/index.xml`; + } else { + link = 'https://www.theverge.com/rss/index.xml'; + } + + const feed = await parser.parseURL(link); const items = await Promise.all( feed.items.map((item) => diff --git a/lib/v2/theverge/maintainer.js b/lib/v2/theverge/maintainer.js index bccb53f334e0d0..0f971cbca8bd0f 100644 --- a/lib/v2/theverge/maintainer.js +++ b/lib/v2/theverge/maintainer.js @@ -1,3 +1,3 @@ module.exports = { - '/': ['HenryQW'], + '/:hub?': ['HenryQW', 'vbali'], }; diff --git a/lib/v2/theverge/radar.js b/lib/v2/theverge/radar.js index 357423e71fc71a..ebdb640e4f1939 100644 --- a/lib/v2/theverge/radar.js +++ b/lib/v2/theverge/radar.js @@ -5,8 +5,8 @@ module.exports = { { title: 'The Verge', docs: 'https://docs.rsshub.app/new-media.html#the-verge', - source: ['/rss/index.xml', '/'], - target: '/theverge', + source: ['/:hub', '/'], + target: '/theverge/:hub?', }, ], }, diff --git a/lib/v2/theverge/router.js b/lib/v2/theverge/router.js index 7e427447c70050..65b411b94955e7 100644 --- a/lib/v2/theverge/router.js +++ b/lib/v2/theverge/router.js @@ -1,3 +1,3 @@ module.exports = (router) => { - router.get('/', require('./index')); + router.get('/:hub?', require('./index')); };