fix(juejin): 时区遗留问题,补注释 (#2880)

* fix(bilibili):输出author标签为视频作者

* fix(juejin):时区转化问题

* fix(juejin):时区遗留问题,补注释


Co-authored-by: zhshch <zhshch-bin@foxmail.com>
This commit is contained in:
zhshch2002
2019-08-19 16:43:14 +08:00
committed by DIYgod
parent e72c5b76b1
commit 8d7102af61

View File

@@ -13,10 +13,10 @@ async function load(link) {
const $ = cheerio.load(response.data);
// 解析日期
const date = new Date($('time').attr('datetime'));
const timeZone = 8 * 60;
const serverOffset = date.getTimezoneOffset();
const pubDate = new Date(date.getTime() + 60 * 1000 * (timeZone + serverOffset)).toUTCString();
//const date = new Date($('time').attr('datetime'));
//const timeZone = 8 * 60;
//const serverOffset = date.getTimezoneOffset();
//const pubDate = new Date(date.getTime() + 60 * 1000 * (timeZone + serverOffset)).toUTCString();
// 提取内容
const description = $('.article-content')
@@ -24,12 +24,13 @@ async function load(link) {
.replace(/[\x00-\x08\x0b-\x0c\x0e-\x1f\x7f]/g, '')
.replace(/(<img.*?)(data-src)(.*?>)/g, '$1src$3');
return { description, pubDate };
return { description };
}
const ProcessFeed = async (list, caches) =>
await Promise.all(
list.map(async (item) => {
//解析时间补偿时区offset
const pubdate = new Date();
pubdate.setTime(Date.parse(item.createdAt) - 8 * 60 * 60 * 1000);
// 列表上提取到的信息