From e7b22f7684c7a03436977bd60f9e7ce42cd807c0 Mon Sep 17 00:00:00 2001 From: Ir1dXD Date: Sat, 5 May 2018 19:30:29 +0800 Subject: [PATCH] Fix #78 update link for zhihu collections --- routes/zhihu/collection.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/routes/zhihu/collection.js b/routes/zhihu/collection.js index 4e0c3b33f..c3375b48a 100644 --- a/routes/zhihu/collection.js +++ b/routes/zhihu/collection.js @@ -27,11 +27,13 @@ module.exports = async (ctx) => { lastBuildDate: new Date().toUTCString(), item: list && list.map((index, item) => { item = $(item); + let linkUrl = item.find('.zm-item-title a').attr('href'); + if (linkUrl.startsWith('/')) linkUrl = 'https://www.zhihu.com' + linkUrl; return { title: item.find('.zm-item-title a').text(), description: `内容:${item.find('textarea').text()}`, - link: `https://www.zhihu.com${item.find('.zm-item-title a').attr('href')}` + link: linkUrl }; }).get(), }); -}; \ No newline at end of file +};