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

This commit is contained in:
Tony
2021-09-09 01:39:02 -07:00
committed by GitHub
parent e24906fdeb
commit 00162ddaf0
+6 -1
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;
})
);