Is there a way to do a "not" query with language?


Is there a way to format my twitter API queries to search tweets not written in a specified language? I can use “en” to see all tweets in English but how can I search tweets in any language but English?


Yes. To search for English tweets containing the word Shakespeare, search for “shakespeare lang:en”. To search for non-English tweets containing the word Shakespeare, search for “shakespeare -lang:en”.


Thank you very much for the reply. When I modified my TwitterAPI query from ‘lang’:‘en’ to ‘-lang’:‘en’ I still get some english results so I’ll have to play around with it to see what’s going on.


I tried this request in the API Console, and it appears that search/tweets does not support negating a language.

Can you confirm if this is correct?


That appears to be correct.


Close, but not correct. This is what you need:


When I put this into the API Console I get back plenty of EN’s. It looks like lang is ignored.

To clarify, are you saying that when filtering for a language use lang= (with an equals) and when filtering for not a language use -lang: (with a colon)?


Compare with

Notice how I’m including “lang:en” in the query itself, not as a separate lang= parameter, in both cases.

It’s exactly the same with the API.




Just caught that. Great job and thank you!