Skip to content

Commit

Permalink
[vk] fix infinite pagination loops (fixes #2297)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Feb 13, 2022
1 parent cc5b1ce commit 655b2de
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gallery_dl/extractor/vk.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def items(self):
def _pagination(self, photos_url, user_id):
sub = re.compile(r"/imp[fg]/").sub
needle = 'data-id="{}_'.format(user_id)
cnt = 0

headers = {
"X-Requested-With": "XMLHttpRequest",
Expand All @@ -56,7 +55,9 @@ def _pagination(self, photos_url, user_id):
offset = payload[0]
html = payload[1]

for cnt, photo in enumerate(text.extract_iter(html, needle, ')')):
cnt = 0
for photo in text.extract_iter(html, needle, ')'):
cnt += 1
pid = photo[:photo.find('"')]
url = photo[photo.rindex("(")+1:]
url = sub("/", url.partition("?")[0])
Expand Down

0 comments on commit 655b2de

Please sign in to comment.