JuanBindez/pytubefix

Doesn't know different languages for audio streams

Closed this issue · 3 comments

Description
When downloading an audio stream where the youtuber created different audio tracks with different languages, pytubefix downloads the first of those, but not the original

To Reproduce
Try this video from Marques Brownlee: https://youtu.be/XaqOejIaFgM

Pytubefix downloads the spanish version, which is a translation and not the original.

Expected behavior
It would be nice to be able to choose the languages in the audio streams

Screenshots

175784109-49b873ff-5935-4237-a942-da65127c1209

Desktop (please complete the following information):

  • OS: MacOS 14.3.1
  • Python Version 10
  • Pytubefix Version 1.13.3

Update to the latest version of pytubefix.

Try using this to get only the audios in English:

yt = YouTube('https://www.youtube.com/watch?v=XaqOejIaFgM')

for c in yt.streams.get_default_audio_track():
    print(f'{c} {c.url}')

If you want to get the audio and video in the same file, you can use:

yt = YouTube('https://www.youtube.com/watch?v=XaqOejIaFgM')

stream = yt.streams.get_highest_resolution()

print(f'{stream} {stream.url}')

Note: progressive streams (audio and video in the same file) will always come with the original audio. See this #31.

from pytubefix import YouTube
  
  
yt = YouTube('https://www.youtube.com/watch?v=XaqOejIaFgM')
  
ys = yt.streams.get_by_itag(599)
ys.download(mp3=True)

felipeucelli's solution works