This commit is contained in:
2025-05-05 22:41:18 +08:00
parent a412c09da0
commit 8891b196ba
12 changed files with 249 additions and 41 deletions

View File

@@ -344,7 +344,7 @@ class XhsClient {
const state = stateMatch[1].replace(/undefined/g, '""');
if (state !== '{}') {
const noteDict = transformJsonKeys(JSON.parse(state));
return noteDict.note.note_detail_map[noteId].note;
return { code: 0, data: noteDict.note.note_detail_map[noteId].note };
}
}
@@ -355,8 +355,12 @@ class XhsClient {
throw new DataFetchError(html);
} catch (error) {
console.error('Error fetching note:', error);
fs.writeFileSync('a.html', html);
throw error;
return {
code: 500,
msg: '请求失败',
error: error.message,
data: null,
};
}
}
/**