From 8fbd184e5b47024771d8833cf5e9f866ec6d2dba Mon Sep 17 00:00:00 2001 From: JimenezLi <75196426+JimenezLi@users.noreply.github.com> Date: Tue, 29 Aug 2023 00:25:08 +0800 Subject: [PATCH] fix(route): fix nytimes paragraph (#13146) --- lib/v2/nytimes/index.js | 5 +---- lib/v2/nytimes/utils.js | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/v2/nytimes/index.js b/lib/v2/nytimes/index.js index c3ecc4d14f..3b15298409 100644 --- a/lib/v2/nytimes/index.js +++ b/lib/v2/nytimes/index.js @@ -81,10 +81,7 @@ module.exports = async (ctx) => { // Match 感谢|謝.*?cn.letters@nytimes.com。 const ending = /感(谢|謝);.*?cn\.letters@nytimes\.com。/g; - const matching = '
'; - const formatted = '
' + matching; - - single.description = result.description.replace(ending, '').split(matching).join(formatted); + single.description = result.description?.replace(ending, ''); if (hasEnVersion) { single.title = result.title; diff --git a/lib/v2/nytimes/utils.js b/lib/v2/nytimes/utils.js index 2f818b043d..ccaf42ed5e 100644 --- a/lib/v2/nytimes/utils.js +++ b/lib/v2/nytimes/utils.js @@ -79,6 +79,11 @@ const ProcessFeed = (data, hasEnVersion = false) => { $(e).remove(); }); + // divide paragraphs with

+ content.find('div.article-paragraph').each((i, e) => { + $(e).html(`

${$(e).html()}

`); + }); + if ($('figure.article-span-photo').length > 0) { // there is a cover photo const cover = $('figure.article-span-photo');