Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
/ t-collector Public archive

Python script that downloads all images from twitter threads.

License

Notifications You must be signed in to change notification settings

davidkeipert/t-collector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple python script that downloads all images posted by the same author in a given twitter thread. Requires that you have a Twitter Developer account with API v2 keys.

Installation:

git clone https://github.com/davidkeipert/t-collector.git

Open example_config.py and add your Twitter API Bearer Token. Then rename the file to config.py.

If you don't have a Twitter Developer account, go to https://developer.twitter.com/en/apply-for-access to create one.

Usage:

python3 twitter.py URL

  • The script expects a Twitter URL of the form https://twitter.com/USERNAME/status/xxxxxxxxxxxxxxxxxx
  • Given a link to a thread on twitter, it will find all the replies in that thread by the same author. This is useful when you want to archive a compilation of photo dump that someone posted.
  • Due to limitations of the Twitter API, we can only find thread replies that were posted less than 7 days ago. If no replies can be found, only images attached to the original post will be found and downloaded.
  • Images will be downloaded to the directory in which this script resides.

Known Issues:

  • 7-day limitation for getting tweets in the same thread. This is because you have to use the normal tweet search function with the conversation_id as the query, which only searches the last 7 days of tweets. Here's hoping twitter lets us fetch all tweets with a given conversation_id without using the search endpoint in the future.
  • previously downloaded photos in the scripts directory will be overwritten if you download them again. Should rarely be problematic because the filenames reflect the unique id given to them by twitter.
  • can't choose a directory in which to download photos. Might add this functionality soon.
  • will probably break if you pass a twitter URL that's not a twitter.com/USER/status/tweet_id format. Eg. a link directly to a users profile.

About

Python script that downloads all images from twitter threads.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages