the-convocation / twitter-scraper

A port of n0madic/twitter-scraper to Node.js.
https://the-convocation.github.io/twitter-scraper/
MIT License
214 stars 43 forks source link

Thousands of missing tweets #90

Open Tarrgon opened 5 months ago

Tarrgon commented 5 months ago

I'm unsure if I'm using this tool wrong, but I'm trying to fetch basically every tweet from a user. When I do this, though, I'm only getting 829 tweets, of their 42,000. Added logs to the module directly showing that getTweetTimeline has an empty array tweets that breaks out of the function.

Is there any way to get more tweets than this?

For reference, here's the code:

for await (let tweet of twitterScraper.getTweets(identifier, Number.MAX_SAFE_INTEGER)) {
   // ...
}

There's no exhausted auth or anything, just runs out of tweets for seemingly no reason.

Tarrgon commented 5 months ago

I should add that

tweets = twitterScraper.searchTweets(`(from:${identifier})`, Number.MAX_SAFE_INTEGER, SearchMode.Latest)

seems to go past 1000 just fine.

Tarrgon commented 5 months ago

I should add that

tweets = twitterScraper.searchTweets(`(from:${identifier})`, Number.MAX_SAFE_INTEGER, SearchMode.Latest)

seems to go past 1000 just fine.

However, sometimes it just doesn't fetch everything for some reason, but probably something to do with the times when it just doesn't load

catdevnull commented 4 months ago

It seems that Twitter/X cuts off timelines like those after a certain (unknown?) point. We can abuse the search API to get tweets from someone, but note that it doesn't include retweets. See here: https://socialdata.gitbook.io/docs/twitter-tweets/retrieve-search-results-by-keyword#using-search-operators