GithubHelp home page GithubHelp logo

isabella232 / twittercrawler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from texttheater/twittercrawler

0.0 0.0 0.0 103 KB

A script to download all the available tweets from a Twitter user

Python 100.00%

twittercrawler's Introduction

twittercrawler

A script to download all the available tweets from a Twitter user or from a list of keywords.

Setup

First of all, install the dependencies:

simplejson
requests
requests_oauthlib
yaml

Then, make a copy of config.yaml.sample called config.yaml and fill in the authentication info. The config file also contains a few default values for the script.

Running

To download all* the tweets from a list of users run as:

crawl.py -t user username1 [username2 ...]

To search for keywords in the stream of tweets run as:

crawl.py -t keyword keyword1 [keyword2 ...]

To get a stream with a small sample of all tweets on Twitter run as:

crawl.py -t sample

By default, the output is written on the standard output in the JSON format returned by the Twitter API. If the -f tsv option is provided, the output is written on the standard output in tab-separated format, one tweet per line. The fields are:

  • tweet ID
  • timestamp in UNIX epoch (seconds since 1/1/1970)
  • username
  • language code
  • geographic coordinates, "None" is not provided
  • text of the tweet

The -o output_file option specifies a file to write the output. If existing, the file will be overwritten.

The filter.py module also acts as a command line filter, reading a JSON output file on its standard input and writing out the corresponding tab-separated format.

Disclaimer

The copyright of the tweets belongs to Twitter. Please refer to Twitter's Terms of Service for information about what you can and cannot do with the tweets.

There is no guarantee that all the tweets relevant to the search will be retrieved. The number of resulting tweets may be influenced by the Twitter API's rate limit, the network infrastructure, etc.

twittercrawler's People

Contributors

texttheater avatar valeriobasile 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.