Database Reference
In-Depth Information
Cmvn archetype:create -DgroupId=com.apress
-DartifactId=twitterExample -Dversion=1.0
-Dpackaging=jar
2.
Let's add a twitter4j dependency (see Figure 5-4 ) in pom.xml :
<!-- Twitter 4j dependency -->
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>[3.0,)</version>
</dependency>
3.
Configure twitter4j.properties (under src/main/re-
sources ) for consumer and access credentials:
#twitter4j.properties
# Given below keys are masked. Before running
DefaultTwitterService, kindly change them
according to your settings.
oauth.consumerSecret=8xxxxxxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
oauth.accessToken=3ccxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
oauth.accessTokenSecret=hxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
oauth.consumerKey=oxxxxxxxxxxxxxxxxxxxxx
4.
Let's create a connection using the Twitter API as:
twitter = new TwitterFactory().getInstance();
Note Please refer to
com.apress.chapter5.mapreduce.twittercount.hdfs.ConnectionHandler
for the implementation.
5.
Next configure apress as search tokens and fetch tweets:
 
Search WWH ::




Custom Search