aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/yt_data_extract
diff options
context:
space:
mode:
Diffstat (limited to 'youtube/yt_data_extract')
-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