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
This commit is contained in:
Balazs Varkonyi 2022-11-15 13:17:53 +01:00 committed by GitHub
parent 493b2baafa
commit 4fa3faa597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 7 deletions

View File

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

View File

@ -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 |
通过提取文章全文,以提供比官方源更佳的阅读体验.

View File

@ -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) =>

View File

@ -1,3 +1,3 @@
module.exports = {
'/': ['HenryQW'],
'/:hub?': ['HenryQW', 'vbali'],
};

View File

@ -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?',
},
],
},

View File

@ -1,3 +1,3 @@
module.exports = (router) => {
router.get('/', require('./index'));
router.get('/:hub?', require('./index'));
};