Skip to main content

A CLI tool to download media from bookmarked tweets.

Project description

Twitter-Archive

Action Status Python Versions PyPI Total LOC Code style: black

A CLI Python application to download all media (and hopefully more) from bookmarked tweets (for now). Eventually I hope to make this a general archive utility for Twitter, allowing users to download/archive all kinds of tweets.

Originally, before the V2 Twitter API, this app used Selenium to try and scrape the contents of the a users bookmarks page. Now, since the release of the V2 API, the application has been rewritten. This new version is much faster and more robust.


Installation and Setup

Installation

Twitter-Archive can be installed with pip

```sh
$ pip install twitter-archive
```

Alternatively, you can clone this repository and install from the repository instead of from PyPi.

```sh
$ git clone https://github.com/jarulsamy/Twitter-Archive
$ cd Twitter-Archive
$ pip install .
```

To properly authenticate with the Twitter API, you will have to create a developer application. This will provide you with a client ID and client secret.

TODO: Document how to create Twitter Developer App.

Usage

You can invoke the app with:

```sh
$ twitter-archive
```

By default, the app will print a URL to prompt the user to authorize the application with Twitters official APIs. Once you navigate to that link and login with Twitter, the app will fetch a manifest of all the bookmarked tweets and begin saving any photos/videos to disk.

You can view the built-in CLI help menu for more info:

$ twitter-archive --help
Twitter Archival Tool

A CLI tool to archive tweets.

Usage:
    twitter-archive [options]

Options:
    -s, --skip                  Use the existing metadata file if possible.
    -o, --media-output=FILE     Path to output media    [default: ./media]
    -m, --metadata-output=FILE  Path to output metadata [default: ./bookmarks.json]
    --headless                  Don't use interactive authentication

    -h --help                   Show this help
    -v --version                Show version

Acknowledgements

The Twitter developer team did an excellent job on the new APIs. The new APIs are substantially more intuitive and allow us to interact with many more features of Twitter. While it did take two years, the openness, transparency, and attention to feedback is much appreciated!

The relevant forumn post is available here.

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-archive-0.0.3.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

twitter_archive-0.0.3-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file twitter-archive-0.0.3.tar.gz.

File metadata

  • Download URL: twitter-archive-0.0.3.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for twitter-archive-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a0440f05c7eedcccac17469488668c9d985ee0ab695eedec8d561574c69880ae
MD5 2268a0af6bf5e022a3e0dde498e24bb2
BLAKE2b-256 5c728613d7b764af659448744e58fd354b0654a1fcf6ba6ebb2653fb5ad6773d

See more details on using hashes here.

File details

Details for the file twitter_archive-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for twitter_archive-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 439a302d1e720ffe521bdb64f90a6ec960f897ded29fe6493ea7b1c14afca03e
MD5 ee23ea1252d37f6d9faa765cfa438f31
BLAKE2b-256 73a69dba08a6c58882f6c45268b6054ab809c1a918b701452a30d15ceda27b76

See more details on using hashes here.

Supported by

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