java - Is it normal that sampling tweets using TwitterStream as in Twitter4J code example, I get just mainly question marks as user name and status? -
i used code in section "code example" in twitter4j:
public static void main(string[] args) throws twitterexception, ioexception{ statuslistener listener = new statuslistener(){ public void onstatus(status status) { system.out.println(status.getuser().getname() + " : " + status.gettext()); } public void ondeletionnotice(statusdeletionnotice statusdeletionnotice) {} public void ontracklimitationnotice(int numberoflimitedstatuses) {} public void onexception(exception ex) { ex.printstacktrace(); } }; twitterstream twitterstream = new twitterstreamfactory().getinstance(); twitterstream.addlistener(listener); // sample() method internally creates thread manipulates twitterstream , calls these adequate listener methods continuously. twitterstream.sample(); }
as can see, there's println in code above, inside method "onstatus". following photo shows code. normal?
question marks...question marks everywhere
indeed, i filter statuses user hasn't got question mark in user name, got nothing. moreover, should filter users location public. regards ask difference between:
user.isgeoenabled()
and
user.getlocation() != ""
the responses utf-8 encoded https://dev.twitter.com/tags/utf-8
if @ of accounts in output include non-western european characters https://twitter.com/tomokichi_koyo. these breaking output.
try writing file instead , opening utf-8 aware editor. there various answers setting java , os default utf-8 need specific combination https://stackoverflow.com/search?q=windows+console+java+utf-8
Comments
Post a Comment