Code Monkey home page Code Monkey logo

twitterstream-to-mongodb's Introduction

twitterstream-to-mongodb

DESCRIPTION

Simple python script for storing tweets from the twitter stream directly to a MongoDB database based on a list of terms.

FEATURES/PROBLEMS

The script runs forever and refreshes the terms list periodically. Terms list can be modified while the scripts runs.

A catalog is created for each term in the MongoDB database.

Improvements apreciated.

CLONE AND USE

git clone git://github.com/gdelfresno/twitterstream-to-mongodb.git
cd twitterstream-to-mongodb/src
python twitterstreamtomongodb.py --oauth=oauth-example.json --server=localhost --port=23717 --database=TwitterStream --dbauth=dbauth.json --track=terms-example.txt --retweets=False

USAGE EXPLAINED

:arg oauth: json file that outlines oauth credentials for Twitter developers
:arg server: default is localhost for basic/local mongodb instances
:arg port: optional port of the mongodb instance
:arg database: the name you would like the database to have
:arg dbauth: auth file with database credentials
:arg track: basic text outlining search terms such as #trending or @user_name (carriage return per entry)
:arg retweets: specify whether or not retweets are collected and stored in the database

DATABASE AUTH (json)

{
    "user" : "yor_user",
    "password" : "your_password"
}

OAUTH (json)

Oauth Authentication:

{
    "consumer_key" : "ThIsIsJuStAnExAmPlE",
    "consumer_secret" : "ThIsIsJuStAnExAmPlE",
    "access_token" : "ThIsIsJuStAnExAmPlE",
    "access_token_secret" : "ThIsIsJuStAnExAmPlE"
}

Basic Authentication:

{
    "username" : "twitter_username"
    "password" : "password"
}

TRACK (basic text)

SomeWord
@user_name
#hashtag

REQUIREMENTS

mongo-python-driver

https://github.com/mongodb/mongo-python-driver

pip install pymongo

If this doesn't work, install from source

git clone git://github.com/mongodb/mongo-python-driver.git pymongo
cd pymongo/
python setup.py install

tweepy

https://github.com/tweepy/tweepy

pip install tweepy

LICENSE:

Twitter Stream To MongoDB (c) by gdelfresno

Twitter Stream To MongoDB is licensed under 
the terms of the GNU General Public License 
as published by the Free Software Foundation.

twitterstream-to-mongodb's People

Contributors

gdelfresno avatar

Watchers

 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.