Git Product home page Git Product logo

twitterscraper's Introduction

Twitter Scraper

Introduction

Streaming client for the Twitter gardenhose service. Connects to stream and collects data on tweets recieved, including statistics on emoji, hashtags, urls, and pictures in tweets.

Installation

Obtain developer keys from Twitter, and place the appropriate keys in config.js. Then:

    git clone http://github.com/ccarlile/TwitterScraper
    npm install
    node index.js

Usage

On running node index.js, the app opens a twitter client and begins streaming and port 3000 is opened for listening. Send a GET request to http://localhost:3000 to recieve a JSON object containing information about the tweets recieved so far.

Future Development

Since Node.js is single-threaded, calls to the statistics server (port 3000) will keep the parser from doing its job for very large calls. Node's default sort method is quicksort with average case nlogn performance, so using something like a heap wouldn't help too much. As a matter of fact, the available heap implementations in node are painfully lacking - the most popular library, heap.js, will arbitraialy remove elements in certain (supposedly) non-destructive methods.

Considering growing at scale, the idea would be: separate calls into two separate Node.js processes: one for parsing, and one for managing calls for statistics, and using a shared data store (Redis supports sorted sets, and would be a likely candidate, though a database would be fine as well - especially if the tweet bodies were to be stored. MongoDB comes to mind for storing JSON). Additionally, backend processes can periodically compile statistics so that the server process doesn't have to do it all. Putting these processes behind a server like NGINX would allow for load balancing, caching, etc.

twitterscraper's People

Contributors

ccarlile avatar

Watchers

James Cloos 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.