Package com.netlang.twitter
Class NTwitterClient
java.lang.Object
com.netlang.twitter.NTwitterClient
Class that implements Twitter REST services.
Example:
Example:
NTwitterClient twitterClient1 = new NTwitterClient("THE_BEARER");
IDate date1=new IDate("yyyy-MM-dd HH:mm:ss");
IDate oneWeekAgo=new IDate("yyyy-MM-dd HH:mm:ss");
oneWeekAgo.sub(0,0,7,0,0,0,0);
List<NTweet> tweets1=twitterClient1.listUserTimeline("userid",oneWeekAgo,date1);
NTweet tweet1=tweets1.get(0);
String text1=tweet1.getText();
-
Constructor Summary
ConstructorsConstructorDescriptionNTwitterClient(String bearerToken) Create a new client for communicating with TwitterNTwitterClient(String apikey, String secret) * Create a new client for communicating with Twitter. -
Method Summary
Modifier and TypeMethodDescriptiongetFollowers(String userid) Return all followers fot the given useridGet a specific tweet.getUserIdFromName(String name) Convert a twitter username to useridlistUserTimeline(String userid, com.intellus.util.IDate start, com.intellus.util.IDate end) Returns all tweets between in a timespan for the specific userstatic void
-
Constructor Details
-
NTwitterClient
Create a new client for communicating with Twitter- Parameters:
bearerToken- the access token from twitter
-
NTwitterClient
* Create a new client for communicating with Twitter.- Parameters:
apikey- the API keysecret- the secrete
-
-
Method Details
-
main
-
listUserTimeline
public List<NTweet> listUserTimeline(String userid, com.intellus.util.IDate start, com.intellus.util.IDate end) Returns all tweets between in a timespan for the specific user- Parameters:
userid-start-end-- Returns:
-
getUserIdFromName
Convert a twitter username to userid- Parameters:
name-- Returns:
-
getTweet
Get a specific tweet.- Parameters:
tweetid-- Returns:
-
getFollowers
Return all followers fot the given userid- Parameters:
userid-- Returns:
- a list with usernames
-