1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 04:02:32 +01:00

[deviantart] fix sta.sh folder extraction

This commit is contained in:
Mike Fährmann 2024-10-11 09:51:20 +02:00
parent 1f5f04e673
commit 5dd17910d1
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 8 additions and 20 deletions

View File

@ -907,19 +907,18 @@ class DeviantartStashExtractor(DeviantartExtractor):
archive_fmt = "{index}.{extension}"
pattern = (r"(?:https?://)?(?:(?:www\.)?deviantart\.com/stash|sta\.sh)"
r"/([a-z0-9]+)")
example = "https://sta.sh/abcde"
example = "https://www.deviantart.com/stash/abcde"
skip = Extractor.skip
def __init__(self, match):
DeviantartExtractor.__init__(self, match)
self.user = None
self.stash_id = match.group(1)
def deviations(self, stash_id=None):
if stash_id is None:
stash_id = self.stash_id
url = "https://sta.sh/" + stash_id
stash_id = self.groups[0]
url = "https://www.deviantart.com/stash/" + stash_id
page = self._limited_request(url).text
if stash_id[0] == "0":
@ -932,19 +931,11 @@ class DeviantartStashExtractor(DeviantartExtractor):
yield deviation
return
for item in text.extract_iter(
page, 'class="stash-thumb-container', '</div>'):
url = text.extr(item, '<a href="', '"')
if url:
stash_id = url.rpartition("/")[2]
else:
stash_id = text.extr(item, 'gmi-stashid="', '"')
stash_id = "2" + util.bencode(text.parse_int(
stash_id), "0123456789abcdefghijklmnopqrstuvwxyz")
if len(stash_id) > 2:
yield from self.deviations(stash_id)
for sid in text.extract_iter(
page, 'href="https://www.deviantart.com/stash/', '"'):
if sid == stash_id or sid.endswith("#comments"):
continue
yield from self.deviations(sid)
class DeviantartFavoriteExtractor(DeviantartExtractor):

View File

@ -61,7 +61,6 @@ __tests__ = (
"transparency": bool,
"width" : int,
},
"da_category" : str,
"date" : datetime.datetime,
"deviationid" : str,
"?download_filesize": int,
@ -283,7 +282,6 @@ __tests__ = (
"transparency": False,
"width" : 6400
},
"da_category" : "Uncategorized",
"date" : "dt:2024-01-02 21:16:06",
"deviationid" : "8C8D6B28-766A-DE21-7F7D-CE055C3BD50A",
"download_filesize": 84510,
@ -375,7 +373,6 @@ __tests__ = (
"height" : 128,
"src" : r"re:https://wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/940f2d05-c5eb-4917-8192-7eb6a2d508c6/dcvdmbc-e506cdcf-3208-4c20-85ab-0bfa8a7bcb16.png\?token=ey.+",
},
"da_category" : "Uncategorized",
"date" : "dt:2018-12-26 14:49:27",
"deviationid" : "A4A6AD52-8857-46EE-ABFE-86D49D4FF9D0",
"download_filesize": 380,