fix(route): reuters (#12702)
This commit is contained in:
parent
cdd1170056
commit
d6478759ac
|
|
@ -38,6 +38,19 @@ module.exports = async (ctx) => {
|
|||
const detailResponse = await got(item.link);
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
if (detailResponse.url.startsWith('https://www.reuters.com/investigates/')) {
|
||||
const ldJson = JSON.parse(content('script[type="application/ld+json"]').text());
|
||||
content('.special-report-article-container .container, #slide-dek, #slide-end, .share-in-article-container').remove();
|
||||
|
||||
item.title = ldJson.headline;
|
||||
item.pubDate = parseDate(ldJson.dateCreated);
|
||||
item.author = ldJson.creator;
|
||||
item.category = ldJson.keywords;
|
||||
item.description = content('.special-report-article-container').html();
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
const data = JSON.parse(
|
||||
content('script#fusion-metadata')
|
||||
.text()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ const { parseDate } = require('@/utils/parse-date');
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://www.reuters.com';
|
||||
const currentUrl = `${rootUrl}/investigates`;
|
||||
const currentUrl = `${rootUrl}/investigates/`;
|
||||
const response = await got(currentUrl);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
|
|
|||
Loading…
Reference in New Issue