aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/yt_data_extract
diff options
context:
space:
mode:
authorJesus <heckyel@riseup.net>2023-09-11 04:06:11 +0800
committerJesus <heckyel@riseup.net>2023-09-11 04:06:11 +0800
commitcb4ceefadad1695ac9d7530781b99510822db106 (patch)
treecb436bb0cae9f5d657e722cfc154e5e6b4aa4bc7 /youtube/yt_data_extract
parentc4cc5cecbf8b6950e450a07350727c3ce22fc5f3 (diff)
downloadyt-local-cb4ceefadad1695ac9d7530781b99510822db106.tar.lz
yt-local-cb4ceefadad1695ac9d7530781b99510822db106.tar.xz
yt-local-cb4ceefadad1695ac9d7530781b99510822db106.zip
Filter out translated audio tracks
See comment in code
Diffstat (limited to 'youtube/yt_data_extract')
-rw-r--r--youtube/yt_data_extract/watch_extraction.py7
1 files changed, 7 insertions, 0 deletions
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