yt_data_extract: fix missing variables in info for unavailable videos
'ip_address' was not set when no formats are available 'allowed_countries' was set to None rather than [] in extract_desktop_info which it turns out is the function that gets used in these cases
This commit is contained in:
parent
6f28d959f0
commit
8c2b81094e
@ -232,7 +232,7 @@ def _extract_watch_info_desktop(top_level):
|
|||||||
info = {
|
info = {
|
||||||
'comment_count': None,
|
'comment_count': None,
|
||||||
'comments_disabled': None,
|
'comments_disabled': None,
|
||||||
'allowed_countries': None,
|
'allowed_countries': [],
|
||||||
'limited_state': None,
|
'limited_state': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,7 +323,8 @@ def _extract_formats(info, player_response):
|
|||||||
query_string = info['formats'][0].get('url', '?').split('?')[1]
|
query_string = info['formats'][0].get('url', '?').split('?')[1]
|
||||||
info['ip_address'] = deep_get(
|
info['ip_address'] = deep_get(
|
||||||
urllib.parse.parse_qs(query_string), 'ip', 0)
|
urllib.parse.parse_qs(query_string), 'ip', 0)
|
||||||
|
else:
|
||||||
|
info['ip_address'] = None
|
||||||
|
|
||||||
|
|
||||||
def _extract_playability_error(info, player_response, error_prefix=''):
|
def _extract_playability_error(info, player_response, error_prefix=''):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user