fix: paginate likes + avoid duplicate loops (#12) (thanks @titouv)

This commit is contained in:
Peter Steinberger
2026-01-11 10:31:47 +00:00
parent 7548fd5ed1
commit 2e03bd8c07
4 changed files with 245 additions and 2 deletions
+3 -2
View File
@@ -150,7 +150,7 @@ export function withTimelines<TBase extends AbstractConstructor<TwitterClientBas
};
};
errors?: Array<{ message: string }>;
};
};
const instructions = data.data?.user?.result?.timeline?.timeline?.instructions;
if (data.errors && data.errors.length > 0) {
@@ -181,7 +181,8 @@ export function withTimelines<TBase extends AbstractConstructor<TwitterClientBas
return firstAttempt;
}
const shouldRefresh =
firstAttempt.had404 || (typeof firstAttempt.error === 'string' && firstAttempt.error.includes('Query: Unspecified'));
firstAttempt.had404 ||
(typeof firstAttempt.error === 'string' && firstAttempt.error.includes('Query: Unspecified'));
if (shouldRefresh) {
await this.refreshQueryIds();
const secondAttempt = await fetchPage(pageCount, pageCursor);