Description
Hi @JuanBindez π
First of all, thank you for your work on pytubefix β it's a great tool!
I encountered an issue where the video downloaded using pytubefix has English audio, but the original video on YouTube has both Hindi and English audio tracks, and I want to download the Hindi version (which is the original audio).
It seems that the library automatically selects the first available audio stream, which in this case happens to be English. Here's the code snippet I used for fetching the streams:
`def pytubefix_fetch(self, video_url):
try:
yt = YouTube(video_url)
video_stream = yt.streams.filter(file_extension='mp4', res='1080p').first() or yt.streams.filter(
file_extension='mp4', res='720p').first()
audio_stream = yt.streams.filter(only_audio=True).first()
resolution = video_stream.resolution if video_stream else "Unknown"
return yt, video_stream, audio_stream, resolution
except pytubefix.exceptions.RegexMatchError:
self.after(0, lambda: messagebox.showerror("Error", "Pasted link is invalid"))
if self.stop_alternating_text():
self.stop_alternating_text()
return None, None, None, None
except pytubefix.exceptions.VideoUnavailable:
self.after(0, lambda: messagebox.showerror("Error", "The content is unavailable"))
if self.stop_alternating_text():
self.stop_alternating_text()
return None, None, None, None
`
It would be great if there were a way to specify a preferred audio language (in my case, Hindi) or prioritize the original/default audio track as provided by the uploader.
Let me know if there's a workaround or if this is something that can be addressed in the library!
Thanks again π
Metadata
Metadata
Assignees
Labels
Projects
Status