Skip to content

Instantly share code, notes, and snippets.

@kaugesaar
Last active October 17, 2021 12:37
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save kaugesaar/5e8d58564bd6ffb813ed to your computer and use it in GitHub Desktop.
Save kaugesaar/5e8d58564bd6ffb813ed to your computer and use it in GitHub Desktop.
Fake your Google searches location with uule parameter.
var geo = new GeoSearch();
geo.baseUrl = 'https://www.google.com/search?';
geo.lang = 'en';
var url = geo.build({query:'Mountain bike', location:'New York'});
console.log(url)
// output: https://www.google.com/search?query=Mountain%20bike&uule=w+CAIQICIIbmV3IHlvcms&pws=0&hl=en
var GeoSearch = function() {
this.baseUrl = 'https://www.google.se/search?';
this.pws = true;
this.lang = 'sv';
var key = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
var makeHash = function(loc) {
loc = loc.toLowerCase().replace(/[åä]/g,'a').replace(/[ö]/g,'o');
return 'w+CAIQICI' + key[loc.length%key.length] + btoa(loc).replace(/\=/g,'').trim();
};
this.build = function(input) {
var hash = makeHash(input.location);
var params = {
query : encodeURIComponent(input.query),
uule: hash
};
if (this.pws) params.pws = 0;
if (this.lang) params.hl = this.lang;
var urlParams = Object.keys(params).map(function(k) {
return k + "=" + params[k];
}).join('&');
return this.baseUrl + urlParams;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment