Downloads images/photos uploaded on twitter from a given twitter handle.
This tool uses the Python tweepy library and wget package.
You can install requirements using requirements.txt
.
pip install -r requirements.txt
You will also need to create an app account on https://dev.twitter.com/apps to get authorization tokens
- Sign in with your Twitter account
- Create a new app.
- Fill necessary details
- Generate OAuth tokens for the app.
Following these steps and a successful app creation, you will recieve 3 tokens for your app, namely API_KEY
, API_KEY_SECRET
and BEARER_TOKEN
.
- Edit the
API_Tokens.py
file and add these tokens you recieved in the previous step and save.
- Run using
twitter_image_downloader.py [-h] [-H HANDLE] [-n [MAX_TWEETS]] [-t [{images,videos,gifs,all} ...]]
Examples:
python twitter_image_downloader.py --handle arsenal
python twitter_image_downloader.py --handle arsenal --max-tweets 10 --type images,gifs
- Run the script (
python twitter_image_downloader.py
). - Enter the user's twitter handle
(@<twitter_handle>)
you want to download images from, followed by max. number of tweets you want to search for. - The images are downloaded inside a folder named
twitter_images
, in the folder named<user_handle>
.
Example:
$ python twitter_image_downloader.py
Twitter Image Downloader:
========================
Enter the twitter handle of the Account to download media from: arsenal
Enter Max. number of tweets to search (default: 1000): 10
Enter type of media (images/gifs/videos/all) (default: images) gifs images
Fetching tweets.....
...