]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[bitchute] Improve page offset
authorSergey M․ <dstftw@gmail.com>
Sat, 11 Aug 2018 18:52:50 +0000 (01:52 +0700)
committerSergey M․ <dstftw@gmail.com>
Sat, 11 Aug 2018 18:52:50 +0000 (01:52 +0700)
youtube_dl/extractor/bitchute.py

index 28016f18b23c77471177e57d5f750b5ff8e348cc..da263714ab62caad78f60b01eb33148f6f9abb99 100644 (file)
@@ -81,14 +81,15 @@ class BitChuteChannelIE(InfoExtractor):
 
     def _entries(self, channel_id):
         channel_url = 'https://www.bitchute.com/channel/%s/' % channel_id
-        for page_num in itertools.count(0):
+        offset = 0
+        for page_num in itertools.count(1):
             data = self._download_json(
                 '%sextend/' % channel_url, channel_id,
-                'Downloading channel page %d' % (page_num + 1),
+                'Downloading channel page %d' % page_num,
                 data=urlencode_postdata({
                     'csrfmiddlewaretoken': self._TOKEN,
                     'name': '',
-                    'offset': page_num * 25
+                    'offset': offset,
                 }), headers={
                     'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
                     'Referer': channel_url,
@@ -105,6 +106,7 @@ class BitChuteChannelIE(InfoExtractor):
                 html)
             if not video_ids:
                 break
+            offset += len(video_ids)
             for video_id in video_ids:
                 yield self.url_result(
                     'https://www.bitchute.com/video/%s' % video_id,