From 65524694334de9de4664b8b338d1bb3fa0b63f91 Mon Sep 17 00:00:00 2001 From: coletdjnz Date: Sat, 31 Jul 2021 07:36:00 +1200 Subject: [PATCH] [youtube] Force `hl=en` for comments (#594) Closes #532 --- yt_dlp/extractor/youtube.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index 47e3c2f44..d9d414d75 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -2394,7 +2394,11 @@ def _real_comment_extract(contents): known_entry_comment_renderers = ('itemSectionRenderer',) estimated_total = 0 max_comments = int_or_none(self._configuration_arg('max_comments', [''])[0]) or float('inf') - + # Force English regardless of account setting to prevent parsing issues + # See: https://github.com/yt-dlp/yt-dlp/issues/532 + ytcfg = copy.deepcopy(ytcfg) + traverse_obj( + ytcfg, ('INNERTUBE_CONTEXT', 'client'), expected_type=dict, default={})['hl'] = 'en' try: for comment in _real_comment_extract(contents): if len(comments) >= max_comments: