From 6c61472dafbfb0388a3c8c42a46afbd81a50569f Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sat, 15 Sep 2018 17:54:12 -0700 Subject: Display latency/read-time for comment retrieval --- youtube/comments.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'youtube/comments.py') diff --git a/youtube/comments.py b/youtube/comments.py index 5bfcdbd..3e22947 100644 --- a/youtube/comments.py +++ b/youtube/comments.py @@ -118,9 +118,9 @@ def request_comments(ctoken, replies=False): else: base_url = "https://m.youtube.com/watch_comment?action_get_comments=1&ctoken=" url = base_url + ctoken.replace("=", "%3D") + "&pbj=1" - print("Sending comments ajax request") + for i in range(0,8): # don't retry more than 8 times - content = fetch_url(url, headers=mobile_headers) + content = fetch_url(url, headers=mobile_headers, report_text="Retrieved comments") if content[0:4] == b")]}'": # random closing characters included at beginning of response for some reason content = content[4:] elif content[0:10] == b'\n