mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-16 21:02:57 +08:00
fix(route/zhihu): handle empty user pins feeds (#23574)
This commit is contained in:
@@ -36,9 +36,14 @@ async function handler(ctx) {
|
||||
url: `https://api.zhihu.com/pins/${id}/moments?limit=10&offset=0`,
|
||||
});
|
||||
|
||||
if (!Array.isArray(data)) {
|
||||
throw new TypeError('Zhihu pins API returned an invalid data list');
|
||||
}
|
||||
|
||||
return {
|
||||
title: `${data[0].target.author.name}的知乎想法`,
|
||||
title: `${data.length ? data[0].target.author.name : id}的知乎想法`,
|
||||
link: `https://www.zhihu.com/people/${id}/pins`,
|
||||
item: generateData(data),
|
||||
allowEmpty: data.length === 0,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user