Skip to content


Francesco Poldi edited this page Jun 13, 2019 · 11 revisions


Command Usage
-u, --username User's Tweets you want to scrape.
-s, --search Search for Tweets containing this word or phrase.
-g, --geo Search for geocoded Tweets.
--near Near a specified city.
--location Show user's location (Experimental).
-l, --lang Search for Tweets in a specific language (See language codes).
-o, --output Save output to a file.
-es, --elasticsearch Index to Elasticsearch.
-t, --timedelta Time interval for every request.
--year Filter Tweets before specified year.
--since Filter Tweets sent since date (Example: 2017-12-27).
--until Filter Tweets sent until date (Example: 2017-12-27).
--email Filter Tweets that might have email addresses.
--phone Filter Tweets that might have phone numbers.
--verified Display Tweets only from verified users (Use with -s).
--csv Write as .csv file.
--json Write as .json file.
--hashtags Output hashtags in seperate column.
--userid Twitter user id.
--limit Number of Tweets to pull (Increments of 20).
--count Display number of Tweets scraped at the end of session.
--stats Show number of replies, retweets, and likes.
-db, --database Store Tweets in a sqlite3 database.
--to Search Tweets to a user.
--all Search all Tweets associated with a user.
--followers Scrape a person's followers.
--following Scrape a person's follows.
--favorites Scrape Tweets a user has liked.
--proxy-type Socks5, HTTP, etc.
--proxy-host Proxy hostname or IP.
--proxy-port The port of the proxy server.
--essid Elasticsearch Session ID, use this to differentiate scraping sessions.
--userlist Userlist from list or file.
--retweets Include user's Retweets (Warning: limited).
--format Custom output format (See wiki for details).
--user-full Collect all user information (Use with followers or following only).
--profile-full Slow, but effective method of collecting a user's Tweets and RT.
--store-pandas Save Tweets in a DataFrame (Pandas) file.
--pandas-type Specify HDF5 or Pickle (HDF5 as default).
-it, --index-tweets Custom Elasticsearch Index name for Tweets.
-if, --index-follow Custom Elasticsearch Index name for Follows.
-iu, --index-users Custom Elasticsearch Index name for Users.
-dt, --doc-type Custom Elasticsearch document type.
--debug Store information in debug logs.
--resume Resume from Tweet ID.
--videos Display only Tweets with videos.
--images Display only Tweets with images.
--media Display Tweets with only images or videos.
--replies Display replies to a subject.
-pc, --pandas-clean Automatically clean Pandas dataframe at every scrape.
--get-replies All replies to the tweet.
-pt, --popular-tweets Scrape popular tweets instead of recent ones.
-sc, --skip-certs Skip certs verification, useful for SSC.

If you would like to use Tor proxy, just type --proxy-host tor instead of --proxy-host localhost --proxy-type socks5 --proxy-port 9050.

--userlist arg will overwrite --username arg.

Basic Examples and Combos.

A few simple examples to help you understand the basics:

  • python3 -u username - Scrape all the Tweets from user's timeline.
  • python3 -u username -s pineapple - Scrape all Tweets from the user's timeline containing pineapple.
  • python3 -s pineapple - Collect every Tweet containing pineapple from everyone's Tweets.
  • python3 -u username --year 2014 - Collect Tweets that were tweeted before 2014.
  • python3 -u username --since 2015-12-20 - Collect Tweets that were tweeted since 2015-12-20.
  • python3 -u username -o file.txt - Scrape Tweets and save to file.txt.
  • python3 -u username -o file.csv --csv - Scrape Tweets and save as a csv file.
  • python3 -g="48.880048,2.385939,1km" -o file.csv --csv - Scrape Tweets from a radius of 1km around a place in Paris and export them to a csv file.
  • python3 -u username -es localhost:9200 - Output Tweets to Elasticsearch
  • python3 -u username -o file.json --json - Scrape Tweets and save as a json file.
  • python3 -u username --database tweets.db - Save Tweets to a SQLite database.
  • python3 -u username --followers - Scrape a Twitter user's followers.
  • python3 -u username --following - Scrape who a Twitter user follows.
  • python3 -u username --favorites - Collect all the Tweets a user has favorited.
Clone this wiki locally
You can’t perform that action at this time.