[deviantart] add separate 'sta.sh' extractor (#113)
- supports multiple stashed deviations per page - explicitly mentions sta.sh support on supportedsites.rst
This commit is contained in:
@@ -39,6 +39,7 @@ ImageFap https://imagefap.com/ Images from Users, Gall
|
||||
imgbox https://imgbox.com/ Galleries, individual Images
|
||||
imgth https://imgth.com/ Galleries
|
||||
imgur https://imgur.com/ Albums, individual Images
|
||||
Instagram https://www.instagram.com/ Images from Users, individual Images
|
||||
Jaimini's Box https://jaiminisbox.com/ Chapters, Manga
|
||||
Joyreactor http://joyreactor.cc/ Images from Users, Posts, Tag-Searches
|
||||
Khinsider https://downloads.khinsider.com/ Soundtracks
|
||||
@@ -100,7 +101,7 @@ Turboimagehost https://turboimagehost.com/ individual Images
|
||||
|
||||
.. |Site-0| replace:: yuki.la 4chan archive
|
||||
.. |Capabilities-0| replace:: Images from Users, Albums, Challenges, individual Images, Likes, Search Results
|
||||
.. |Capabilities-1| replace:: Collections, Deviations, Favorites, Folders, Galleries, Journals, Popular Images
|
||||
.. |Capabilities-1| replace:: Collections, Deviations, Favorites, Folders, Galleries, Journals, Popular Images, Sta.sh
|
||||
.. |Capabilities-2| replace:: Images from Users, Albums, Favorites, Galleries, Groups, individual Images, Search Results
|
||||
.. |Capabilities-3| replace:: Images from Users, Favorites, individual Images, Popular Images, Recent Images, Scraps
|
||||
.. |Capabilities-4| replace:: Images from Users, Doujin, Favorites, individual Images
|
||||
|
||||
@@ -275,8 +275,7 @@ class DeviantartDeviationExtractor(DeviantartExtractor):
|
||||
"""Extractor for single deviations"""
|
||||
subcategory = "deviation"
|
||||
archive_fmt = "{index}.{extension}"
|
||||
pattern = [BASE_PATTERN + r"/(?:art|journal)/[^/?&#]+-\d+",
|
||||
r"(?:https?://)?sta\.sh/()()[a-z0-9]+"]
|
||||
pattern = [BASE_PATTERN + r"/(?:art|journal)/[^/?&#]+-\d+"]
|
||||
test = [
|
||||
(("https://www.deviantart.com/shimoda7/art/"
|
||||
"For-the-sake-of-a-memory-10073852"), {
|
||||
@@ -287,13 +286,6 @@ class DeviantartDeviationExtractor(DeviantartExtractor):
|
||||
("https://www.deviantart.com/zzz/art/zzz-1234567890", {
|
||||
"exception": exception.NotFoundError,
|
||||
}),
|
||||
("https://sta.sh/01ijs78ebagf", {
|
||||
"url": "35c0cd0e51494a1e01bddf5414a0d1585cd9fb0e",
|
||||
"keyword": "d0c01d39b05519e4812cd3c7ac8267363171c053",
|
||||
}),
|
||||
("https://sta.sh/abcdefghijkl", {
|
||||
"exception": exception.NotFoundError,
|
||||
}),
|
||||
(("https://www.deviantart.com/myria-moon/art/"
|
||||
"Aime-Moi-part-en-vadrouille-261986576"), {
|
||||
"pattern": (r"https?://s3\.amazonaws\.com/origin-orig\."
|
||||
@@ -320,6 +312,38 @@ class DeviantartDeviationExtractor(DeviantartExtractor):
|
||||
return (self.api.deviation(deviation_id),)
|
||||
|
||||
|
||||
class DeviantartStashExtractor(DeviantartDeviationExtractor):
|
||||
"""Extractor for sta.sh-ed deviations"""
|
||||
subcategory = "stash"
|
||||
archive_fmt = "{index}.{extension}"
|
||||
pattern = [r"(?:https?://)?sta\.sh/()()[a-z0-9]+"]
|
||||
test = [
|
||||
("https://sta.sh/022c83odnaxc", {
|
||||
"pattern": r"https://s3.amazonaws.com/origin-orig.deviantart.net",
|
||||
"count": 1,
|
||||
}),
|
||||
("https://sta.sh/21jf51j7pzl2", {
|
||||
"pattern": pattern[0],
|
||||
"count": 4,
|
||||
}),
|
||||
("https://sta.sh/abcdefghijkl", {
|
||||
"exception": exception.HttpError,
|
||||
}),
|
||||
]
|
||||
|
||||
def deviations(self):
|
||||
page = self.request(self.url).text
|
||||
deviation_id = text.extract(page, '//deviation/', '"')[0]
|
||||
|
||||
if deviation_id:
|
||||
yield self.api.deviation(deviation_id)
|
||||
else:
|
||||
page = text.extract(
|
||||
page, '<div id="stash-body"', '<div class="footer"')[0]
|
||||
for url in text.extract_iter(page, '<a href="', '"'):
|
||||
yield url, {}
|
||||
|
||||
|
||||
class DeviantartFavoriteExtractor(DeviantartExtractor):
|
||||
"""Extractor for an artist's favorites"""
|
||||
subcategory = "favorite"
|
||||
|
||||
@@ -77,6 +77,7 @@ SUBCATEGORY_MAP = {
|
||||
"popular": "Popular Images",
|
||||
"recent" : "Recent Images",
|
||||
"search" : "Search Results",
|
||||
"stash" : "Sta.sh",
|
||||
"status" : "Images from Statuses",
|
||||
"tag" : "Tag-Searches",
|
||||
"user" : "Images from Users",
|
||||
|
||||
@@ -24,7 +24,6 @@ TRAVIS_SKIP = {
|
||||
# temporary issues, etc.
|
||||
BROKEN = {
|
||||
"deviantart",
|
||||
"imgspice",
|
||||
"readcomiconline",
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user