Updated go, useragent and added example

This commit is contained in:
Chris Joyce 2023-05-25 14:56:25 +10:00
parent 42aab3d7fc
commit f72b448bec
3 changed files with 14 additions and 2 deletions

13
example/main.go Normal file
View File

@ -0,0 +1,13 @@
package main
import (
"context"
"fmt"
googlesearch "github.com/chrisjoyce911/google-search"
)
func main() {
fmt.Println(googlesearch.Search(context.Background(), "First Aid Course Australia Wide First Aid"))
}

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/rocketlaunchr/google-search
module github.com/chrisjoyce911/google-search
go 1.20

View File

@ -285,7 +285,6 @@ func Search(ctx context.Context, searchTerm string, opts ...SearchOptions) ([]Re
if opts[0].UserAgent == "" {
c.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
} else {
c.UserAgent = opts[0].UserAgent
}