mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 23:00:48 +08:00
feat: add 网易新闻专栏 (#4775)
This commit is contained in:
@@ -389,6 +389,18 @@ category 对应的关键词有
|
|||||||
|
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
## 网易新闻专栏
|
||||||
|
|
||||||
|
### 栏目
|
||||||
|
|
||||||
|
<Route author="Solist-X" example="/netease/news/special/1" path="/netease/news/special/:type?" :paramsDesc="['栏目']">
|
||||||
|
|
||||||
|
| 轻松一刻 | 槽值 | 人间 | 大国小民 | 三三有梗 | 数读 | 看客 | 下划线 | 谈心社 | 哒哒 | 胖编怪聊 | 曲一刀 | 今日之声 | 浪潮 | 沸点 |
|
||||||
|
| -------- | ---- | ---- | -------- | -------- | ---- | ---- | ------ | ------ | ---- | -------- | ------ | -------- | ---- | ---- |
|
||||||
|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
|
||||||
|
|
||||||
|
</Route>
|
||||||
|
|
||||||
## 卫报 The Guardian
|
## 卫报 The Guardian
|
||||||
|
|
||||||
通过提取文章全文,以提供比官方源更佳的阅读体验。
|
通过提取文章全文,以提供比官方源更佳的阅读体验。
|
||||||
|
|||||||
@@ -2691,6 +2691,9 @@ router.get('/umass/amherst/csnews', require('./routes/umass/amherst/csnews'));
|
|||||||
// 飘花电影网
|
// 飘花电影网
|
||||||
router.get('/piaohua/hot', require('./routes/piaohua/hot'));
|
router.get('/piaohua/hot', require('./routes/piaohua/hot'));
|
||||||
|
|
||||||
|
// 网易新闻专栏
|
||||||
|
router.get('/netease/news/special/:type?', require('./routes/netease/news/special'));
|
||||||
|
|
||||||
// 端传媒
|
// 端传媒
|
||||||
router.get('/initium/:type?/:language?', require('./routes/initium/full'));
|
router.get('/initium/:type?/:language?', require('./routes/initium/full'));
|
||||||
|
|
||||||
|
|||||||
121
lib/routes/netease/news/special.js
Normal file
121
lib/routes/netease/news/special.js
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const date = require('@/utils/date');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const typeMap = {
|
||||||
|
1: '轻松一刻',
|
||||||
|
2: '槽值',
|
||||||
|
3: '人间',
|
||||||
|
4: '大国小民',
|
||||||
|
5: '三三有梗',
|
||||||
|
6: '数读',
|
||||||
|
7: '看客',
|
||||||
|
8: '下划线',
|
||||||
|
9: '谈心社',
|
||||||
|
10: '哒哒',
|
||||||
|
11: '胖编怪聊',
|
||||||
|
12: '曲一刀',
|
||||||
|
13: '今日之声',
|
||||||
|
14: '浪潮',
|
||||||
|
15: '沸点',
|
||||||
|
};
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
if (!ctx.params.type) {
|
||||||
|
throw Error('Bad parameter. See <a href="https://docs.rsshub.app/game.html#wang-yi-da-shen">https://docs.rsshub.app/game.html#wang-yi-da-shen</a>');
|
||||||
|
}
|
||||||
|
const selectedType = parseInt(ctx.params.type);
|
||||||
|
let type;
|
||||||
|
switch (selectedType) {
|
||||||
|
case 1:
|
||||||
|
type = `BD21K0DLwangning`; // 轻松一刻
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
type = `CICMICLUwangning`; // 槽值
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
type = `CICMOMBLwangning`; // 人间
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
type = `CICMPVC5wangning`; // 大国小民
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
type = `CICMLCOUwangning`; // 三三有梗
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
type = `D551V75Cwangning`; // 数读
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
type = `D55253RHwangning`; // 看客
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
type = `D553A53Lwangning`; // 下划线
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
type = `D553PGHQwangning`; // 谈心社
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
type = `CICMS5BIwangning`; // 哒哒
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
type = `CQ9UDVKOwangning`; // 胖编怪聊
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
type = `CQ9UJIJNwangning`; // 曲一刀
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
type = `BD284UM8wangning`; // 今日之声
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
type = `CICMMGBHwangning`; // 浪潮
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
type = `D5543R68wangning`; // 沸点
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const url = `https://3g.163.com/touch/reconstruct/article/list/${type}/0-10.html`;
|
||||||
|
const response = await got.get(url);
|
||||||
|
const data = response.data;
|
||||||
|
const matches = data.replace(/\s/g, '').match(/artiList\((.*?)\]\}\)/);
|
||||||
|
const articlelist0 = matches[1].replace(/".*?wangning/, '"articles') + ']}';
|
||||||
|
const articlelist = JSON.parse(articlelist0);
|
||||||
|
const articles = articlelist.articles;
|
||||||
|
|
||||||
|
const items = await Promise.all(
|
||||||
|
articles.map(async (article) => {
|
||||||
|
const title = article.title;
|
||||||
|
let url = article.url;
|
||||||
|
const time0 = article.ptime;
|
||||||
|
const time = time0.slice(0, 10) + ' ' + time0.slice(10);
|
||||||
|
if (url === null || article.skipType === 'video') {
|
||||||
|
const skipurl = article.skipURL;
|
||||||
|
const vid = skipurl.match(/vid=(.*?)$/);
|
||||||
|
if (vid !== null) {
|
||||||
|
url = `https://3g.163.com/exclusive/video/${vid[1]}.html`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const content = await ctx.cache.tryGet(url, async () => {
|
||||||
|
const article_response = await got.get(url);
|
||||||
|
const $ = cheerio.load(article_response.data);
|
||||||
|
|
||||||
|
return $('div[class="content"]').html() ? $('div[class="content"]').html() : $('div[class="video"]').html();
|
||||||
|
});
|
||||||
|
|
||||||
|
const list = {
|
||||||
|
title: title,
|
||||||
|
link: url,
|
||||||
|
description: content,
|
||||||
|
pubDate: date(time),
|
||||||
|
};
|
||||||
|
return Promise.resolve(list);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
const selectedTypeName = typeMap[selectedType];
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: selectedTypeName ? `${selectedTypeName} - 网易专栏` : '网易专栏',
|
||||||
|
link: 'https://3g.163.com/touch/exclusive/?referFrom=163',
|
||||||
|
item: items,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user