[deviantart] fix 'index' values for stashed deviations
This commit is contained in:
@@ -137,11 +137,12 @@ class DeviantartExtractor(Extractor):
|
|||||||
|
|
||||||
def prepare(self, deviation):
|
def prepare(self, deviation):
|
||||||
"""Adjust the contents of a Deviation-object"""
|
"""Adjust the contents of a Deviation-object"""
|
||||||
try:
|
if "index" not in deviation:
|
||||||
deviation["index"] = text.parse_int(
|
try:
|
||||||
deviation["url"].rpartition("-")[2])
|
deviation["index"] = text.parse_int(
|
||||||
except KeyError:
|
deviation["url"].rpartition("-")[2])
|
||||||
deviation["index"] = 0
|
except KeyError:
|
||||||
|
deviation["index"] = 0
|
||||||
|
|
||||||
if self.user:
|
if self.user:
|
||||||
deviation["username"] = self.user
|
deviation["username"] = self.user
|
||||||
@@ -602,7 +603,10 @@ class DeviantartStashExtractor(DeviantartExtractor):
|
|||||||
if stash_id[0] == "0":
|
if stash_id[0] == "0":
|
||||||
uuid = text.extract(page, '//deviation/', '"')[0]
|
uuid = text.extract(page, '//deviation/', '"')[0]
|
||||||
if uuid:
|
if uuid:
|
||||||
yield self.api.deviation(uuid)
|
deviation = self.api.deviation(uuid)
|
||||||
|
deviation["index"] = text.parse_int(text.extract(
|
||||||
|
page, 'gmi-deviationid="', '"')[0])
|
||||||
|
yield deviation
|
||||||
return
|
return
|
||||||
|
|
||||||
for item in text.extract_iter(
|
for item in text.extract_iter(
|
||||||
|
|||||||
Reference in New Issue
Block a user