feat(route): add Sputnik News (#9294)
This commit is contained in:
@@ -334,6 +334,61 @@ See the [official RSS page](https://www.scmp.com/rss) to get the ID of each cate
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## Sputnik News
|
||||
|
||||
### Category
|
||||
|
||||
<RouteEn author="nczitzk" example="/sputniknews" path="/sputniknews/:category?/:language?" :paramsDesc="['Categort, can be found in URL, `news` by default', 'Language, see below, English by default']">
|
||||
|
||||
Categories for International site:
|
||||
|
||||
| WORLD | COVID-19 | BUSINESS | SPORT | TECH | OPINION |
|
||||
| ----- | -------- | -------- | ----- | ---- | ------- |
|
||||
| world | covid-19 | business | sport | tech | opinion |
|
||||
|
||||
Categories for Chinese site:
|
||||
|
||||
| 新闻 | 中国 | 俄罗斯 | 国际 | 俄中关系 | 评论 |
|
||||
| ---- | ----- | ------ | -------------- | ---------------------- | ------- |
|
||||
| news | china | russia | category_guoji | russia_china_relations | opinion |
|
||||
|
||||
Language
|
||||
|
||||
| Language | Id |
|
||||
| ----------- | ----------- |
|
||||
| English | english |
|
||||
| Spanish | spanish |
|
||||
| German | german |
|
||||
| French | french |
|
||||
| Greek | greek |
|
||||
| Italian | italian |
|
||||
| Czech | czech |
|
||||
| Polish | polish |
|
||||
| Serbian | serbian |
|
||||
| Latvian | latvian |
|
||||
| Lithuanian | lithuanian |
|
||||
| Moldavian | moldavian |
|
||||
| Belarusian | belarusian |
|
||||
| Armenian | armenian |
|
||||
| Abkhaz | abkhaz |
|
||||
| Ssetian | ssetian |
|
||||
| Georgian | georgian |
|
||||
| Azerbaijani | azerbaijani |
|
||||
| Arabic | arabic |
|
||||
| Turkish | turkish |
|
||||
| Persian | persian |
|
||||
| Dari | dari |
|
||||
| Kazakh | kazakh |
|
||||
| Kyrgyz | kyrgyz |
|
||||
| Uzbek | uzbek |
|
||||
| Tajik | tajik |
|
||||
| Vietnamese | vietnamese |
|
||||
| Japanese | japanese |
|
||||
| Chinese | chinese |
|
||||
| Portuguese | portuguese |
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## The Economist
|
||||
|
||||
### Category
|
||||
|
||||
@@ -770,12 +770,55 @@ Type 栏目:
|
||||
|
||||
### 分类
|
||||
|
||||
<Route author="nczitzk" example="/sputniknews" path="/sputniknews/:category?" :paramsDesc="['分类,见下表,默认为 news']">
|
||||
<Route author="nczitzk" example="/sputniknews" path="/sputniknews/:category?/:language?" :paramsDesc="['分类,可在对应分类页 URL 中找到,默认为 news', '语言,见下表,默认为 English']">
|
||||
|
||||
以下为国际站的部分分类:
|
||||
|
||||
| WORLD | COVID-19 | BUSINESS | SPORT | TECH | OPINION |
|
||||
| ----- | -------- | -------- | ----- | ---- | ------- |
|
||||
| world | covid-19 | business | sport | tech | opinion |
|
||||
|
||||
以下为中国站的部分分类:
|
||||
|
||||
| 新闻 | 中国 | 俄罗斯 | 国际 | 俄中关系 | 评论 |
|
||||
| ---- | ----- | ------ | -------------- | ---------------------- | ------- |
|
||||
| news | china | russia | category_guoji | russia_china_relations | opinion |
|
||||
|
||||
语言
|
||||
|
||||
| 语言 | 编号 |
|
||||
| ----------- | ----------- |
|
||||
| English | english |
|
||||
| Spanish | spanish |
|
||||
| German | german |
|
||||
| French | french |
|
||||
| Greek | greek |
|
||||
| Italian | italian |
|
||||
| Czech | czech |
|
||||
| Polish | polish |
|
||||
| Serbian | serbian |
|
||||
| Latvian | latvian |
|
||||
| Lithuanian | lithuanian |
|
||||
| Moldavian | moldavian |
|
||||
| Belarusian | belarusian |
|
||||
| Armenian | armenian |
|
||||
| Abkhaz | abkhaz |
|
||||
| Ssetian | ssetian |
|
||||
| Georgian | georgian |
|
||||
| Azerbaijani | azerbaijani |
|
||||
| Arabic | arabic |
|
||||
| Turkish | turkish |
|
||||
| Persian | persian |
|
||||
| Dari | dari |
|
||||
| Kazakh | kazakh |
|
||||
| Kyrgyz | kyrgyz |
|
||||
| Uzbek | uzbek |
|
||||
| Tajik | tajik |
|
||||
| Vietnamese | vietnamese |
|
||||
| Japanese | japanese |
|
||||
| Chinese | chinese |
|
||||
| Portuguese | portuguese |
|
||||
|
||||
</Route>
|
||||
|
||||
## 公視新聞網
|
||||
|
||||
@@ -2,10 +2,44 @@ const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const languages = {
|
||||
english: 'https://sputniknews.com',
|
||||
spanish: 'https://mundo.sputniknews.com',
|
||||
german: 'https://snanews.de',
|
||||
french: 'https://fr.sputniknews.com',
|
||||
greek: 'https://sputniknews.gr',
|
||||
italian: 'https://it.sputniknews.com',
|
||||
czech: 'https://cz.sputniknews.com',
|
||||
polish: 'https://pl.sputniknews.com',
|
||||
serbian: 'https://rs.sputniknews.com',
|
||||
latvian: 'https://sputniknewslv.com',
|
||||
lithuanian: 'https://lt.sputniknews.com',
|
||||
moldavian: 'https://md.sputniknews.com',
|
||||
belarusian: 'https://bel.sputnik.by',
|
||||
armenian: 'https://armeniasputnik.am',
|
||||
abkhaz: 'https://sputnik-abkhazia.info',
|
||||
ssetian: 'https://sputnik-ossetia.com',
|
||||
georgian: 'https://sputnik-georgia.com',
|
||||
azerbaijani: 'https://sputnik.az',
|
||||
arabic: 'https://arabic.sputniknews.com',
|
||||
turkish: 'https://tr.sputniknews.com',
|
||||
persian: 'https://ir.sputniknews.com',
|
||||
dari: 'https://af.sputniknews.com',
|
||||
kazakh: 'https://sputniknews.kz',
|
||||
kyrgyz: 'https://kg.sputniknews.com',
|
||||
uzbek: 'https://oz.sputniknews-uz.com',
|
||||
tajik: 'https://sputnik-tj.com',
|
||||
vietnamese: 'https://vn.sputniknews.com',
|
||||
japanese: 'https://jp.sputniknews.com',
|
||||
chinese: 'http://sputniknews.cn',
|
||||
portuguese: 'https://br.sputniknews.com',
|
||||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category ?? 'news';
|
||||
const language = ctx.params.language ?? 'english';
|
||||
|
||||
const rootUrl = 'https://sputniknews.cn';
|
||||
const rootUrl = languages[language];
|
||||
const currentUrl = `${rootUrl}/services/${category}/more.html`;
|
||||
|
||||
const response = await got({
|
||||
@@ -40,7 +74,7 @@ module.exports = async (ctx) => {
|
||||
.toArray()
|
||||
.map((tag) => content(tag).text());
|
||||
|
||||
content('.article__meta, .article__title, .article__info, .article__quote-bg, .article__footer, .m-buy, .photoview__ext-link').remove();
|
||||
content('.article__meta, .article__title, .article__info, .article__quote-bg, .article__google-news, .article__footer, .m-buy, .photoview__ext-link').remove();
|
||||
content('div[data-type="article"]').remove();
|
||||
|
||||
item.description = content('.article').html();
|
||||
@@ -52,7 +86,7 @@ module.exports = async (ctx) => {
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${category} - 俄罗斯卫星通讯社`,
|
||||
title: `${category} - Sputnik News`,
|
||||
link: `${rootUrl}/${category}`,
|
||||
item: items,
|
||||
};
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
'/:category?': ['nczitzk'],
|
||||
'/:category?/:language?': ['nczitzk'],
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ module.exports = {
|
||||
title: '分类',
|
||||
docs: 'https://docs.rsshub.app/traditional-media.html#e-luo-si-wei-xing-tong-xun-she-fen-lei',
|
||||
source: ['/:category', '/'],
|
||||
target: '/sputniknews/:category',
|
||||
target: '/sputniknews/:category/:language',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/:category?', require('./index'));
|
||||
router.get('/:category?/:language?', require('./index'));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user