Skip to content

Commit

Permalink
Merge pull request #573 from DIYgod/master
Browse files Browse the repository at this point in the history
[pull] master from diygod:master
  • Loading branch information
pull[bot] authored Nov 15, 2022
2 parents f9c97c3 + 4fa3faa commit 9622bbd
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 8 deletions.
17 changes: 16 additions & 1 deletion docs/en/new-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,22 @@ Compared to the official one, this feed:

### The Verge

<RouteEn author="HenryQW" example="/theverge" path="/theverge">
<RouteEn author="HenryQW vbali" example="/theverge" path="/theverge/:hub? :paramsDesc="['Hub, see below, All Posts by default']">

| 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.

Expand Down
17 changes: 16 additions & 1 deletion docs/new-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,22 @@ IPFS 网关有可能失效,那时候换成其他网关。

### The Verge

<Route author="HenryQW" example="/theverge" path="/theverge">
<Route author="HenryQW vbali" example="/theverge" path="/theverge/:hub?" :paramsDesc="['枢纽,见下表,默认为 All Posts']">

| 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 |

通过提取文章全文,以提供比官方源更佳的阅读体验.

Expand Down
2 changes: 1 addition & 1 deletion lib/v2/gov/nmpa/generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
10 changes: 9 additions & 1 deletion lib/v2/theverge/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down
2 changes: 1 addition & 1 deletion lib/v2/theverge/maintainer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
'/': ['HenryQW'],
'/:hub?': ['HenryQW', 'vbali'],
};
4 changes: 2 additions & 2 deletions lib/v2/theverge/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?',
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion lib/v2/theverge/router.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = (router) => {
router.get('/', require('./index'));
router.get('/:hub?', require('./index'));
};

1 comment on commit 9622bbd

@vercel
Copy link

@vercel vercel bot commented on 9622bbd Nov 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.