diff --git a/text-google.go b/text-google.go index 4ea7866..006ebc0 100644 --- a/text-google.go +++ b/text-google.go @@ -66,12 +66,17 @@ func buildSearchURL(query, safe, lang string, page, resultsPerPage int) string { } langParam := "" - if lang != "" { - langParam = "&lr=lang_" + lang - } + var glParam, uuleParam string - // Generate random geolocation - glParam, uuleParam := getRandomGeoLocation() + if lang != "" { + // Use lang as the geolocation + langParam = "&lr=lang_" + lang + glParam = "&gl=" + lang + uuleParam = "" + } else { + // Use random geolocation + glParam, uuleParam = getRandomGeoLocation() + } startIndex := (page - 1) * resultsPerPage return fmt.Sprintf("https://www.google.com/search?q=%s%s%s%s%s&start=%d",