fix(route/twitter): handle `timeline_v2` nested structure (#19428)

Co-authored-by: NekoAria <NekoAria@users.noreply.github.com>
This commit is contained in:
Neko Aria 2025-06-23 01:18:01 +08:00 committed by GitHub
parent 8abc00fe2e
commit d6ea75914f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -248,7 +248,9 @@ export const paginationTweets = async (endpoint: string, userId: number | undefi
return instructions.instructions;
}
const instructions = data?.user?.result?.timeline?.timeline?.instructions || data?.user?.result?.timeline?.timeline_v2?.instructions;
const userResult = data?.user?.result;
const timeline = userResult?.timeline?.timeline || userResult?.timeline?.timeline_v2 || userResult?.timeline_v2?.timeline;
const instructions = timeline?.instructions;
if (!instructions) {
logger.debug(`twitter debug: instructions not found in data: ${JSON.stringify(data)}`);
}