aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/yt_data_extract/watch_extraction.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2020-02-01 16:16:49 -0800
committerJames Taylor <user234683@users.noreply.github.com>2020-02-01 16:16:49 -0800
commit9f090dbbf82a212b5e4b82f99ec48ec15c0946b0 (patch)
tree75d46cd26efc0697ff81bc2b5a937d803fc8b5c8 /youtube/yt_data_extract/watch_extraction.py
parent3f310bfc3308be5cede232339a724abe413d4d96 (diff)
downloadyt-local-9f090dbbf82a212b5e4b82f99ec48ec15c0946b0.tar.lz
yt-local-9f090dbbf82a212b5e4b82f99ec48ec15c0946b0.tar.xz
yt-local-9f090dbbf82a212b5e4b82f99ec48ec15c0946b0.zip
Watch page: add info box with allowed countries and tor exit node
Should help with debugging various content blocks
Diffstat (limited to 'youtube/yt_data_extract/watch_extraction.py')
-rw-r--r--youtube/yt_data_extract/watch_extraction.py8
1 files changed, 8 insertions, 0 deletions
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