Photo by Alexander Shatov on Unsplash

A Short guide to getting unlimited tweets by Python without a Twitter API

Abdulraqib Omotosho

--

Social media is one of the richest sources of real-world data and this doesn’t exempt twitter. Everyday many thousands of developers make requests to the Twitter API. To manage the sheer volume of requests, Twitter has placed limits on the number of requests that can be made. This has in turn led to the API having some limitations including the ability to get not more than 3200 user tweets or even getting tweets that are just seven days old. I would teach you how to get Unlimited tweets without the API using a special python library called snscrape.snscrape means social networking scrape which means it is not just limited to twitter. It also be used on other social media networks like Instagram, Facebook, Mastodon, Reddit, Weibo and the Russian networking site, VKontakte. Without further ado, lets get to business.Installation

python -m pip install snscrape

Now, I will import the required libraries to use.

Let start with user tweets of a limit of 100

This print outs information about the query including URL, content, date, user, tweets, etc.

Next, I’ll extract the Date, User and Tweet from the query and then convert it to a pandas dataframe.

Exporting to a pandas dataframe
The dataframe

Next, let’s try make a query of over 10,000 tweets. I will extract info from the account of Twitter’s founder, Jack Dorsey over a course of time.

pandas dataframe

So this is a short guide on how to get unlimited tweets with snscrape without making use of the Twitter API. Thanks for reading. If you like this, like and give a follow. Cheers! You can also follow me on GitHub.

--

--

Abdulraqib Omotosho

Passionate Data Enthusiast & Computer Engineering student. Skilled in data analysis, modeling, and programming. Sharing insights on Medium.