From 135cbfffeabadf80ad307fdbf6424a56a108a3b2 Mon Sep 17 00:00:00 2001 From: Neko Aria <990879119@qq.com> Date: Thu, 1 Sep 2022 22:42:11 +0800 Subject: [PATCH] fix(route): fix zhihu/posts title (#10672) --- lib/v2/zhihu/posts.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/v2/zhihu/posts.js b/lib/v2/zhihu/posts.js index 74ce0c149..fed662852 100644 --- a/lib/v2/zhihu/posts.js +++ b/lib/v2/zhihu/posts.js @@ -18,7 +18,8 @@ module.exports = async (ctx) => { const data = response.data; const $ = cheerio.load(data); const jsondata = $('#js-initialData'); - const authorname = $('.ProfileHeader-name').text(); + const authorname = $('.ProfileHeader-name').contents() + .filter((_index, element) => element.type === 'text').text(); const authordescription = $('.ProfileHeader-headline').text(); const parsed = JSON.parse(jsondata.html());