mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
fix: zhihu collection some link is # (#2782)
* fix: zhihu collection some link is # * fix: zhihu collection some link is #
This commit is contained in:
@@ -16,7 +16,7 @@ module.exports = async (ctx) => {
|
||||
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('div.zm-item');
|
||||
const list = $('.zm-item');
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
@@ -26,17 +26,13 @@ module.exports = async (ctx) => {
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
let linkUrl = item
|
||||
.find('a.meta-item')
|
||||
.not('a.toggle-comment')
|
||||
.attr('href');
|
||||
if (linkUrl.startsWith('/')) {
|
||||
linkUrl = 'https://www.zhihu.com' + linkUrl;
|
||||
}
|
||||
const $item = $(item);
|
||||
const $title = $item.find('.zm-item-title>a');
|
||||
const linkUrl = $item.find('[itemprop="url"]').attr('href');
|
||||
|
||||
return {
|
||||
title: item.find('.zm-item-title a').text(),
|
||||
description: utils.ProcessImage(item.find('textarea').text()),
|
||||
title: $title.text(),
|
||||
description: utils.ProcessImage($item.find('textarea').text()),
|
||||
link: linkUrl,
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user