Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
deprecated code fix client
Fix for deprecated functions
  • Loading branch information
y44k0v authored Jan 25, 2024
commit b40144b75b0b5c32176d15a9b34eb3aa34a7a8be
11 changes: 3 additions & 8 deletions go/search_by_keyword.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,14 @@ var (
const developerKey = "YOUR DEVELOPER KEY"

func main() {
flag.Parse()

client := &http.Client{
Transport: &transport.APIKey{Key: developerKey},
}

service, err := youtube.New(client)
ctx := context.Background()
service, err := youtube.NewService(ctx, option.WithAPIKey(developerKey))
if err != nil {
log.Fatalf("Error creating new YouTube client: %v", err)
}

// Make the API call to YouTube.
call := service.Search.List("id,snippet").
call := service.Search.List([]string{"id", "snippet"}).
Q(*query).
MaxResults(*maxResults)
response, err := call.Do()
Expand Down