From 9f090dbbf82a212b5e4b82f99ec48ec15c0946b0 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sat, 1 Feb 2020 16:16:49 -0800 Subject: Watch page: add info box with allowed countries and tor exit node Should help with debugging various content blocks --- youtube/yt_data_extract/watch_extraction.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'youtube/yt_data_extract') diff --git a/youtube/yt_data_extract/watch_extraction.py b/youtube/yt_data_extract/watch_extraction.py index 6c0899b..67cee35 100644 --- a/youtube/yt_data_extract/watch_extraction.py +++ b/youtube/yt_data_extract/watch_extraction.py @@ -318,6 +318,14 @@ def _extract_formats(info, player_response): info['formats'].append(fmt) + # get ip address + if info['formats']: + query_string = info['formats'][0].get('url', '?').split('?')[1] + info['ip_address'] = deep_get( + urllib.parse.parse_qs(query_string), 'ip', 0) + + + def _extract_playability_error(info, player_response, error_prefix=''): if info['formats']: info['playability_status'] = None -- cgit v1.2.3