Giter Club home page Giter Club logo

twitter-stats's Introduction

twitter-stats

A Node app that consumes the Twitter Streaming API and computes various statistics

Computed stats:

  • Total number of tweets received
  • Average tweets per hour/minute/second
  • Top emojis in tweets(ordered by total number of occurrences)
  • Percent of tweets that contains emojis
  • Top hashtags(ordered by total number of occurrences)
  • Percent of tweets that contain a url
  • Percent of tweets that contain a photo url (pic.twitter.com or instagram)
  • Top domains of urls in tweets(ordered by total number of occurrences)

Usage

Install dependencies
yarn install

or

npm install
Run the app

The app will run on port 8011 when executing:

yarn start

or

npm start
Visualizing computed stats

API:

The app exposes a Rest API, calling api/reports will generate the stats. Sample curl:

curl -X GET http://localhost:8011/api/report

Console:

The app will start logging stats in the console every 5 seconds. Sample output:

-------------------------------------------------------------------------------------------
 numberOfTweetsReceived : 6946
-------------------------------------------------------------------------------------------
 averageTweetsPerHour : 6946
-------------------------------------------------------------------------------------------
 averageTweetsPerMinute : 1389.2
-------------------------------------------------------------------------------------------
 averageTweetsPerSecond : 30.2
-------------------------------------------------------------------------------------------
 topEmojis : {"๐Ÿ˜‚":293,"๐Ÿ˜ญ":229,"โค":129,"๐Ÿป":81,"โœจ":76,"๐Ÿ”ฅ":75,"๐Ÿ’•":65,"๐Ÿ˜":56}
-------------------------------------------------------------------------------------------
 topHashtags : {"iHeartAwards":31,"TiffanyYoung":18,"BestSoloBreakout":17}
-------------------------------------------------------------------------------------------
 topDomains : {"twitter.com":599,"du3a.org":83,"instagram.com":14,"ift.tt":12}
-------------------------------------------------------------------------------------------
 percentOfTweetsThatContainsEmojis : 19.81
-------------------------------------------------------------------------------------------
 percentOfTweetsThatContainsUrls : 17.97
-------------------------------------------------------------------------------------------
 percentOfTweetsThatContainPhotoUrls : 0.2
-------------------------------------------------------------------------------------------

twitter-stats's People

Contributors

jcvilap avatar

Watchers

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