Search code examples
pythontwitter

Building script to access public Twitter data, without authentication


I would like to write a script in Python to read a public Twitter profile. Specifically, I'd like to check for Tweets with images, and download those images (eventually, I'd like to add this as a cron job). I was looking into tweepy as a Twitter API wrapper. However, from what I understand, the Twitter API requires authentication even for actions that access public data - is that correct?

Since all I need is to access a single public user timeline, going through the rigmarole of authenticating (and then having those credentials sitting on my computer in I'm not sure how secure a form) seems a little overkill.

Are there other solutions out there (particularly Python-based) for reading public Twitter data?


Solution

  • Yes, Twitter does require, authentication to access any public/private data of user. You need to create an app on Twitter to access the data. The app is required to keep a check on the number of requests, etc. made by a particular client, to prevent any abuse. This authentication is a general process followed by other API providers as well and this is the only recommended way.

    Another advantage of creating a Twitter App is that other users can give permissions to your app and then you can access their private data as well such as DM, etc.

    Another approach is web-scraping, but I would consider it as unethical as twitter is already providing it's API. Also you would need to update your scraping script each time there is some front end change by the Twitter developers.