fix(route): 环球网 Pubdate (#10826)

This commit is contained in:
Ethan Shen 2022-09-19 17:43:29 +08:00 committed by GitHub
parent 567df08399
commit b273cf0750
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -1,7 +1,6 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
function getKeysRecursive(dic, key, attr, array) {
Object.values(dic).forEach((v) => {
@ -47,9 +46,12 @@ module.exports = async (ctx) => {
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('textarea.article-content').text();
item.author = content('span', '.source').text();
item.pubDate = timezone(parseDate(content('p.time').text()), +8);
item.pubDate = parseDate(parseInt(content('textarea.article-time').text()));
item.category = content('meta[name="keywords"]').attr('content').split(',');
return item;
})
)