From cb4ceefadad1695ac9d7530781b99510822db106 Mon Sep 17 00:00:00 2001 From: Jesus Date: Mon, 11 Sep 2023 04:06:11 +0800 Subject: Filter out translated audio tracks See comment in code --- youtube/yt_data_extract/watch_extraction.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'youtube') diff --git a/youtube/yt_data_extract/watch_extraction.py b/youtube/yt_data_extract/watch_extraction.py index 9dcfeab..6090e44 100644 --- a/youtube/yt_data_extract/watch_extraction.py +++ b/youtube/yt_data_extract/watch_extraction.py @@ -463,6 +463,13 @@ def _extract_formats(info, player_response): for yt_fmt in yt_formats: itag = yt_fmt.get('itag') + # Translated audio track + # Example: https://www.youtube.com/watch?v=gF9kkB0UWYQ + # Only get the original language for now so a foreign + # translation will not be picked just because it comes first + if deep_get(yt_fmt, 'audioTrack', 'audioIsDefault') is False: + continue + fmt = {} fmt['itag'] = itag fmt['ext'] = None -- cgit v1.2.3