fix(route): reuters (#12702)

This commit is contained in:
Tony 2023-06-23 15:51:59 +04:00 committed by GitHub
parent cdd1170056
commit d6478759ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -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()

View File

@ -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);