Updated go, useragent and added example
This commit is contained in:
parent
42aab3d7fc
commit
f72b448bec
13
example/main.go
Normal file
13
example/main.go
Normal 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
2
go.mod
@ -1,4 +1,4 @@
|
|||||||
module github.com/rocketlaunchr/google-search
|
module github.com/chrisjoyce911/google-search
|
||||||
|
|
||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
|
@ -285,7 +285,6 @@ func Search(ctx context.Context, searchTerm string, opts ...SearchOptions) ([]Re
|
|||||||
|
|
||||||
if opts[0].UserAgent == "" {
|
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"
|
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
|
c.UserAgent = opts[0].UserAgent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user