Grabbing Twitter Info - Profile Image
in
Contributed Library Questions
•
2 years ago
I'm working on a little program that integrates with twitter (using twitter4j) to get various pieces of information that will eventually output an image. I've got most things running smoothly, including keyword queries and user timelines, but I'm having some trouble with getting user images. I found some
code that pulls images based on keywords tweeted, but I'd like to pull the image of a specific user instead. I'm having trouble adapting the code.
Here is the code as it currently is:
- String imgTemp = null;
- try{
- Query query = new Query("keyword");
- QueryResult result = (QueryResult) twitter.search(query);
- java.util.List tweets = result.getTweets();
- Tweet t = (Tweet) tweets.get(0);
- imgTemp = t.getProfileImageUrl();
- }
- catch (Exception e){
- System.out.println(e);
- }
- //loads image and resizes to fill window
- img = loadImage(imgTemp, "png");
- img.resize(600,0);
- image(img,0,0);
Can anyone lend me a hand?
(Twitter4j's java doc
here)
3