Skip to content

Commit 4fa3faa

Browse files
authored
feat(route): Added TheVerge Hubs (DIYgod#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
1 parent 493b2ba commit 4fa3faa

File tree

6 files changed

+45
-7
lines changed

6 files changed

+45
-7
lines changed

docs/en/new-media.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,22 @@ Compared to the official one, this feed:
764764

765765
### The Verge
766766

767-
<RouteEn author="HenryQW" example="/theverge" path="/theverge">
767+
<RouteEn author="HenryQW vbali" example="/theverge" path="/theverge/:hub? :paramsDesc="['Hub, see below, All Posts by default']">
768+
769+
| Hub | Hub name |
770+
| ----------- | ------------------- |
771+
| | All Posts |
772+
| android | Android |
773+
| apple | Apple |
774+
| apps | Apps & Software |
775+
| blackberry | BlackBerry |
776+
| culture | Culture |
777+
| gaming | Gaming |
778+
| hd | HD & Home |
779+
| microsoft | Microsoft |
780+
| photography | Photography & Video |
781+
| policy | Policy & Law |
782+
| web | Web & Social |
768783

769784
Provides a better reading experience (full text articles) over the official one.
770785

docs/new-media.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,22 @@ IPFS 网关有可能失效,那时候换成其他网关。
13591359

13601360
### The Verge
13611361

1362-
<Route author="HenryQW" example="/theverge" path="/theverge">
1362+
<Route author="HenryQW vbali" example="/theverge" path="/theverge/:hub?" :paramsDesc="['枢纽,见下表,默认为 All Posts']">
1363+
1364+
| Hub | Hub name |
1365+
| ----------- | ------------------- |
1366+
| | All Posts |
1367+
| android | Android |
1368+
| apple | Apple |
1369+
| apps | Apps & Software |
1370+
| blackberry | BlackBerry |
1371+
| culture | Culture |
1372+
| gaming | Gaming |
1373+
| hd | HD & Home |
1374+
| microsoft | Microsoft |
1375+
| photography | Photography & Video |
1376+
| policy | Policy & Law |
1377+
| web | Web & Social |
13631378

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

lib/v2/theverge/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ const parser = require('@/utils/rss-parser');
33
const cheerio = require('cheerio');
44

55
module.exports = async (ctx) => {
6-
const feed = await parser.parseURL('https://www.theverge.com/rss/index.xml');
6+
let link;
7+
8+
if (ctx.params.hub) {
9+
link = `https://www.theverge.com/${ctx.params.hub}/rss/index.xml`;
10+
} else {
11+
link = 'https://www.theverge.com/rss/index.xml';
12+
}
13+
14+
const feed = await parser.parseURL(link);
715

816
const items = await Promise.all(
917
feed.items.map((item) =>

lib/v2/theverge/maintainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
'/': ['HenryQW'],
2+
'/:hub?': ['HenryQW', 'vbali'],
33
};

lib/v2/theverge/radar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ module.exports = {
55
{
66
title: 'The Verge',
77
docs: 'https://docs.rsshub.app/new-media.html#the-verge',
8-
source: ['/rss/index.xml', '/'],
9-
target: '/theverge',
8+
source: ['/:hub', '/'],
9+
target: '/theverge/:hub?',
1010
},
1111
],
1212
},

lib/v2/theverge/router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = (router) => {
2-
router.get('/', require('./index'));
2+
router.get('/:hub?', require('./index'));
33
};

0 commit comments

Comments
 (0)