GithubHelp home page GithubHelp logo

tweet-downloader's Introduction

tweets-dl

Python script to download tweets for a given twitter handle or multiple twitter handles. It returns the tweets in csv format.

Installing

pip install tweets-dl

Running the Script

Run the following command in command line. Replace twitter_user_* by the official twitter handle of the user whose tweets need to be downloaded. You can specify any number of user names separated by space. If you do not specify a csv filename, the tweets will be saved in a file tweets.csv.

tweets-dl filename.csv twitter_user_1 twitter_user_2

Caveat

A word of caution if using the default key and secret; one might experience "rate limit exceeded" by Twitter upon simultaneous usage. In that case, get your consumer key and consumer secret from Twitter by following these steps:

Go to https://apps.twitter.com/app/new
Fill in the details of the application to connect with the API
Click on Create your Twitter application
Details of your new app will be shown along with your consumer key and consumer secret
Save the key and secret.

Running the script with your consumer key and secret

tweets-dl --key <your_key_from_twitter> --secret <your_secret_from_twitter> filename.csv twitter_user_1 twitter_user_2 twitter_user_n

Author

Vaishali Garg

License

This project is licensed under the MIT License - see the LICENSE file for details

tweet-downloader's People

Contributors

vaishali-garg avatar

Watchers

James Cloos avatar  avatar

tweet-downloader's Issues

Attempting to download my tweets fails

I installed the pip package and it doesn't seem to work.

command tweets-dl mine.csv <myid>

Traceback (most recent call last):
  File "/home/$USER/.local/bin/tweets-dl", line 11, in <module>
    load_entry_point('tweets-dl==0.1.3', 'console_scripts', 'tweets-dl')()
  File "/home/$USER/.local/lib/python3.6/site-packages/tweet_downloader/tweet_dl.py", line 112, in main
    tweet_list = combine_tweets(screen_names)
  File "/home/$USER/.local/lib/python3.6/site-packages/tweet_downloader/tweet_dl.py", line 94, in combine_tweets
    tweet_list.extend(get_tweets(screen_name))
  File "/home/$USER/.local/lib/python3.6/site-packages/tweet_downloader/tweet_dl.py", line 71, in get_tweets
    oldest = alltweets[-1]['id'] - 1
TypeError: string indices must be integers

I get IndexError: list index out of range if I try it without manually inputting a csv file.

OS: Linux Mint 19.1
Python v3.6

Some tweets incomplete

Some tweets are truncated. Apparently (didn't look into it much) those with embedded media are affected. And on first glance, all end with \xe2\x80\xa6

Example: https://twitter.com/ASmallFiction delivers this text field for tweet id 1019585775342518272 from Wed Jul 18 14:12:46 +0000 2018:

b'RT @StoryShortest: I just launched a book of my best stories on Kickstarter https://t.co/6lj5RxK5F9\n\n88 gut-punching micro-tales w/ special\xe2\x80\xa6'

while the browser displays:

I just launched a book of my best stories on Kickstarter http://shorteststory.com/kickstarter

88 gut-punching micro-tales w/ special guests
@ShearmanRobert
@manuscriptgal
@ShawnCoss
@honey_child
@ASmallFiction
@Sandra_Kasturi

And the voice of @CecilBaldwinIII

I couldn't be more thrilled!

tweets-dl 0.1.3
Python 2.7.10 (still mac standard install )
macOS 10.13.6

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.