This tutorial explains how to download photos from any Twitter account from command line. There is a free command line utility called Twitter-Photo-Downloader which lets you do this in an easy way. All you have to do is, specify the twitter handle of the target user and number of images to download from his account.
The command line tool about which I will talk about in this tutorial requires Python available on your PC. Being written in Python, you will be able to use this tool on every platform including Mac, Linux, etc.
There are some GUI based Twitter image downloader available to do the same, but if you want to download Twitter photos from any Twitter account from command line, then this software is a good way to go.
How to Download Photos from any Twitter Account from Command Line?
Twitter-Image-Downloader is quite a unique tool to download photos from any Twitter account. You only need the Twitter username of the person from whose account you want to get photos. The tool actually reads the tweets of the user sequentially from newer to older. And if it encounters any photo in the tweet, then it grabs that image and downloads it to your PC.
It creates a separate folder for Twitter photos of each twitter handle. You can download any number of images from a Twitter account.
Here are steps to download images from any Twitter account from command line:
Step 1: Download the ZIP package of Twitter-Image-Downloader from its GitHub page. After that, extract its contents.
Step 2: Create an app on Twitter using Twitter apps. Click on Create New App and then after that fill out all the fields that it asks you to fill.
Step 3: After that, move to the Keys and Access token section copy the API credentials. From this page, you will see Consumer key, Consumer Secret, Access Key, Access Secret.
Step 4: Now get back to the folder where you have extracted the contents of the ZIP file during step 1. Locate the API_Tokens.py file an open it with any text editor. Now, copy-paste the respective keys in the double quotes in the file and save changes.
Step 5: Now, open the command prompt and type the following commands one after another (these commands will work only if you have Python installed on your PC).
pip install tweepy
pip install wget
Step 6: After successful execution of the above commands, you can start downloading images from Twitter. Open command prompt in the same folder where you extracted the ZIP file of Twitter-Images-Downloader.
Step 7: Run this command:
It will ask you to enter the Twitter handle of the target user. After that, it will ask you to enter the number of images to retrieve from the account of the user. You can type any number. To download all the images from that twitter handle, specify “0”.
It will start downloading images and will place them inside a twiter_images folder that it will create in the directory where the command prompt is running. Inside that folder, it will create folder with the name same as twitter handle whose images you are trying to download.
If you want to download Twitter images from Twitter account of any user, Twitter-Image -Downloader is one of the best tool to do that. I really like the fact that I can specify number of images I want to download, and can download all images as well. Also, the fact that it can be used to download twitter images from any twitter account makes it pretty useful. So, if you have such a need to download twitter images, do try out this tool.