mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-19 09:52:21 +08:00
fix: update zhihu collection selector (#4731)
This commit is contained in:
@@ -16,23 +16,26 @@ module.exports = async (ctx) => {
|
||||
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.zm-item');
|
||||
const list = $('.CollectionDetailPageItem');
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: `https://www.zhihu.com/collection/${id}`,
|
||||
description: `${$('#zh-fav-head-description').text()}`,
|
||||
description: $('.CollectionDetailPageHeader-description').text(),
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
const $item = $(item);
|
||||
const $title = $item.find('.zm-item-title>a');
|
||||
const linkUrl = $item.find('[itemprop="url"]').attr('href');
|
||||
const $title = $item.find('.ContentItem-title a');
|
||||
const linkUrl = new URL($title.attr('href'), 'https://www.zhihu.com/');
|
||||
const image = $item.find('meta[itemprop="image"]').attr('content');
|
||||
const text = $item.find('.CopyrightRichText-richText').text();
|
||||
const content = image ? text + `<img src="${image}">` : text;
|
||||
|
||||
return {
|
||||
title: $title.text(),
|
||||
description: utils.ProcessImage($item.find('textarea').text()),
|
||||
description: content,
|
||||
link: linkUrl,
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user