Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecated code fix for service #521

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
deprecated code fix client
Fix for deprecated functions
  • Loading branch information
y44k0v committed 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