From 8d7102af6107619278e90bddb27c8b96b00a834f Mon Sep 17 00:00:00 2001 From: zhshch2002 <29043215+zhshch2002@users.noreply.github.com> Date: Mon, 19 Aug 2019 16:43:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(juejin):=20=E6=97=B6=E5=8C=BA=E9=81=97?= =?UTF-8?q?=E7=95=99=E9=97=AE=E9=A2=98=EF=BC=8C=E8=A1=A5=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=20(#2880)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(bilibili):输出author标签为视频作者 * fix(juejin):时区转化问题 * fix(juejin):时区遗留问题,补注释 Co-authored-by: zhshch --- lib/routes/juejin/utils.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/routes/juejin/utils.js b/lib/routes/juejin/utils.js index 3435a275b..fa8586885 100644 --- a/lib/routes/juejin/utils.js +++ b/lib/routes/juejin/utils.js @@ -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(/()/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); // 列表上提取到的信息