here the code
public void onStatus(Status status) {
String lang = status.getUser().getLang();
if (tweetCount < 50000) {
if (lang.equals("en")) {
storeInFile(status);
tweetCount++;
}
}
}
tweets i get from all the languages. Is there a way to restrict myself to fetching tweets only in English?
The code you are using doesn't return the language of the tweet Why don't you try:
status.getLang()
From here :
Interface Status
java.lang.String getLang()
Returns the lang of the status text if available.
Returns:
two-letter iso language code Since: Twitter4J 3.0.6
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.