[bitchute] Improve page offset

pull/8/head
Sergey M․ 6 years ago
parent b65e3b0636
commit de4c41b437
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

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

Loading…
Cancel
Save