I am trying to create a timeline of tweets for a specific hashtag according to geographic location. The location should be a country.
I would like to verify if my code below indeed filters the tweets by country (in this case France):
tag=„NBA"
# determine place id corresponding to country coordinates
geo=GET("https://api.twitter.com/1.1/geo/search.json?query=France&granularity=country",
config(token = twitter_token))
geo <- content(geo, as = "text")
geo=fromJSON(geo)
country_id= geo$result$places$id
# use id to filter tweets by country
req=GET(sprintf("https://api.twitter.com/1.1/search/tweets.json?q=%%23%s&src=typd&count=100&id=%s",
tag, country_id),
config(token = twitter_token))
req <- content(req, as = "text")
newTweets=fromJSON(req)
Is this the way to go?
What I find somewhat puzzling is that according to...
https://dev.twitter.com/rest/reference/get/search/tweets
...there is only the possibility to set option geocode
but nothing is mentioned regarding place_id