Closed natxo closed 6 months ago
after updating the module one script broke because the method FindByQuality() is no longer available since 2.10 apparently (the last version having it is https://pkg.go.dev/github.com/kkdai/youtube/v2@v2.9.0#FormatList.FindByQuality, it seems).
I was using this code to retrieve the smallest video with audio (just interested in the audio for creating podcast feed from shows):
// retrieve the videos with audio only, then the one with the smalles footprint func _getsmallessvideo(videourl string, ytclient youtube.Client) (*youtube.Video, *youtube.Format, error) { video, err := ytclient.GetVideo(videourl) if err != nil { log.Println(err) return nil, nil, err } formats := (video.Formats.WithAudioChannels()) smallest := formats.FindByQuality("tiny") log.Println(video.Title) return video, smallest, nil }
What is the advised way to do this in the newest version?
Thanks!
if formats := video.Formats.WithAudioChannels().Quality("tiny"); len(formats) > 0 { log.Println(formats[0].video.Title) }
very nice, I missed that one. Thanks
after updating the module one script broke because the method FindByQuality() is no longer available since 2.10 apparently (the last version having it is https://pkg.go.dev/github.com/kkdai/youtube/v2@v2.9.0#FormatList.FindByQuality, it seems).
I was using this code to retrieve the smallest video with audio (just interested in the audio for creating podcast feed from shows):
What is the advised way to do this in the newest version?
Thanks!