Stream API get parsing error by hbc


#1

When I use hbc to parse tweets from stream api, I get the following err:

Caused by: twitter4j.JSONException: JSONObject[“text”] not found.

The reason is that I kept getting the following useless tweets

{“limit”:{“track”:8,“timestamp_ms”:“1412693349716”}}

{“limit”:{“track”:11,“timestamp_ms”:“1412693349742”}}

How I can filter out those useless tweets. I only want real time and read-only tweets for data analysis purpose. Here is my Java code:

BasicClient client = new ClientBuilder()
            .name("myStream")
            .hosts(Constants.STREAM_HOST)
            .endpoint(endpoint)
            .authentication(auth)
            .processor(new StringDelimitedProcessor(queue))
            .build();

#2

The messages that are causing your parser to throw an error are actually limit notices. As described they are being delivered because your track terms are matching more tweets than are permitted by the streaming APIs rate limit.

It also looks like you are using Twitter4j on top of hbc. In that case make sure that you have taken a look at and understand the Twitter4jSampleStreamExample.java. The only difference for you will be the endpoint being filter and not sample.

Hope that helps! Let me know if you have any other questions.