From 655b2de5d9158aac7f4c9e6197fbc33c9e8bab99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 13 Feb 2022 17:46:53 +0100 Subject: [PATCH] [vk] fix infinite pagination loops (fixes #2297) --- gallery_dl/extractor/vk.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gallery_dl/extractor/vk.py b/gallery_dl/extractor/vk.py index ed565bc3..dd2eb4e4 100644 --- a/gallery_dl/extractor/vk.py +++ b/gallery_dl/extractor/vk.py @@ -34,7 +34,6 @@ class VkExtractor(Extractor): 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", @@ -56,7 +55,9 @@ class VkExtractor(Extractor): 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])