fix: list timeline pagination (#30) (thanks @zheli)

This commit is contained in:
Peter Steinberger
2026-01-11 11:27:46 +00:00
parent ebcd1618f9
commit 6cf177f92f
11 changed files with 1751 additions and 1506 deletions
+3 -1
View File
@@ -458,19 +458,21 @@ export function withLists<TBase extends AbstractConstructor<TwitterClientBase>>(
}
pagesFetched += 1;
let added = 0;
for (const tweet of page.tweets) {
if (seen.has(tweet.id)) {
continue;
}
seen.add(tweet.id);
tweets.push(tweet);
added += 1;
if (!unlimited && tweets.length >= limit) {
break;
}
}
const pageCursor = page.cursor;
if (!pageCursor || pageCursor === cursor || page.tweets.length === 0) {
if (!pageCursor || pageCursor === cursor || page.tweets.length === 0 || added === 0) {
nextCursor = undefined;
break;
}