From 2757fc8d80a5b6b1e193b9297ae6a8790f98caa4 Mon Sep 17 00:00:00 2001 From: partisan Date: Wed, 9 Oct 2024 18:50:04 +0200 Subject: [PATCH] removed random geolocation; instead, a fixed US location is used --- text-google.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/text-google.go b/text-google.go index a147743..e3f788e 100644 --- a/text-google.go +++ b/text-google.go @@ -2,7 +2,6 @@ package main import ( "fmt" - "math/rand" "net/http" "net/url" "strings" @@ -75,7 +74,7 @@ func buildSearchURL(query, safe, lang string, page, resultsPerPage int) string { uuleParam = "" } else { // Use random geolocation - glParam, uuleParam = getRandomGeoLocation() + glParam, uuleParam = "us", "us" } startIndex := (page - 1) * resultsPerPage @@ -87,15 +86,15 @@ func buildSearchURL(query, safe, lang string, page, resultsPerPage int) string { url.QueryEscape(query), safeParam, langParam, glParam, uuleParam, startIndex) } -func getRandomGeoLocation() (string, string) { - countries := []string{"us", "ca", "gb", "fr", "de", "au", "in", "jp", "br", "za"} - randomCountry := countries[rand.Intn(len(countries))] +// func getRandomGeoLocation() (string, string) { +// countries := []string{"us", "ca", "gb", "fr", "de", "au", "in", "jp", "br", "za"} +// randomCountry := countries[rand.Intn(len(countries))] - glParam := "&gl=" + randomCountry - uuleParam := "" +// glParam := "&gl=" + randomCountry +// uuleParam := "" - return glParam, uuleParam -} +// return glParam, uuleParam +// } func parseResults(doc *goquery.Document) []TextSearchResult { var results []TextSearchResult