Creates a new Scraper object.
Optional
options: Partial<ScraperOptions>Private
authPrivate
authPrivate
Optional
Readonly
optionsPrivate
tokenFetches list tweets from Twitter.
The list id
The maximum number of tweets to return.
Optional
cursor: stringThe search cursor, which can be passed into further requests for more results.
A page of results, containing a cursor that can be used in further requests.
Fetches profile followers from Twitter.
The user whose following should be returned
The maximum number of profiles to return.
Optional
cursor: stringThe search cursor, which can be passed into further requests for more results.
A page of results, containing a cursor that can be used in further requests.
Fetches following profiles from Twitter.
The user whose following should be returned
The maximum number of profiles to return.
Optional
cursor: stringThe search cursor, which can be passed into further requests for more results.
A page of results, containing a cursor that can be used in further requests.
Fetches profiles from Twitter.
The search query. Any Twitter-compatible query format can be used.
The maximum number of profiles to return.
Optional
cursor: stringThe search cursor, which can be passed into further requests for more results.
A page of results, containing a cursor that can be used in further requests.
Fetches tweets from Twitter.
The search query. Any Twitter-compatible query format can be used.
The maximum number of tweets to return.
The category filter to apply to the search. Defaults to Top
.
Optional
cursor: stringThe search cursor, which can be passed into further requests for more results.
A page of results, containing a cursor that can be used in further requests.
Private
getFetch the profiles that follow a user
The user whose followers should be returned
The maximum number of profiles to return.
An AsyncGenerator of profiles following the provided user.
Fetch the profiles a user is following
The user whose following should be returned
The maximum number of profiles to return.
An AsyncGenerator of following profiles for the provided user.
Fetches the most recent tweet from a Twitter user.
The user whose latest tweet should be returned.
Whether or not to include retweets. Defaults to false
.
The Tweet object or null
/undefined
if it couldn't be fetched.
Fetches liked tweets from a Twitter user. Requires authentication.
The user whose likes should be returned.
The maximum number of tweets to return. Defaults to 200
.
An AsyncGenerator of liked tweets from the provided user.
Fetches the first tweet matching the given query.
Example:
const timeline = scraper.getTweets('user', 200);
const retweet = await scraper.getTweetWhere(timeline, { isRetweet: true });
The AsyncIterable of tweets to search through.
A query to test all tweets against. This may be either an
object of key/value pairs or a predicate. If this query is an object, all
key/value pairs must match a Tweet for it to be returned. If this query
is a predicate, it must resolve to true
for a Tweet to be returned.
Fetches tweets from a Twitter user.
The user whose tweets should be returned.
The maximum number of tweets to return. Defaults to 200
.
An AsyncGenerator of tweets from the provided user.
Fetches tweets and replies from a Twitter user.
The user whose tweets should be returned.
The maximum number of tweets to return. Defaults to 200
.
An AsyncGenerator of tweets from the provided user.
Fetches tweets and replies from a Twitter user using their ID.
The user whose tweets should be returned.
The maximum number of tweets to return. Defaults to 200
.
An AsyncGenerator of tweets from the provided user.
Fetches tweets from a Twitter user using their ID.
The user whose tweets should be returned.
The maximum number of tweets to return. Defaults to 200
.
An AsyncGenerator of tweets from the provided user.
Fetches all tweets matching the given query.
Example:
const timeline = scraper.getTweets('user', 200);
const retweets = await scraper.getTweetsWhere(timeline, { isRetweet: true });
The AsyncIterable of tweets to search through.
A query to test all tweets against. This may be either an
object of key/value pairs or a predicate. If this query is an object, all
key/value pairs must match a Tweet for it to be returned. If this query
is a predicate, it must resolve to true
for a Tweet to be returned.
Private
handleLogin to Twitter as a real Twitter account. This enables running searches.
The username of the Twitter account to login with.
The password of the Twitter account to login with.
Optional
email: stringThe email to log in with, if you have email confirmation enabled.
Optional
twoFactorSecret: stringThe secret to generate two factor authentication tokens with, if you have two factor authentication enabled.
Fetches profiles from Twitter.
The search query. Any Twitter-compatible query format can be used.
The maximum number of profiles to return.
An AsyncGenerator of tweets matching the provided filter(s).
Fetches tweets from Twitter.
The search query. Any Twitter-compatible query format can be used.
The maximum number of tweets to return.
The category filter to apply to the search. Defaults to Top
.
An AsyncGenerator of tweets matching the provided filters.
An interface to Twitter's undocumented API.