aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcoletdjnz <colethedj@protonmail.com>2021-07-31 07:36:00 +1200
committerGitHub <noreply@github.com>2021-07-31 01:06:00 +0530
commit65524694334de9de4664b8b338d1bb3fa0b63f91 (patch)
tree164d0672702c7deedaa2dc9a3cb972dba3f2eb80
parent11cc45718c472b2eeb9984456c1dcbf968d7aad1 (diff)
downloadhypervideo-pre-65524694334de9de4664b8b338d1bb3fa0b63f91.tar.lz
hypervideo-pre-65524694334de9de4664b8b338d1bb3fa0b63f91.tar.xz
hypervideo-pre-65524694334de9de4664b8b338d1bb3fa0b63f91.zip
[youtube] Force `hl=en` for comments (#594)
Closes #532
-rw-r--r--yt_dlp/extractor/youtube.py6
1 files changed, 5 insertions, 1 deletions
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 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
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: