mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-19 06:38:55 +08:00
安理会五常又耍流氓了 (#1039)
This commit is contained in:
@@ -2163,3 +2163,7 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运
|
||||
1. 复制查询结果 URL 中`?`后的部分,例如 `https://www.autotrader.co.uk/car-search?radius=50&postcode=sw1a1aa&onesearchad=Used&onesearchad=Nearly%20New&onesearchad=New&price-to=9000&year-from=2012&body-type=Hatchback&transmission=Automatic&exclude-writeoff-categories=on` 则为 `radius=50&postcode=sw1a1aa&onesearchad=Used&onesearchad=Nearly%20New&onesearchad=New&price-to=9000&year-from=2012&body-type=Hatchback&transmission=Automatic&exclude-writeoff-categories=on`
|
||||
|
||||
</route>
|
||||
|
||||
### 联合国
|
||||
|
||||
<route name="安理会否决了决议" author="HenryQW" example="/un/scveto" path="/un/scveto"/>
|
||||
|
||||
@@ -385,3 +385,7 @@ Provides a better reading experience (full text articles) over the official one.
|
||||
1. Copy everything in the URL after `?`, for example: `https://www.autotrader.co.uk/car-search?radius=50&postcode=sw1a1aa&onesearchad=Used&onesearchad=Nearly%20New&onesearchad=New&price-to=9000&year-from=2012&body-type=Hatchback&transmission=Automatic&exclude-writeoff-categories=on` will produce `radius=50&postcode=sw1a1aa&onesearchad=Used&onesearchad=Nearly%20New&onesearchad=New&price-to=9000&year-from=2012&body-type=Hatchback&transmission=Automatic&exclude-writeoff-categories=on`
|
||||
|
||||
</routeEn>
|
||||
|
||||
### United Nations
|
||||
|
||||
<routeEn name="Security Council Vetoed a Resolution" author="HenryQW" example="/un/scveto" path="/un/scveto"/>
|
||||
|
||||
@@ -411,9 +411,12 @@ router.get('/dongqiudi/result/:team', require('./routes/dongqiudi/result'));
|
||||
router.get('/dongqiudi/team_news/:team', require('./routes/dongqiudi/team_news'));
|
||||
router.get('/dongqiudi/player_news/:id', require('./routes/dongqiudi/player_news'));
|
||||
|
||||
// 维基百科
|
||||
// 维基百科 Wikipedia
|
||||
router.get('/wikipedia/mainland', require('./routes/wikipedia/mainland'));
|
||||
|
||||
// 联合国 United Nations
|
||||
router.get('/un/scveto', require('./routes/un/scveto'));
|
||||
|
||||
// 雪球
|
||||
router.get('/xueqiu/user/:id/:type?', require('./routes/xueqiu/user'));
|
||||
router.get('/xueqiu/favorite/:id', require('./routes/xueqiu/favorite'));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://zh.wikipedia.org/wiki/Portal:%E4%B8%AD%E5%9C%8B%E5%A4%A7%E9%99%B8%E6%96%B0%E8%81%9E%E5%8B%95%E6%85%8B';
|
||||
@@ -20,10 +21,7 @@ module.exports = async (ctx) => {
|
||||
for (let i = 0; i < list.length - 1; i++) {
|
||||
const item = {
|
||||
title: $(list[i]).text(),
|
||||
desc: full
|
||||
.find(`ul:nth-of-type(${i + 1})`)
|
||||
.html()
|
||||
.replace(/href="\/wiki/g, 'href="https://zh.wikipedia.org/wiki'),
|
||||
desc: utils.ProcessLink(full.find(`ul:nth-of-type(${i + 1})`), 'zh'),
|
||||
url,
|
||||
};
|
||||
items.push(item);
|
||||
|
||||
23
routes/wikipedia/utils.js
Normal file
23
routes/wikipedia/utils.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const ProcessLink = ($, lang) => {
|
||||
lang = !lang ? 'en' : lang;
|
||||
|
||||
$.find('a').each((i, e) => {
|
||||
if (e.attribs.href.startsWith('/wiki/')) {
|
||||
e.attribs.href = `https://${lang}.wikipedia.org${e.attribs.href}`;
|
||||
}
|
||||
});
|
||||
|
||||
// img links
|
||||
$.find('img').each((i, e) => {
|
||||
if (e.attribs.src.startsWith('//upload.wikimedia.org/')) {
|
||||
e.attribs.src = `https:${e.attribs.src}`;
|
||||
e.attribs.srcset = '';
|
||||
}
|
||||
});
|
||||
|
||||
return $.html();
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
ProcessLink,
|
||||
};
|
||||
54
un/scveto.js
Normal file
54
un/scveto.js
Normal file
@@ -0,0 +1,54 @@
|
||||
const axios = require('../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const utils = require('../routes/wikipedia/utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://en.wikipedia.org/wiki/List_of_vetoed_United_Nations_Security_Council_resolutions';
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('.sortable > tbody > tr').slice(1, 11);
|
||||
|
||||
list.map((i) => utils.ProcessLink($(list[i]), 'en'));
|
||||
|
||||
const items = [];
|
||||
|
||||
for (let i = 0; i < list.length - 1; i++) {
|
||||
const content = cheerio.load(list[i]);
|
||||
|
||||
const date = content('td:nth-child(1)');
|
||||
const resolution = content('td:nth-child(2)');
|
||||
const meeting = content('td:nth-child(3)');
|
||||
const agenda = content('td:nth-child(4)');
|
||||
let country = content('td:nth-child(5)');
|
||||
country = cheerio.load(country.html().replace('<br>', ' and'));
|
||||
|
||||
const item = {
|
||||
title: `${country.text().trim()} vetoed a Resolution`,
|
||||
desc: `${country('body').html()} vetoed ${agenda.html()}. <br/> <br/> <b>Resolution: </b> ${resolution.html()}<br/><br/> <b>Meeting Record: </b> ${meeting.html()}`,
|
||||
url: resolution.find('a').attr('href'),
|
||||
guid: `scveto:${resolution.text()}`,
|
||||
pubDate: new Date(date.text()).toISOString(),
|
||||
};
|
||||
|
||||
items.push(item);
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'United Nations Security Council Vetoed Resolutions',
|
||||
link: 'http://research.un.org/en/docs/sc/quick/veto',
|
||||
description:
|
||||
'The United Nations Security Council "veto power" refers to the power of the permanent members of the UN Security Council (China, France, Russia, United Kingdom, and United States) to veto any "substantive" resolution. Aka, abuse of power.',
|
||||
item: items.map((item) => ({
|
||||
title: item.title,
|
||||
description: item.desc,
|
||||
link: item.url,
|
||||
guid: item.guid,
|
||||
pubDate: item.pubDate,
|
||||
})),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user