about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2020-12-09 04:02:50 +0700
committerSergey M․ <dstftw@gmail.com>2020-12-09 04:06:44 +0700
commite029da9addef9e41ec9db4a85165ef8e1e352636 (patch)
treea35466d65fbd2c22a0e77bf79715040839b7b0b5
parente00b8f60d4ad662d1737e80f154f7afeb738494c (diff)
downloadyoutube-dl-e029da9addef9e41ec9db4a85165ef8e1e352636.tar.gz
youtube-dl-e029da9addef9e41ec9db4a85165ef8e1e352636.tar.xz
youtube-dl-e029da9addef9e41ec9db4a85165ef8e1e352636.zip
[youtube:tab] Make click tracking params on continuation optional
-rw-r--r--youtube_dl/extractor/youtube.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index a3f75b626..052926ee5 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -2871,6 +2871,16 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
                 yield entry
 
     @staticmethod
+    def _build_continuation_query(continuation, ctp=None):
+        query = {
+            'ctoken': continuation,
+            'continuation': continuation,
+        }
+        if ctp:
+            query['itct'] = ctp
+        return query
+
+    @staticmethod
     def _extract_next_continuation_data(renderer):
         next_continuation = try_get(
             renderer, lambda x: x['continuations'][0]['nextContinuationData'], dict)
@@ -2880,11 +2890,7 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
         if not continuation:
             return
         ctp = next_continuation.get('clickTrackingParams')
-        return {
-            'ctoken': continuation,
-            'continuation': continuation,
-            'itct': ctp,
-        }
+        return YoutubeTabIE._build_continuation_query(continuation, ctp)
 
     @classmethod
     def _extract_continuation(cls, renderer):
@@ -2907,13 +2913,7 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
             if not continuation:
                 continue
             ctp = continuation_ep.get('clickTrackingParams')
-            if not ctp:
-                continue
-            return {
-                'ctoken': continuation,
-                'continuation': continuation,
-                'itct': ctp,
-            }
+            return YoutubeTabIE._build_continuation_query(continuation, ctp)
 
     def _entries(self, tab, identity_token):
         tab_content = try_get(tab, lambda x: x['content'], dict)