diff --git a/text-google.go b/text-google.go index ce397ca..87982cf 100644 --- a/text-google.go +++ b/text-google.go @@ -76,7 +76,7 @@ func buildSearchURL(query, safe, lang string, page, resultsPerPage int) string { } langParam := "" - var glParam string + glParam := "" if lang != "" { // Use lang as the geolocation @@ -88,12 +88,16 @@ func buildSearchURL(query, safe, lang string, page, resultsPerPage int) string { } startIndex := (page - 1) * resultsPerPage + udmParam := "&udm=14" // Add the required parameter - printDebug(fmt.Sprintf("https://www.google.com/search?q=%s%s%s%s&start=%d", - url.QueryEscape(query), safeParam, langParam, glParam, startIndex)) + // Build the URL string + baseURL := "https://www.google.com/search?q=%s%s%s%s&start=%d%s" + fullURL := fmt.Sprintf(baseURL, url.QueryEscape(query), safeParam, langParam, glParam, startIndex, udmParam) - return fmt.Sprintf("https://www.google.com/search?q=%s%s%s%s&start=%d", - url.QueryEscape(query), safeParam, langParam, glParam, startIndex) + // Debug print + printDebug("%s", fullURL) + + return fullURL } // func getRandomGeoLocation() (string, string) { diff --git a/text-librex.go b/text-librex.go index fe4374d..9d96129 100644 --- a/text-librex.go +++ b/text-librex.go @@ -42,7 +42,7 @@ func PerformLibreXTextSearch(query, safe, lang string, page int) ([]TextSearchRe // Perform the request using the appropriate client var resp *http.Response - if config.MetaProxyEnabled && metaProxyClient != nil { + if config.MetaProxyEnabled && config.MetaProxyStrict && metaProxyClient != nil { resp, err = metaProxyClient.Do(req) } else { client := &http.Client{}