fix: guard pagination limits (#44) (thanks @jsholmes)

This commit is contained in:
Peter Steinberger
2026-01-12 07:07:47 +00:00
parent bc744a3bf9
commit afa7063a72
5 changed files with 79 additions and 5 deletions
+1 -1
View File
@@ -209,7 +209,7 @@ export function withSearch<TBase extends AbstractConstructor<TwitterClientBase>>
return { success: false as const, error: firstAttempt.error };
};
const unlimited = !Number.isFinite(limit);
const unlimited = limit === Number.POSITIVE_INFINITY;
while (unlimited || tweets.length < limit) {
const pageCount = unlimited ? pageSize : Math.min(pageSize, limit - tweets.length);
const page = await fetchWithRefresh(pageCount, cursor);