diff options
author | James Taylor <user234683@users.noreply.github.com> | 2020-02-17 20:15:59 -0800 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2020-02-17 20:15:59 -0800 |
commit | 8c2b81094ec277865f613aacfa6626bf271a4ab8 (patch) | |
tree | d20202ce715d7e8ec7abbeded905a50ca1dc856b /youtube/yt_data_extract | |
parent | 6f28d959f00e517ba5c36e486041f7fdaa329e6d (diff) | |
download | yt-local-8c2b81094ec277865f613aacfa6626bf271a4ab8.tar.lz yt-local-8c2b81094ec277865f613aacfa6626bf271a4ab8.tar.xz yt-local-8c2b81094ec277865f613aacfa6626bf271a4ab8.zip |
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
Diffstat (limited to 'youtube/yt_data_extract')
-rw-r--r-- | youtube/yt_data_extract/watch_extraction.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/youtube/yt_data_extract/watch_extraction.py b/youtube/yt_data_extract/watch_extraction.py index 67cee35..bc02313 100644 --- a/youtube/yt_data_extract/watch_extraction.py +++ b/youtube/yt_data_extract/watch_extraction.py @@ -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=''): |