[deviantart] fix non-terminating loop
This commit is contained in:
@@ -38,14 +38,16 @@ class DeviantArtUserExtractor(AsynchronousExtractor):
|
|||||||
url = "http://{}.deviantart.com/gallery/".format(self.artist)
|
url = "http://{}.deviantart.com/gallery/".format(self.artist)
|
||||||
params = {"catpath": "/", "offset": 0}
|
params = {"catpath": "/", "offset": 0}
|
||||||
while True:
|
while True:
|
||||||
|
num = 0
|
||||||
page = self.request(url, params=params).text
|
page = self.request(url, params=params).text
|
||||||
_, pos = text.extract(page, '<div data-dwait-click="GMI.wake"', '')
|
_, pos = text.extract(page, '<div data-dwait-click="GMI.wake"', '')
|
||||||
while True:
|
while True:
|
||||||
image_info, pos = text.extract(page, '<a class="thumb', '</a>', pos)
|
image_info, pos = text.extract(page, '<a class="thumb', '</a>', pos)
|
||||||
if not image_info:
|
if not image_info:
|
||||||
break
|
break
|
||||||
|
num += 1
|
||||||
yield self.get_image_metadata(image_info)
|
yield self.get_image_metadata(image_info)
|
||||||
if pos == 0:
|
if num != 24:
|
||||||
break
|
break
|
||||||
params["offset"] += 24
|
params["offset"] += 24
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user