From 12cb9b0e3db951e6bdc8b7aac3794aa87dae37da Mon Sep 17 00:00:00 2001 From: Henry Wang Date: Wed, 27 Feb 2019 02:54:29 +0000 Subject: [PATCH] fix: remove multiple
(#1624) close #1620 --- lib/routes/weibo/user2.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/routes/weibo/user2.js b/lib/routes/weibo/user2.js index b31c284bb..b7a9ae7e1 100644 --- a/lib/routes/weibo/user2.js +++ b/lib/routes/weibo/user2.js @@ -25,17 +25,15 @@ module.exports = async (ctx) => { wb = {}; item = $(ele); titleEle = item.find('.wgtCell_txt'); - wb.title = titleEle - .text() - .replace(/^\s+|\s+$/g, '') - .replace(/\u200B/g, ''); + wb.title = titleEle.text().trim(); if (wb.title === '') { wb.title = '[图片]'; } wb.description = titleEle .html() - .replace(/^\s+|\s+$/g, '') - .replace(/(\r\n|\r|\n)/g, '
') + .trim() + .replace(/(\r\n|\r|\n)+/g, '
') + .replace(/(( ?)+
( ?)+){2,}/g, '') .replace(/thumbnail/, 'large'); wb.pubDate = date(item.find('.link_d').html(), 8); wb.link = item.find('.wgtCell_tm a').attr('href');