A python twitter scraper with no-api keys required.
Installation
pip3 install tweetlib
How to use it
All these parameters can be used in combination with one another.
ts = tweetlib.TweetLib(username="barackobama", max_tweets=10)
Arguments
- username(str): any valid twitter name you want to scrape
- since("yyyy-mm-dd"): A lower bound date to restrict search.
- until("yyyy-mm-dd"):An upper bound date to restrict search.
- query_search(str): Search string
- max_tweets(int): Max number of tweets you want to scrape.
Examples
from tweetlib import tweetlib
ts = tweetlib.TweetLib(username="barackobama", max_tweets=10)
tweets = ts.get_tweets()
ts = tweetlib.TweetLib(query_search="college", since="2018-01-01")
tweets = ts.get_tweets()
The tweet objects it returns in the list contain the following:
tweet = {
id (str)
permalink (str)
username (str)
text (str)
date (date)
replies (int)
retweets (int)
favorites (int)
mentions (str)
hashtags (str)
}
Credit and Contact
Created by Wyatt Ferguson
For any comments or questions your can reach me on Twitter @wyattferguson or visit my little portfolio at wyattf.dev