john2131
john2131

Reputation: 87

Python Twitter API How to search for tweets containing an exact phrase?

query = twitter.search.tweets(q = "Andorra Park Hotel")

So the problem I'm having is that this returns tweets containing these 3 words but not the phrase itself. So I'm getting tweets that have "Andorra" in it and "Park" in it and "Hotel" somewhere else. What I want is to get tweets containing this phrase or this exact String so the words follow each other consecutively. Thank you.

Upvotes: 1

Views: 2400

Answers (1)

itokatsu
itokatsu

Reputation: 66

To have a exact phrase match you need to have your string between " characters. so your query ends up looking like this :

"\"Andorra Park Hotel\""

Upvotes: 5

Related Questions