Skip to main content

Twitter image downloader

Project description

CircleCI

What it does

Download all images uploaded by a specified Twitter user.

What you need

  • Python 3 (>= 3.7)

Setup

First, you need to install twitter-image-dl:

$ pip install twitter-image-dl

Next, you need to generate your api key and api secret key. If you don't have them, go to Twitter Developers and create your application. After you get your api key and api secret key, create a json file like this:

{
  "api_key": "your api key",
  "api_secret": "your api secret key"
}

Usage

To download the images the user of id "foo" has uploaded, enter the command like the following on the command line:

$ twt_img foo -c confidentials.json

where confidentials.json is the json file containing your api keys. This command creates a directory called foo and save images to that directory.

If you want to save images to a directory other than foo, use -d or --dest argument to specify the destination.

You can specify which size of images to download using the optional argument -s (or --size). There are five values you can specify:

  • large
  • medium
  • small
  • orig
  • thumb

If you don't specify this value, images of large size will be downloaded by default.

Using the --rts flag, you can also download images contained in retweets.

Provide a number to the -l or --limit argument (e.g. -l 25) to limit how many tweets are inspected for images (starting with the most recent). Note that if you're using --limit without --rts, the number of tweets inspected can be smaller than the specified limit.

Testing

Install dependencies for testing and run tests like this:

$ gi clone git@github.com:morinokami/twitter-image-downloader.git
$ cd twitter-image-downloader
$ pipenv install --dev
$ pipenv run test

Notice that you have to set KEY and SECRET environment variables for testing to work.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twitter-image-dl-0.2.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twitter_image_dl-0.2.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file twitter-image-dl-0.2.1.tar.gz.

File metadata

  • Download URL: twitter-image-dl-0.2.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0

File hashes

Hashes for twitter-image-dl-0.2.1.tar.gz
Algorithm Hash digest
SHA256 054460b54594ad3cd41d13ba71093f42502ac297aaedf7073888ddd7ae68e434
MD5 186bda7a4e623e79e26c54e9f9fdc073
BLAKE2b-256 989a20d2675b3528ecc5e44cc7cf66ec63b6decd87a6b20747406c6054536ade

See more details on using hashes here.

File details

Details for the file twitter_image_dl-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: twitter_image_dl-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0

File hashes

Hashes for twitter_image_dl-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2c47b9b9d6876e4f7ce840858e9db789f8445a13a7547971654153321103e8ef
MD5 e910bc12e2b028f77333c86fbcb389f4
BLAKE2b-256 731b951512304b2d2fbbacebb466eac29b90ddcf8136e4223f2e51448f3310e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page