I was trying to make a really simple python code to get me the stream with the highest quality audio, so I first tried something like this
def get_highest_audio(url):
yt = YouTube(url)
best_audio_stream = yt.streams.filter(only_audio=True).all()[1]
return best_audio_stream
Which did return a stream, but it wasn't the stream with the highest quality audio, so I tried to find a function in the pytube library.
While there was a get_highest_resolution()
function, there was not a get_highest_audio_resolution()
function.
So I tried to get the audio resolution by hand, but there wasn't a function that got the audio resolution of a stream.
Is there any way to create this function?
Why not remove the [1] and it will display all audio formats. From there you can select the highest one?