anupam
anupam

Reputation: 3

How do I specify language of tweet when using tweepy?

I'm trying to get tweets only in English. But when I specify lang, the resulting data frame is empty. When I remove it, I get up to 1000 tweets.

number_of_tweets = 1000
tweets = []
time = []

for i in tweepy.Cursor(api.search_tweets, q = "Birdman", tweet_mode="extended", lang="English").items(number_of_tweets):
    tweets.append(i.full_text)
    time.append(i.created_at)

I only wanted the tweets that are in English but they all seem to be removed.

Upvotes: 0

Views: 834

Answers (1)

Maddy Guthridge
Maddy Guthridge

Reputation: 2001

The documentation states that it requires the language to be "given by an ISO 639-1 code". You want your lang argument to be "en" instead of "English".

Upvotes: 1

Related Questions