removed random geolocation; instead, a fixed US location is used
This commit is contained in:
parent
d9d0301548
commit
2757fc8d80
1 changed files with 8 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue