mirror of
https://github.com/mikf/gallery-dl.git
synced 2025-02-01 03:51:42 +01:00
[deviantart] fix sta.sh extraction (436)
This commit is contained in:
parent
1032cfa34b
commit
94eb7c6cad
@ -53,7 +53,7 @@ class _8musesAlbumExtractor(Extractor):
|
|||||||
"private": False,
|
"private": False,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
("https://www.8muses.com/comics/album/Fakku-Comics/6?sort=az", {
|
("https://www.8muses.com/comics/album/Fakku-Comics/7?sort=az", {
|
||||||
"count": ">= 70",
|
"count": ">= 70",
|
||||||
"keyword": {"name": r"re:^[R-Zr-z]"},
|
"keyword": {"name": r"re:^[R-Zr-z]"},
|
||||||
}),
|
}),
|
||||||
|
@ -92,7 +92,8 @@ class DeviantartExtractor(Extractor):
|
|||||||
yield self.commit(deviation, content)
|
yield self.commit(deviation, content)
|
||||||
|
|
||||||
elif deviation["is_downloadable"]:
|
elif deviation["is_downloadable"]:
|
||||||
content = self.api.deviation_download(deviation["deviationid"])
|
content = {}
|
||||||
|
self._update_content(deviation, content)
|
||||||
yield self.commit(deviation, content)
|
yield self.commit(deviation, content)
|
||||||
|
|
||||||
if "videos" in deviation:
|
if "videos" in deviation:
|
||||||
@ -392,7 +393,7 @@ class DeviantartStashExtractor(DeviantartExtractor):
|
|||||||
pattern = r"(?:https?://)?sta\.sh/([a-z0-9]+)"
|
pattern = r"(?:https?://)?sta\.sh/([a-z0-9]+)"
|
||||||
test = (
|
test = (
|
||||||
("https://sta.sh/022c83odnaxc", {
|
("https://sta.sh/022c83odnaxc", {
|
||||||
"pattern": r"https://s3.amazonaws.com/origin-orig.deviantart.net",
|
"pattern": r"https://sta.sh/download/7549925030122512/.+\?token=",
|
||||||
"count": 1,
|
"count": 1,
|
||||||
}),
|
}),
|
||||||
# multiple stash items
|
# multiple stash items
|
||||||
@ -402,6 +403,7 @@ class DeviantartStashExtractor(DeviantartExtractor):
|
|||||||
}),
|
}),
|
||||||
# downloadable, but no "content" field (#307)
|
# downloadable, but no "content" field (#307)
|
||||||
("https://sta.sh/024t4coz16mi", {
|
("https://sta.sh/024t4coz16mi", {
|
||||||
|
"pattern": r"https://sta.sh/download/7800709982190282/.+\?token=",
|
||||||
"count": 1,
|
"count": 1,
|
||||||
}),
|
}),
|
||||||
("https://sta.sh/abcdefghijkl", {
|
("https://sta.sh/abcdefghijkl", {
|
||||||
@ -419,16 +421,34 @@ class DeviantartStashExtractor(DeviantartExtractor):
|
|||||||
def deviations(self):
|
def deviations(self):
|
||||||
url = "https://sta.sh/" + self.stash_id
|
url = "https://sta.sh/" + self.stash_id
|
||||||
page = self.request(url).text
|
page = self.request(url).text
|
||||||
deviation_id = text.extract(page, '//deviation/', '"')[0]
|
deviation_id, pos = text.extract(page, '//deviation/', '"')
|
||||||
|
|
||||||
if deviation_id:
|
if deviation_id:
|
||||||
yield self.api.deviation(deviation_id)
|
deviation = self.api.deviation(deviation_id)
|
||||||
|
pos = page.find("dev-page-download", pos)
|
||||||
|
if pos >= 0:
|
||||||
|
deviation["_download"] = {
|
||||||
|
"width" : text.parse_int(text.extract(
|
||||||
|
page, 'data-download_width="' , '"', pos)[0]),
|
||||||
|
"height": text.parse_int(text.extract(
|
||||||
|
page, 'data-download_height="', '"', pos)[0]),
|
||||||
|
"src" : text.unescape(text.extract(
|
||||||
|
page, 'data-download_url="' , '"', pos)[0]),
|
||||||
|
}
|
||||||
|
return (deviation,)
|
||||||
else:
|
else:
|
||||||
data = {"_extractor": DeviantartStashExtractor}
|
data = {"_extractor": DeviantartStashExtractor}
|
||||||
page = text.extract(
|
page = text.extract(
|
||||||
page, '<div id="stash-body"', '<div class="footer"')[0]
|
page, 'id="stash-body"', 'class="footer"', pos)[0]
|
||||||
for url in text.extract_iter(page, '<a href="', '"'):
|
return [
|
||||||
yield url, data
|
(url, data)
|
||||||
|
for url in text.extract_iter(page, '<a href="', '"')
|
||||||
|
]
|
||||||
|
|
||||||
|
def _update_content(self, deviation, content):
|
||||||
|
if "_download" in deviation:
|
||||||
|
content.update(deviation["_download"])
|
||||||
|
del deviation["_download"]
|
||||||
|
|
||||||
|
|
||||||
class DeviantartFavoriteExtractor(DeviantartExtractor):
|
class DeviantartFavoriteExtractor(DeviantartExtractor):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user