Saturday, August 29, 2020

Automated Image Downloads from Twitter

When I want to include screenshots from games on my Switch or PlayStation in my blog posts, my process is as follows:

  1. Take a screenshot on the console.
  2. Use the console to send a tweet with the image attached.
  3. Download the image from Twitter onto my PC via Chrome.
  4. Upload the image from my PC to Google Drive.
  5. Embed the image on Google Drive in the post.
The bottleneck in this process is Step 3. Twitter makes it a real pain in the ass to download full-size images through a web browser, so I decided to route around the problem and write a Python script to automate the process via the Twitter API. For any other Python developers out there, here is my solution:

https://drive.google.com/file/d/1rNSaH_ncibw4byvsd7uZmORupz6ppXKX/view?usp=sharing 

This program reads all of the tweets from a specified user, checks if any of them are new, then downloads any images attached to the new tweets. Of course, you'll need to specify your own Twitter API keys.

Enjoy!

No comments:

Post a Comment