GithubHelp home page GithubHelp logo

twitter-hashtag-count's Introduction

Twitter HashTag Count


Summary

This repository includes a script that connects to the Twitter Streaming API and uses a generic filter to pull tweets. The hashtags are pulled out of those tweets and a count per hashtag is recorded in a Redis database.

Requirements

Install redis-server on your machine.

Create a virtualenv and install python requirements with pip:

$ pip install -r requirements.txt

Usage

The twitter_stream.py script stores the hashtags it sees in Redis. So before starting the script make sure your Redis server is running.


Fill in your configuration file under config/hashtag_counter.cfg.

Start the Twitter API stream script:

~/twitter-hashtag-count $ python lib/twitter_stream.py --filter=charity

More flags:

  • --debug
  • --verbose

If --verbose is not specified the script will write under /tmp/twitter_hashtag_count.log by default.


The API reads the Redis keys that the twitter_stream.py script is setting.

By default it uses 0.0.0.0:80.

Start the API:

~/twitter-hashtag-count $ python api/hashtag_count_api.py

Note: You might need root provileges to start the API if you want to use port 80.

API Routes

GET /count/${tweet_filter}

GET /count/${tweet_filter}/${num_results}

Returns an array of hashes containing a hashtag count and a hashtag name for all tweets containing the word represented by the variable tweet_filter.

num_results defaults to 100 elements.

DELETE /reset/${term_filter}

Deletes all the Redis keys collected for the specific filter.

twitter-hashtag-count's People

Contributors

davarisg avatar gdavaris avatar

Stargazers

 avatar  avatar  avatar

Watchers

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