fix(route): reuters return fulfilled promises (#13730)
* fix: reuters return fulfilled promises * fix: remove deprecated routes and migration prompt
This commit is contained in:
parent
cc11b9661b
commit
9c13eb9aed
|
|
@ -72,7 +72,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
items = items.filter((e, i) => items.findIndex((f) => e.guid === f.guid) === i);
|
||||
|
||||
items = await Promise.all(
|
||||
const results = await Promise.allSettled(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got(item.link);
|
||||
|
|
@ -124,6 +124,7 @@ module.exports = async (ctx) => {
|
|||
})
|
||||
)
|
||||
);
|
||||
items = results.filter((r) => r.status === 'fulfilled').map((r) => r.value);
|
||||
|
||||
ctx.state.data = {
|
||||
title,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
module.exports = {
|
||||
'/investigates': ['LyleLee'],
|
||||
'/reuters/channel/:site/:channel': ['LyleLee'], // deprecated
|
||||
'/reuters/theWire': ['LyleLee'], // deprecated
|
||||
'/:category/:topic?': ['LyleLee', 'HenryQW', 'proletarius101', 'black-desk', 'nczitzk'],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = () => {
|
||||
throw Error('The route has been deprecated. Please refer to <a href="https://docs.rsshub.app/routes/traditional-media#lu-tou-she">the docs</a> for more details.');
|
||||
};
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/channel/:site/:channel', require('./migration_prompt')); // deprecated
|
||||
router.get('/theWire', require('./migration_prompt')); // deprecated
|
||||
router.get('/investigates', require('./investigates'));
|
||||
router.get('/:category/:topic?', require('./common'));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -511,15 +511,12 @@ Parameters can be obtained from the official website, for instance:
|
|||
|
||||
## Reuters 路透社 {#reuters-lu-tou-she}
|
||||
|
||||
:::warning Migration notes
|
||||
|
||||
1. Reuters Chinese site (`cn.reuters.com`) and British site (`uk.reuters.com`) have been terminated, redirecting to the main site (`www.reuters.com`)
|
||||
2. The old routes are deprecated. Please migrate to the new routes documented below
|
||||
|
||||
:::
|
||||
:::tip
|
||||
|
||||
You can use `sophi=true` query parameter to invoke the **experimental** method, which can, if possible, fetch more articles(between 20 and 100) with `limit` given. But some articles from the old method might not be available.
|
||||
|
||||
:::
|
||||
|
||||
### Category/Topic/Author {#reuters-lu-tou-she-category-topic-author}
|
||||
|
||||
<Route author="HenryQW proletarius101 LyleLee nczitzk" example="/reuters/world/us" path="/reuters/:category/:topic?" paramsDesc={['find it in the URL, or tables below', 'find it in the URL, or tables below']}>
|
||||
|
|
|
|||
Loading…
Reference in New Issue