-
Notifications
You must be signed in to change notification settings - Fork 20
BONUS Part 7. The Unlimited Stream
If you're looking to sift through every single tweet that's coming in you'll need to consume the Twitter API directly. You can do this using the pubnubStreamUnlimited.py script or the pubnubStreamUnlimited.js script.
If you're planning on analyzing more than 1000 tweets a day, you'll also have to upgrade your IBM Bluemix plan. The current AlchemyAPI plan looks like this:

As I mentioned earlier, IBM will soon be switching sentiment analysis over from the AlchemyAPI to Natural Language Understanding. The pricing structure is slightly different:

Once you've figured out if you need to upgrade your IBM Bluemix service or not, you can get started using the Twitter API!
To get your Twitter API Credentials you will need to:
- Create a Twitter developer account
- Create an application
- Click on your app to be taken to its Details page. Click on the "Keys and Access Tokens" tab at the top to find and copy your Consumer Key, Consumer Secret, Access Token, and Access Token Secret (you may need to generate the access tokens).
Copy-paste these keys into their respective spots on lines 11-14 in the Python script or lines 7-10 in the Node script.
Tweepy is an awesome library for accessing the Twitter API through Python. To install it run:
pip install tweepy
You can install Twitter for Node.js with:
npm install twitter
Note: If you receive a permissions error, add "sudo" to the front of the command
Add your PubNub subscribe and publish keys to this script too!
Now you should be all set to ingest the flood of data! I must say that I was super impressed watching PubNub successfully send messages to Watson, give me the response, and then send that data to Initial State even though I was absolutely hammering it. I mean, I hit my 1000 calls a day in less than 5 minutes!
Initial State (https://www.initialstate.com)
(c) 2018 Initial State Technologies, Inc.