Giter Club home page Giter Club logo

politwitical's Introduction

Politwitical

Politwitical is a simple web app created using Flask, tweepy, and textblob that displays the most tweeted political words/hashtags at the current moment in time.

AJAX requests are made every 30 seconds to get data from Flask. Flask collects tweets for 30 seconds using Twitter's Streaming API and filters tweets based on user (politicians, political twitter accounts, news accounts, etc). The tweets are then processed, their polarity is determined using textblob, and the frequencies of all the important words are calculated. All this data is stored in a Python dictionary and translated into a JSON object which is sent to Javascript using Flask Response. Javascript then displays the words on the screen and creates a pie chart (using Chart.js) for each word that presents the number of positive, neutral, and negative tweets that contain the specific word.

Installation

If you would like to run the app on your local server, please clone the repository and sign up for a Twitter developer account. In your developer account, create an application to get the API keys and tokens. Next, you will need to create a file called private.py in the project's directory and add the the following:

CONSUMER_KEY = "your consumer key (API Key)"
CONSUMER_SECRET = "your consumer secret (API Secret)"
ACCESS_TOKEN = "your access token"
ACCESS_TOKEN_SECRET = "your access token secret"

In your command line type:

pip install -r requirements.txt

Next, change to the project's directory and type:

python app.py

Now, you should be able to run the app by visiting http://localhost:5000.

Bugs + Features

  • Overlapping words and charts (JavaScript)
  • Filtering, processing, and analyzing the tweets is a pretty slow process (Python)

Other

Please feel free to add more users in filter_users.py or add more words to any of the lists in settings.py. Also feel free to fix/report any bugs you may find.

politwitical's People

Contributors

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