[deviantart:stash] fix legacy sta.sh links (#7181)
follow redirect instead of rewriting them to deviantart.com/stash/…
This commit is contained in:
@@ -1004,7 +1004,7 @@ class DeviantartStashExtractor(DeviantartExtractor):
|
||||
"""Extractor for sta.sh-ed deviations"""
|
||||
subcategory = "stash"
|
||||
archive_fmt = "{index}.{extension}"
|
||||
pattern = (r"(?:https?://)?(?:(?:www\.)?deviantart\.com/stash|sta\.sh)"
|
||||
pattern = (r"(?:https?://)?(?:(?:www\.)?deviantart\.com/stash|sta\.s(h))"
|
||||
r"/([a-z0-9]+)")
|
||||
example = "https://www.deviantart.com/stash/abcde"
|
||||
|
||||
@@ -1016,9 +1016,18 @@ class DeviantartStashExtractor(DeviantartExtractor):
|
||||
|
||||
def deviations(self, stash_id=None):
|
||||
if stash_id is None:
|
||||
stash_id = self.groups[0]
|
||||
url = "https://www.deviantart.com/stash/" + stash_id
|
||||
page = self._limited_request(url).text
|
||||
legacy_url, stash_id = self.groups
|
||||
else:
|
||||
legacy_url = False
|
||||
|
||||
if legacy_url and stash_id[0] == "2":
|
||||
url = "https://sta.sh/" + stash_id
|
||||
response = self._limited_request(url)
|
||||
stash_id = response.url.rpartition("/")[2]
|
||||
page = response.text
|
||||
else:
|
||||
url = "https://www.deviantart.com/stash/" + stash_id
|
||||
page = self._limited_request(url).text
|
||||
|
||||
if stash_id[0] == "0":
|
||||
uuid = text.extr(page, '//deviation/', '"')
|
||||
|
||||
@@ -389,6 +389,19 @@ __tests__ = (
|
||||
"#url" : "https://sta.sh/022c83odnaxc",
|
||||
"#category": ("", "deviantart", "stash"),
|
||||
"#class" : deviantart.DeviantartStashExtractor,
|
||||
"#pattern" : r"https://wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/940f2d05-c5eb-4917-8192-7eb6a2d508c6/dcvdmbc-e506cdcf-3208-4c20-85ab-0bfa8a7bcb16.png\?token=ey.+",
|
||||
"#count" : 1,
|
||||
|
||||
"date" : "dt:2018-12-26 14:49:27",
|
||||
"deviationid" : "A4A6AD52-8857-46EE-ABFE-86D49D4FF9D0",
|
||||
"download_filesize": 380,
|
||||
"extension" : "png",
|
||||
"filename" : "01_by_justatest235723-dcvdmbc",
|
||||
"index" : 778297656,
|
||||
"index_base36" : "cvdmbc",
|
||||
"published_time": 1545835767,
|
||||
"title" : "01",
|
||||
"url" : "https://www.deviantart.com/stash/022c83odnaxc",
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user