Streaming API with filtering


#1

Hi all,

I am trying to write a code that stream the arabic tweets only from twitter.
I tried that by using the following code :

FilterQuery q = new FilterQuery();
String[] langs = new String[1];
langs[0]=β€œar”;
q.language(langs);
twitterStream.filter(q);

Unfortunately it give me the following error :frowning: :frowning:

406:Returned by the Search API when an invalid format is specified in the request.
Returned by the Streaming API when one or more of the parameters are not suitable for the resource. The track parameter, for example, would throw this error if:
The track keyword is too long or too short.
The bounding box specified is invalid.
No predicates defined for filtered resource, for example, neither track nor follow parameter defined.
Follow userid cannot be read.
No filter parameters found. Expect at least one parameter: follow track locations

[Mon Mar 10 13:15:25 GMT+03:00 2014]Parameter not accepted with the role. 406:Returned by the Search API when an invalid format is specified in the request.
Returned by the Streaming API when one or more of the parameters are not suitable for the resource. The track parameter, for example, would throw this error if:
The track keyword is too long or too short.
The bounding box specified is invalid.
No predicates defined for filtered resource, for example, neither track nor follow parameter defined.
Follow userid cannot be read.
No filter parameters found. Expect at least one parameter: follow track locations

However if I add to track a keyword with the arabic language it works. But I don’t want to track keywords with the language.

any idea about other why I got this error and plz if u have alternative that I can use ??

Thnx in advance


#2

Why I get the same problem even I add the track?

FilterQuery q = new FilterQuery();
	String[] langs = new String[1];
	langs[0]="en";
	q.language(langs);
	String[] tracks= {"java"};
	q.track(tracks);
	twitterStream.filter(q);