Last active
October 17, 2021 12:37
-
-
Save kaugesaar/5e8d58564bd6ffb813ed to your computer and use it in GitHub Desktop.
Fake your Google searches location with uule parameter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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