[vk] fix infinite pagination loops (fixes #2297)
This commit is contained in:
parent
cc5b1ce91a
commit
655b2de5d9
@ -34,7 +34,6 @@ class VkExtractor(Extractor):
|
|||||||
def _pagination(self, photos_url, user_id):
|
def _pagination(self, photos_url, user_id):
|
||||||
sub = re.compile(r"/imp[fg]/").sub
|
sub = re.compile(r"/imp[fg]/").sub
|
||||||
needle = 'data-id="{}_'.format(user_id)
|
needle = 'data-id="{}_'.format(user_id)
|
||||||
cnt = 0
|
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
"X-Requested-With": "XMLHttpRequest",
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
@ -56,7 +55,9 @@ class VkExtractor(Extractor):
|
|||||||
offset = payload[0]
|
offset = payload[0]
|
||||||
html = payload[1]
|
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('"')]
|
pid = photo[:photo.find('"')]
|
||||||
url = photo[photo.rindex("(")+1:]
|
url = photo[photo.rindex("(")+1:]
|
||||||
url = sub("/", url.partition("?")[0])
|
url = sub("/", url.partition("?")[0])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user