Tweepy Search by a Country and not with coordinates -


is possible filter tweepy search country code? know it's possible search giving countries coordinates , radius. however, countries not defined circle. seems there should way because can access tweets country code after search over.

i worked on tweepy while track down tweets countries. refer : streaming parameters. can if u want track tweets single county follows:

  • track tweets approximate bounding boxes of coordinates surrounding country (polygon coordinates).
  • if want further filter particular country tweets because above method give noisy tweets neighbouring country, can check each tweets have geolocation parameter true , check country code looking filters down ur tweets 1%. because approx. 1% of tweets geotagged(people gps info tweets).
  • so, can choose next parameter filter using "users" "location" key, manually entered , can use geocoder apis geopy resolve string value find location , extract country name.

i guess in narrowing down tweets target country. below geopy code extract country code string value (like "new york", "brisbane" etc).

from geopy.geocoders import yandex import json geolocator = yandex(lang='en_us')  location = geolocator.geocode("paris", timeout=10)  if location != none:     print json.dumps(location.raw, indent=4)     print location.address     print location.latitude, " -> ", location.longitude else:     print location 

refer geopy documentation. , further assistance my project presentation.


Comments