8

google has an API for downloading search suggestions:

https://www.google.com/support/enterprise/static/gsa/docs/admin/70/gsa_doc_set/xml_reference/query_suggestion.html

unfortunately, as far as i can tell, these results are specific to your location. for an analysis, i would like to be able to define the city/location that google thinks it is making the suggestion to. here's what happens when i scrape from dar es salaam, tanzania:

http://suggestqueries.google.com/complete/search?client=firefox&q=insurance

["insurance",["insurance","insurance companies in tanzania","insurance group of tanzania","insurance principles","insurance act","insurance policy","insurance act tanzania","insurance act 2009","insurance definition","insurance industry in tanzania"]]

i understand that a vpn would partially solve this issue, but only by giving me a different location and not lots of locations. is there a reasonable way to replicate this sort of thing quickly and easily from, say, the 100 largest cities in the united states?

confirmation that results differ within the usa- enter image description here

thanks!

Anthony Damico
  • 5,779
  • 7
  • 46
  • 77
  • What makes you think the query suggestion service is location-specific beyond the top-/country-level Google search? I can't find any documentation on the query suggestion service that would indicate something location-specific is going on there. at least nothing as sophisticated as the location-specific search result ranking? – Forrest R. Stevens Jun 14 '15 at 17:34
  • @ForrestR.Stevens great question, but i'm pretty sure location matters - at least two computers across the country in chrome private browse gave me different results. always possible i'm screwing up something else – Anthony Damico Jun 14 '15 at 19:12
  • Just to confirm, you're talking about the query suggestions and not search results? I can't get query suggestions to give me different results based on the same prompt at least within country... – Forrest R. Stevens Jun 14 '15 at 20:33
  • @ForrestR.Stevens yes, query suggestions. my example image gives different suggestions within the same country.. – Anthony Damico Jun 14 '15 at 20:35
  • Interesting, I definitely stand corrected. I'm afraid your best bet would be to contact Google and see if there are any hidden hooks in the API to hard code the location information. But I suspect given how search results are location driven by reverse-IP, in addition to a variety of other triangulation, if query suggestions work similarly a VPN connection would be about the only way. – Forrest R. Stevens Jun 15 '15 at 04:38

2 Answers2

1

Google will use your IP and your location history (if turned on) to determine your location.

To be able to go around it, you can spoof your IP while logged off your google account (but I don't know if google will consider it a trial of hacking no matter what your intentions are).

Another way is to use Tor browser (even though it is not it's original purpose). You can configure tor to exit from a certain country using the Exitnode parameter in the torrc config file

As found in the docs:

ExitNodes node,node,…

A list of identity fingerprints, country codes, and address patterns of nodes to use as exit node

But if you want a fast way to do it, I don't think that's possible since google wants to know the real location of the users and have put a lot of effort into making such tricks fail.

Community
  • 1
  • 1
Ali Al Amine
  • 161
  • 2
  • 4
  • thanks! i am looking for a way to do this programmatically, so to use tor it would have to be torified -- https://trac.torproject.org/projects/tor/wiki/doc/TorifyHOWTO -- not sure how easy that is to incorporate into an R web scrape.. – Anthony Damico Jun 14 '15 at 19:53
  • @AnthonyDamico Actually the link you are following is to torrify an app that you didn't write. To go through tor in your own application, you can check out https://stem.torproject.org/faq.html#how-do-i-connect-to-tor and https://svn.torproject.org/svn/torctl/trunk/doc/howto.txt. As for changing the exit node programatically, you can search for the `ExitNodes` in the torrc, edit that line and tell tor to reload that. – Ali Al Amine Jun 15 '15 at 08:10
  • To achieve the results you are looking for, you should find a way to change your IP, and the only ways I know of are anonimity software, vpn's and some other IP spoofing techniques which require some hacking to be done and I would not recommend doing the last option unless you are looking for trouble. – Ali Al Amine Jun 15 '15 at 08:19
1

The hl param for interface language changes the search results, but I can't tell if it's actually changing the location. For example:

http://suggestqueries.google.com/complete/search?client=chrome&q=why&hl=FR

Here's an example with 5 different values of hl:

http://jsbin.com/tusacufaza/edit?js,output

thebenedict
  • 2,539
  • 3
  • 20
  • 29