Friday, February 5, 2010

Accessing twitter data from java - jtwitter API jweet it !!!!!!!

This article is to be an introduction for usage of the jtwitter API. This code is a simple application which can obtain the profile images of the user who logs in .

Prerequisites :
1) Twitter account
2) Fundamentals of java.
3) Download the jtwitter API from :[jtwitter].
4) Use the code given below , after importing the jtwitter API to your project.

CODE :

package twitterclient;

import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import winterwell.jtwitter.Twitter;
import winterwell.jtwitter.Twitter.User;

/**
*
* @author Jayanth GM & Prashanth Raghu
*/
public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here

Twitter t = new Twitter("user name","password");
List followers = t.getFollowers("User twitter name");

Iterator iterator = followers.iterator();
while(iterator.hasNext()){
User current = iterator.next();
System.out.println(current.getProfileImageUrl());
}

}

}

Original Article : [original]

Posted By :
Jayanthi GM[Course Instructor Java , PES Institute of technology]
Prashanth Raghu[Student Assistant]

Feel free to comment.

1 comment: