fix: jianshu can't get fulltext and pubDate (#3104)

This commit is contained in:
Cloud
2019-09-18 10:58:46 +08:00
committed by DIYgod
parent 9755975629
commit b82e8fe713
+2 -6
View File
@@ -8,11 +8,7 @@ async function load(link) {
const $ = cheerio.load(response.data);
// 解析日期
const date = new Date(
$('.publish-time')
.text()
.match(/\d{4}.\d{2}.\d{2} \d{2}:\d{2}/)
);
const date = new Date($('time').attr('datetime'));
const timeZone = 8;
const serverOffset = date.getTimezoneOffset() / 60;
const pubDate = new Date(date.getTime() - 60 * 60 * 1000 * (timeZone + serverOffset)).toUTCString();
@@ -31,7 +27,7 @@ async function load(link) {
`);
});
// 提取内容
const description = $('.show-content-free').html();
const description = $('article').html();
return { description, pubDate };
}