Giter Club home page Giter Club logo

twitter-miner's Introduction

Twitter Miner

What it Does

Twitter Miner mines the followers and subsequent tweets of a given user.

Dependencies

Usage

Environment Variables

This project relies on environment variables to run. This is to help ensure you aren't publishing your API keys to a public repo.

An example environment variable file, environmentExample.py, is included in the repo for your convenience. In order to use it, replace each string with its corresponding value.

Before Running: You must create an environment.py file in order for the files to run. As mentioned above, you should use the same format as environmentExample.py.

  • TWITTER_HANDLE - Handle of the Twitter profile you are mining
  • TWITTER_CONSUMER_KEY - Get this from the Twitter app page. Credentials to allow your app to access the Twitter API.
  • TWITTER_CONSUMER_SECRET - Same as above. Keep this secret. Authenticates your app with the API.
  • TWITTER_ACCESS_TOKEN_KEY - Get this from your user profile. Credentials allowing you to access more functionality from the API.
  • TWITTER_ACCESS_TOKEN_SECRET - Same as above. Again, keep this secret. This authenticates your user token with the API.

Initiate Mining

To start the mining process:

Mine Followers

python followerScraper.py

This will begin grabbing all the followers from the TWITTER_HANDLE provided in environment.py.

Note: that on startup, it will search for a pre-existing output file (with the form below) and attempt to continue mining from the last position.

It will continue grabbing until it hits a rate limit, try again every three minutes, then continue until it gets a nextCursor == 0 - Twitter's way of saying you hit the last page.

Output File: TWITTER_HANDLEFollowers.json

Mine Feeds

python feedScraper.py

This will begin grabbing all the feeds from the followers scraped in the first process. As such, followerScraper.py must have run on the same TWITTER_HANDLE or it won't know which feeds to pull.

Note: feedScraper.py will first check to see if a followers file exists in the correct format. If that succeeds, it will search for an existing feed-mining session. If it finds one, it will parse through the file in an attempt to figure out where the last one left off. If this succeeds, feedScraper.py will resume the mining operation where the last one stopped.

Required Input Files: TWITTER_HANDLEFollowers.json

Output File: TWITTER_HANDLEFeeds.json

twitter-miner's People

Contributors

sirhamy avatar

Watchers

James Cloos avatar  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.