twitterscraper
twitterscraper copied to clipboard
Why I am getting other than english language tweets??
Even after mentioning lang as english I am getting Hindi tweets
What command are you using to run?
I haven't used the lang attribute yet but instead have been using the langdetect library. It looks like something kind of like this.
`from langdetect import detect
def detector(s): try: return detect(s) except: None
tweets = query_tweets(query, begindate=begin_date, enddate=end_date, poolsize=1)
df = pd.DataFrame(t.__dict__ for t in tweets)
df['lang'] = df['text'].apply(lambda x: detector(x))
df = df[df['lang'] == 'en']
`
Sorry for the formatting