merge #7261: [deviantart] support multiple images for single posts
(#6653)
This commit is contained in:
@@ -1276,7 +1276,34 @@ class DeviantartDeviationExtractor(DeviantartExtractor):
|
||||
|
||||
deviation = self.api.deviation(uuid)
|
||||
deviation["_page"] = page
|
||||
return (deviation,)
|
||||
|
||||
_dev_info = text.extr(
|
||||
page, '\\"deviationExtended\\":', ',\\"deviation\\":', None)
|
||||
# Clean up escaped quotes
|
||||
_json_str = re.sub(
|
||||
r'(?<!\\)\\{1}"', '"', _dev_info).replace("\\'", "'")
|
||||
_extended_info = util.json_loads(_json_str)[self.deviation_id]
|
||||
additional_media = _extended_info.get("additionalMedia") or ()
|
||||
|
||||
if additional_media:
|
||||
self.filename_fmt = ("{category}_{index}_{index_file}_{title}_"
|
||||
"{num:>02}.{extension}")
|
||||
self.archive_fmt = ("g_{_username}_{index}{index_file:?_//}."
|
||||
"{extension}")
|
||||
|
||||
deviation["index_file"] = 0
|
||||
deviation["count"] = 1 + len(additional_media)
|
||||
deviation["num"] = 1
|
||||
yield deviation
|
||||
|
||||
for index, post in enumerate(additional_media):
|
||||
uri = post["media"]["baseUri"].encode().decode("unicode-escape")
|
||||
deviation["content"]["src"] = uri
|
||||
deviation["num"] += 1
|
||||
deviation["index_file"] = post["fileId"]
|
||||
# Download only works on purchased materials - no way to check
|
||||
deviation["is_downloadable"] = False
|
||||
yield deviation
|
||||
|
||||
|
||||
class DeviantartScrapsExtractor(DeviantartExtractor):
|
||||
|
||||
Reference in New Issue
Block a user