From f72b448bec456f1328919235917f0c9099c4ce2d Mon Sep 17 00:00:00 2001 From: Chris Joyce Date: Thu, 25 May 2023 14:56:25 +1000 Subject: [PATCH] Updated go, useragent and added example --- example/main.go | 13 +++++++++++++ go.mod | 2 +- search.go | 1 - 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 example/main.go diff --git a/example/main.go b/example/main.go new file mode 100644 index 0000000..17e72fc --- /dev/null +++ b/example/main.go @@ -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")) +} diff --git a/go.mod b/go.mod index 55cfa15..20fed7d 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/rocketlaunchr/google-search +module github.com/chrisjoyce911/google-search go 1.20 diff --git a/search.go b/search.go index a759786..1a72aa7 100644 --- a/search.go +++ b/search.go @@ -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 }