Giter VIP home page Giter VIP logo

twitter-reply-ranking's Introduction

twitter-reply-ranking

Fetch Tweet data from a cohort of screen names to rank based on number of replies. This is the code I used for publishing rankings of Massachusetts mayors, state representatives, state senators, statewide offices, and congressional delgation on abbett.org

Set up

  1. Apply for a Twitter developer account
  2. Once approved, create an app to generate a set of Twitter API keys and access tokens.
  3. Clone the twitter-reply-ranking repository to your computer.
  4. Copy credentials.orig.json to credentials.json and fill in the fields with your new keys & tokens.
  5. Install Ruby (if you don't have it already).

Usage

cd twitter-reply-ranking
gem install twitter
ruby twitter-reply-ranking.rb cohorts/ma_mayors.json templates/stats_mayors.html.erb

Replace the cohort path with the cohort of your choice. Replace the templates path with the output template of your choice.

Cohort files

...are each simply an array of JSON objects stored as .json files in the cohorts subdirectory. The only fields you absolutely need in each object are first, last, and screen_name, though each output template makes its own demands for fields - you might see rendering errors if there's a mismatch. (There's definitely work to be done to make this more flexible/generic.)

Output templates

...are each ERB files stored in the templates subdirectory. They're currently a mix of Markdown and HTML, since that's what my Jekyll-driven website likes. Make them anything you like!

Cohort/template combinations that work out of the box

ruby twitter-reply-ranking.rb cohorts/ma_mayors.json templates/stats_mayors.html.erb
ruby twitter-reply-ranking.rb cohorts/ma_state_reps.json templates/stats.html.erb
ruby twitter-reply-ranking.rb cohorts/ma_state_senators.json templates/stats.html.erb
ruby twitter-reply-ranking.rb cohorts/ma_statewide.json templates/stats_statewide.html.erb

Questions? Need help?

Post an issue in this repository, or message me on Twitter: @jonabbett

If you want to make new & interesting cohorts, post it in a pull request and I can include it.

twitter-reply-ranking's People

Contributors

jabbett avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

zcarpman

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.