fix(route): dapenti/tugua pubDate and author (#8141)

This commit is contained in:
Tony 2021-09-09 16:39:02 +08:00 committed by GitHub
parent e24906fdeb
commit 00162ddaf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,8 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const iconv = require('iconv-lite');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
module.exports = {
parseFeed: async ({ subjectid }) => {
@ -38,6 +40,7 @@ module.exports = {
const description = cheerio.load(convert_data, {
decodeEntities: false,
})('body > table > tbody > tr > td.oblog_t_2 > div > table > tbody > tr:nth-child(2) > td');
const pubInfo = description.find('span span.oblog_text').text().split('发布于');
description.find('table, .adsbygoogle').remove();
// remove header
@ -52,10 +55,12 @@ module.exports = {
}
const single = {
title: el.text(),
author: pubInfo[0].trim(),
description: description.html(),
pubDate: timezone(parseDate(pubInfo[1].trim()), +8),
link: url,
};
return Promise.resolve(single);
return single;
})
);