From ce15d05215300c55d72941e955ee64c4e0c3a855 Mon Sep 17 00:00:00 2001 From: Raidou Date: Thu, 12 Aug 2021 16:04:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(route):=20=E8=85=BE=E8=AE=AF=E8=BE=83?= =?UTF-8?q?=E7=9C=9F=E6=9F=A5=E8=AF=81=E5=B9=B3=E5=8F=B0=20(#7934)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/routes/tencent/factcheck/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/routes/tencent/factcheck/index.js b/lib/routes/tencent/factcheck/index.js index bd05b00cba890e..8f3a4903b3724e 100644 --- a/lib/routes/tencent/factcheck/index.js +++ b/lib/routes/tencent/factcheck/index.js @@ -1,10 +1,19 @@ const got = require('@/utils/got'); +const { parseDate } = require('@/utils/parse-date'); const cheerio = require('cheerio'); +const CryptoJS = require('crypto-js'); + +const getRequestToken = () => { + const t = 'jzhotdata', + e = 'sgn51n6r6q97o6g3', + n = CryptoJS.DES.encrypt(Date.now().toString() + '-' + e, t).toString(); + return encodeURIComponent(n); +}; module.exports = async (ctx) => { const response = await got({ method: 'get', - url: 'https://vp.fact.qq.com/loadmore?artnum=0&page=0', + url: `https://vp.fact.qq.com/loadmore?artnum=0&page=0&token=${getRequestToken()}`, headers: { Referer: 'https://vp.fact.qq.com/home', }, @@ -18,8 +27,8 @@ module.exports = async (ctx) => { const simple = { title: `【${item.explain}】${item.title}`, description: `${item.abstract}`, - pubDate: new Date(item.date).toUTCString(), - author: `${item.author}${item.author !== item.authordesc ? '-' + item.authordesc : ''}`, + pubDate: parseDate(item.date, 'YYYY-MM-DD'), + author: item.author, link: link, };