pumpkinspicer

🎃🍁🍂 PumpkinSpicer is your go-to Twitter scraper for all things cinnamon, clove, ginger, nutmeg and sometimes allspice.


Keywords
twitter, scrape, tweets, pumpkin spice, pumpkin, spice
License
MIT
Install
npm install pumpkinspicer@1.0.4

Documentation

PumpkinSpicer

Build Status

After spending the latter half of an unusually hot and humid early-September day, enjoying a pumpkin frosted sugar cookie, some pumpkin spiced coffee, and several Dogfish Head Pumpkin Ales (not all at the same time, although that would be impressive), I thought to myself how lucky we are to live in an age where pumpkin spice "everything" can be "everywhere" (for about two or three months).

However, moments later, it struck me that one crucial piece of the pumpkin pie was missing from this cinnamon and ginger induced equation: how can information about pumpkin spice be equally as ubiquitous as pumpkin spice itself?

And at that instance, I absolutely knew that the world at large needs a Node.js module dedicated to providing a constant pulse on all things pumpkin spice from the Twittersphere.

PumpkinSpicer example

Examples

Stream a sample of 'Pumpkin Spice' tweets in real-time

const PumpkinSpicer = require('pumpkinspicer');

const pumpkinSpice = new PumpkinSpicer({
  consumer_key:        'YOUR TWITTER CONSUMER KEY HERE',
  consumer_secret:     'YOUR TWITTER CONSUMER SECRET HERE',
  access_token:        'YOUR TWITTER ACCESS TOKEN HERE',
  access_token_secret: 'YOUR ACCESS TOKEN SECRET HERE'
});

pumpkinSpice.stream((data) => console.log(data));

Get a sample of 100 recent 'Pumpkin Spice' tweets

const PumpkinSpicer = require('pumpkinspicer');

const pumpkinSpice = new PumpkinSpicer({
  consumer_key:        'YOUR TWITTER CONSUMER KEY HERE',
  consumer_secret:     'YOUR TWITTER CONSUMER SECRET HERE',
  access_token:        'YOUR TWITTER ACCESS TOKEN HERE',
  access_token_secret: 'YOUR ACCESS TOKEN SECRET HERE'
});

pumpkinSpice.get()
.then((data) => console.log(data))
.catch((error) => console.log(error));

Usage

const pumpkinSpice = new PumpkinSpicer(keys)

Creates an instance of PumpkinSpicer. Requires Twitter API keys as an object and must follow the following format:

{
  consumer_key:        'YOUR TWITTER CONSUMER KEY HERE',
  consumer_secret:     'YOUR TWITTER CONSUMER SECRET HERE',
  access_token:        'YOUR TWITTER ACCESS TOKEN HERE',
  access_token_secret: 'YOUR ACCESS TOKEN SECRET HERE'
}

pumpkinSpice.stream(callback)

This method creates a stream of objects containing recent tweet information available from Twitter's Public Stream and accepts a callback function as its argument, returning objects that have the following key/value pairs:

{
  Tweet: 'text',
  Created: 'created_at',
  Id: 'id_str'
}

pumpkinSpice.get()

This method returns a promise, which resolves to an array of objects containing recent tweet information, or rejects to a new error object. This method does not accept any arguments. The objects have the following key/value pairs:

{
  Tweet: 'text',
  Created: 'created_at'
  Id: 'id_str'
}

License

The MIT License (MIT)

Copyright (c) 2016 John Foderaro

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.