We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi folks, I'm starting to play with processing and twitter API, which I found amazing, but a bit tricky... I get tweets from a search from a key word , and I can post tweets with my user too... But so far, I can't get the timeline from a user, from my user for example (@urco82). I have been looking for some tutorial or references in this forum, but I didn't find anything that resolve my problem. I found a couple posts about get more than 20 tweets, but I have copied the code and doesn't work for me yet... Some suggestion or guide to take the right way?
Many many thanks in advance. The forum is amazing.
Answers
Maybe this can help you.
https://discussions.zoho.com/processing/topic/twitter4j-v3-0-3#fullResponseContainer_25080000002096799
:)
Hi _VK! many thanks!! I get the timeline succesfully now! At the beginning I was getting my tweets, no my home timeline tweets... I changed the method twitter.getUserTimeline() for getHomeTimeline() to get the right tweets.
The another question is about List statuses declaration, and how is used in this bucle " for (Status status : result.getTweets()) {}. I don't understand the line Status status:result.getTweets...:(
Thanks for your suggestions again!
This is a for each loop it is used to iterate though a collection just as a regular for, but easier. It works like:
very non technical explanation!
for( Type tempName:collection){ doStuff(tempName);}
each object in the collection will be assigned to tempName. The statements using tempName will be executed, and then the next object will be assigned, until there is no more to use. You can use a regular for instead. Will work same way:
for (int i = 0; i < list.size(); i++){ list.get(i).doStuff(); }
Great _VK!!! amazing explanation!;)
So I've tried the code in this thread (and VK's code from the 3.0.3 thread) and I have the same error in both.
OSX 10.9, Processing 2.0.3, Twitter4J 3.0.5 Same exact code as above, any ideas?
Quick Edit: forgot to mention that I'm getting a "NullPointerException" that highlights the following line from the sketch: for (Status status:statuses) {
Did you replaced xxxxx with your oauth data?
Yes, I didn't know if it was safe to post those keys it to the forum.
When I run the sketch on this thread, I now get the following error: "The method text(String, float, float) in the type PApplet is not applicable for the arguments (String)"
Twitter won't by happy if you disclose your data. : )
The text stuff is about line 68 where, indeed, is missing coordinates to text method. Anyway, try this.
Thanks for the Answer _vk.
So I have this like you suggested: import twitter4j.conf.*; import twitter4j.*; import twitter4j.auth.*; import twitter4j.api.*; import java.util.*;
This same null pointer exception error:
Did I do it wrong?
I see, i found some links with this error:
https://forums.oracle.com/thread/1534131
http://stackoverflow.com/questions/6784463/error-trustanchors-parameter-must-be-non-empty
http://stackoverflow.com/questions/4764611/java-security-invalidalgorithmparameterexception-the-trustanchors-parameter-mus
Installing Java for OSX worked for the error:
Get timeline: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
Thank you very much!