Giter Site home page Giter Site logo

twitter_media_downloader's Introduction

Twitter media downloader

GitHub issues Build status Code Coverage Project license

About

Downloads all videos and images from a Twitter account.

Supports downloading an user's tweets, retweets, and likes.

Usage

twitter_media_downloader.py [-h] [-o DIR] [-f FORMAT] [-s IMAGE_SIZE] [-r] [-u] [-q] userid [...]

On first run, the program will ask you for your OAuth consumer key and consumer secret. It will then be stored in a .oauth.json file so that you don't need to enter them every single time. It will also ask your access token and access token secret. Those are only required if you are planning to access protected accounts.

Arguments

  • userid: the account name or ID (1 or more), if it starts with a @ it will be opened as a file (one account per line)
  • -h, --help: show the help and exit
  • -o DIR, --output DIR: set the output directory where medias will be downloaded
  • -f FORMAT, --format FORMAT: the filename format, see below for the available tokens to use
  • -s IMAGE_SIZE, --image-size IMAGE_SIZE: the preferred image size to download, will fallback to the default size if not available
  • --since DATE: the start date of the search, accepted formats: YYYY-mm-dd HH:MM and YYYY-mm-dd (defaults to 00:00)
  • --since-id ID: the start ID of the search (exclusive)
  • --until DATE: the end date of the search, accepted formats: YYYY-mm-dd HH:MM and YYYY-mm-dd (defaults to 00:00)
  • --until-id ID: the end ID of the search (inclusive)
  • -r, --retweets: also download medias from retweets
  • -l, --likes: download an user's likes instead of its tweets
  • -u, --userid: append the userid to the output directory
  • -q, --quiet: disable output

Example

python twitter_media_downloader.py -o out -f "[%date%] %filename%.%ext%" -s large -u Twitter

Will download all of the Twitter account media files into the out/Twitter/ directory, each file named like [2017-01-11 05-56-33] C13U6d-VQAAVKeY.jpg.

Available tokens for format

  • tweet_id: the tweet identifier (original_tweet_id for retweets)
  • date: the tweet post date (original_date for retweets)
  • user_id: the tweet author ID (original_user_id for retweets)
  • user_name: the tweet author name (original_user_name for retweets)
  • user_screen_name: the tweet author screen name / username (original_user_screen_name for retweets)
  • filename: the file filename on the server
  • ext: the file extension
  • type: "tweet" or "retweet"

Authors

License

The program is licensed under the Apache License 2.0.

twitter_media_downloader's People

Contributors

spark-nf avatar ashtenhamilton avatar dcnetw0rk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.