From a223676969f56105fa93c21ba41dfb1a761d20da Mon Sep 17 00:00:00 2001 From: kimi360 Date: Wed, 8 May 2019 23:51:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BC=82=E6=AC=A1=E5=85=83=E8=BD=AF?= =?UTF-8?q?=E4=BB=B6=E4=B8=96=E7=95=8C=E7=9A=84=E6=A0=87=E9=A2=98=E5=8F=8A?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98=20(#2075?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/routes/iplay/utils.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/routes/iplay/utils.js b/lib/routes/iplay/utils.js index dbbf0871c..96c685957 100644 --- a/lib/routes/iplay/utils.js +++ b/lib/routes/iplay/utils.js @@ -18,9 +18,11 @@ async function load(link) { const serverOffset = date.getTimezoneOffset() / 60; const pubDate = new Date(date.getTime() - 60 * 60 * 1000 * (timeZone + serverOffset)).toUTCString(); // 提取详情 - const description = $('.entry-content').html(); + let description = $('.entry-content').html(); + // 去除data-srcset,srcset,将data-src替换成src以正常显示图片 + description = description.replace(/(data-){0,1}srcset="[\s\S]*?"/g, ''); + description = description.replace(/data-src/g, 'src'); return { description, pubDate }; - // return { description }; } const ProcessFeed = async (list, caches) => { @@ -28,7 +30,7 @@ const ProcessFeed = async (list, caches) => { return await Promise.all( list.map(async (item) => { const $ = cheerio.load(item); - const $title = $('a'); + const $title = $('.entry-title a'); // 还原相对链接为绝对链接 const itemUrl = url.resolve(host, $title.attr('href'));