Skip to content

dodilp/twitter-couchbase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Twitter Tag Cloud 
=================
This application captures tweets from twitter, stores it in Couchbase Server and generates a tag cloud out of the keywords. 

After installing Couchbase Server 2.0 and doing the manual steps described below, run tstream.py (with your twitter API creds).
Load tagcloud.html to render a tagcloud out of the data collected.

Pre-Requisites:
---------------
Twitter Streaming API (Your twitter API credentials need to be entered in tstream.py)
Tweepy (Python libraries for twitter)
Couchbase Server 2.0 (Developer Preview build will suffice)

Description
-----------
The app is written in Python and consists of mainly two simple components:

tstream.py:
A small service based on tweepy that implements a StreamListener which inserts incoming data in the Couchbase Server. Here you can also set filter terms. This example uses mostly terms related to “Big Data”.

tagcloud.html:
A few lines of HTML and JavaScript to render the tag cloud. 

Manual steps
------------
(1) Install Couchbase Server Latest Build 
http://www.couchbase.com/downloads-all#couchbase-server-2-0-builds

(2) Create Views
You need to create a Couchbase server 2.0 view called hashTagsByName with the following map and reduce functions:
To learn how to create Couchbase Server 2.0 views check out http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views.html

Map function
------------
function (doc) {
  doc.entities.hashtags.forEach(function(htag) {
    emit(htag.text.toUpperCase(), null)
  });
}

Reduce function
---------------
_count

(3) Edit tstream.py to modify the Couchbase Database Credentials and Twitter API Keys
(4) Install all necessary tstream.py dependant libraries such as tweepy, python SDK for Couchbase Server 2.0 (http://www.couchbase.com/develop/python/next)
(5) Run tweepy.py and use tagcloud.html to view the results. Enjoy! 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published