You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use this library to download audio for a given video. In my case, I already have the video ID as a string, and I am providing it to the Load() method directly: youtube.Load(videoID). A player gets returned, I can use it to get audio, and I can see the filename of each audio track. When I try to use player.ResolveURL() to retrieve the full URL of the audio, it returns an error. I see the same result for every video that I try.
Here's an example code snippet that I've set up to demonstrate:
func getAudioFromVideo(string videoID) {
player, err := ydl.Load(videoID)
fmt.Println("Attempting to get audio for ID:", videoID)
if err != nil {
fmt.Println("Error with player:", err)
}
stream := player.SourceFormats().AudioOnly().SortByAudioQuality()
for i, s := range stream {
fmt.Println("")
fmt.Println("Attempting to get audio version", i+1, "of", len(stream))
fmt.Println(s)
audioOnlyFilename := "audio." + s.FileExtension()
fmt.Println("audioOnlyFilename:", audioOnlyFilename)
audioOnlyURL, err := player.ResolveURL(s)
if err != nil {
fmt.Println("Error on ResolveURL:", err)
}
fmt.Println(audioOnlyURL)
}
}
getAudioFromVideo("fhCTLEEkhYY")
This code results in the following output:
The text was updated successfully, but these errors were encountered:
I'm trying to use this library to download audio for a given video. In my case, I already have the video ID as a string, and I am providing it to the Load() method directly:
youtube.Load(videoID)
. A player gets returned, I can use it to get audio, and I can see the filename of each audio track. When I try to useplayer.ResolveURL()
to retrieve the full URL of the audio, it returns an error. I see the same result for every video that I try.Here's an example code snippet that I've set up to demonstrate:
This code results in the following output:

The text was updated successfully, but these errors were encountered: