mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 22:19:40 +08:00
feat: Add tag support for 9to5 (#3602)
This commit is contained in:
@@ -8,10 +8,10 @@ pageClass: routes
|
|||||||
|
|
||||||
### 9To5 Sub-site
|
### 9To5 Sub-site
|
||||||
|
|
||||||
<RouteEn author="HenryQW" example="/9to5/mac" path="/9to5/:type" :paramsDesc="['The sub-site name']">
|
<RouteEn author="HenryQW" example="/9to5/mac/aapl" path="/9to5/:subsite/:category?" :paramsDesc="['Required - Subsite name', 'Optional - Tag name inside the url of the tag page']">
|
||||||
|
|
||||||
Supported sub-sites:
|
Supported sub-sites:
|
||||||
| Mac | Google | Toys |
|
| 9To5Mac | 9To5Google | 9To5Toys |
|
||||||
| --- | ------ | ---- |
|
| --- | ------ | ---- |
|
||||||
| Mac | Google | Toys |
|
| Mac | Google | Toys |
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ pageClass: routes
|
|||||||
|
|
||||||
### 9To5 分站
|
### 9To5 分站
|
||||||
|
|
||||||
<Route author="HenryQW" example="/9to5/mac" path="/9to5/:type" :paramsDesc="['分站名字']">
|
<Route author="HenryQW" example="/9to5/mac/aapl" path="/9to5/:subsite/:tag?" :paramsDesc="['必选 - 分站名字','标签 - 可选,可在文章标签 URL 中找到']">
|
||||||
|
|
||||||
支持分站:
|
支持分站:
|
||||||
| Mac | Google | Toys |
|
| 9To5Mac | 9To5Google | 9To5Toys |
|
||||||
| --- | ------ | ---- |
|
| --- | ------ | ---- |
|
||||||
| Mac | Google | Toys |
|
| Mac | Google | Toys |
|
||||||
|
|
||||||
|
|||||||
@@ -955,7 +955,7 @@ router.get('/gitea/blog', require('./routes/gitea/blog'));
|
|||||||
router.get('/idownloadblog', require('./routes/idownloadblog/index'));
|
router.get('/idownloadblog', require('./routes/idownloadblog/index'));
|
||||||
|
|
||||||
// 9to5
|
// 9to5
|
||||||
router.get('/9to5/:type', require('./routes/9to5/subsite'));
|
router.get('/9to5/:subsite/:tag?', require('./routes/9to5/subsite'));
|
||||||
|
|
||||||
// TesterHome
|
// TesterHome
|
||||||
router.get('/testerhome/newest', require('./routes/testerhome/newest'));
|
router.get('/testerhome/newest', require('./routes/testerhome/newest'));
|
||||||
|
|||||||
@@ -7,21 +7,21 @@ module.exports = async (ctx) => {
|
|||||||
link,
|
link,
|
||||||
description;
|
description;
|
||||||
|
|
||||||
switch (ctx.params.type) {
|
switch (ctx.params.subsite) {
|
||||||
case 'mac':
|
case 'mac':
|
||||||
link = 'https://9to5mac.com/feed';
|
link = 'https://9to5mac.com';
|
||||||
title += 'Mac';
|
title += 'Mac';
|
||||||
description = 'Apple News & Mac Rumors Breaking All Day';
|
description = 'Apple News & Mac Rumors Breaking All Day';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'google':
|
case 'google':
|
||||||
link = 'https://9to5google.com/feed';
|
link = 'https://9to5google.com';
|
||||||
title += 'Google';
|
title += 'Google';
|
||||||
description = 'Google, Pixel news, Android, Home, Chrome OS, apps, more';
|
description = 'Google, Pixel news, Android, Home, Chrome OS, apps, more';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'toys':
|
case 'toys':
|
||||||
link = 'https://9to5toys.com/feed';
|
link = 'https://9to5toys.com';
|
||||||
title += 'Toys';
|
title += 'Toys';
|
||||||
description = 'New Gear, reviews and deals';
|
description = 'New Gear, reviews and deals';
|
||||||
break;
|
break;
|
||||||
@@ -30,6 +30,13 @@ module.exports = async (ctx) => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx.params.tag) {
|
||||||
|
link = `${link}/guides/${ctx.params.tag}/feed`;
|
||||||
|
title = `${ctx.params.tag} | ${title}`;
|
||||||
|
} else {
|
||||||
|
link = `${link}/feed`;
|
||||||
|
}
|
||||||
|
|
||||||
const feed = await parser.parseURL(link);
|
const feed = await parser.parseURL(link);
|
||||||
|
|
||||||
const items = await Promise.all(
|
const items = await Promise.all(
|
||||||
|
|||||||
Reference in New Issue
Block a user