mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-22 02:01:50 +00:00
[youtube] Fix error reason extraction (#27081)
This commit is contained in:
parent
46a265a2da
commit
21292c0649
1 changed files with 15 additions and 0 deletions
|
@ -2023,6 +2023,21 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||||
formats.append(a_format)
|
formats.append(a_format)
|
||||||
else:
|
else:
|
||||||
error_message = extract_unavailable_message()
|
error_message = extract_unavailable_message()
|
||||||
|
if not error_message:
|
||||||
|
reason_list = try_get(
|
||||||
|
player_response,
|
||||||
|
lambda x: x['playabilityStatus']['errorScreen']['playerErrorMessageRenderer']['subreason']['runs'],
|
||||||
|
list) or []
|
||||||
|
for reason in reason_list:
|
||||||
|
if not isinstance(reason, dict):
|
||||||
|
continue
|
||||||
|
reason_text = try_get(reason, lambda x: x['text'], compat_str)
|
||||||
|
if reason_text:
|
||||||
|
if not error_message:
|
||||||
|
error_message = ''
|
||||||
|
error_message += reason_text
|
||||||
|
if error_message:
|
||||||
|
error_message = clean_html(error_message)
|
||||||
if not error_message:
|
if not error_message:
|
||||||
error_message = clean_html(try_get(
|
error_message = clean_html(try_get(
|
||||||
player_response, lambda x: x['playabilityStatus']['reason'],
|
player_response, lambda x: x['playabilityStatus']['reason'],
|
||||||
|
|
Loading…
Reference in a new issue