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:
James Taylor 2020-02-17 20:15:59 -08:00
parent 6f28d959f0
commit 8c2b81094e

View File

@ -232,7 +232,7 @@ def _extract_watch_info_desktop(top_level):
info = {
'comment_count': None,
'comments_disabled': None,
'allowed_countries': None,
'allowed_countries': [],
'limited_state': None,
}
@ -323,7 +323,8 @@ def _extract_formats(info, player_response):
query_string = info['formats'][0].get('url', '?').split('?')[1]
info['ip_address'] = deep_get(
urllib.parse.parse_qs(query_string), 'ip', 0)
else:
info['ip_address'] = None
def _extract_playability_error(info, player_response, error_prefix=''):