fixed google text search
Some checks failed
Run Integration Tests / test (push) Failing after 2m18s

This commit is contained in:
partisan 2025-01-28 20:44:08 +01:00
parent 614ce8903e
commit 8db4e18ee4
2 changed files with 10 additions and 6 deletions

View file

@ -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) {