[artstation] add extractor for artwork listings (#80)

like https://www.artstation.com/artwork?sorting=latest
or   https://www.artstation.com/artwork?sorting=picks
This commit is contained in:
Mike Fährmann
2019-02-18 12:45:44 +01:00
parent 937a802b49
commit 22d3a2fcc8
2 changed files with 24 additions and 1 deletions

View File

@@ -300,6 +300,29 @@ class ArtstationSearchExtractor(ArtstationExtractor):
return self._pagination(url, params)
class ArtstationArtworkExtractor(ArtstationExtractor):
"""Extractor for projects on artstation's artwork page"""
subcategory = "artwork"
directory_fmt = ("{category}", "Artworks", "{artwork[sorting]!c}")
archive_fmt = "A_{asset[id]}"
pattern = (r"(?:https?://)?(?:\w+\.)?artstation\.com"
r"/artwork/?\?([^#]+)")
test = ("https://www.artstation.com/artwork?sorting=latest",)
def __init__(self, match):
ArtstationExtractor.__init__(self, match)
self.query = text.parse_query(match.group(1))
def metadata(self):
return {"artwork": self.query}
def projects(self):
url = "{}/projects.json".format(self.root)
params = self.query.copy()
params["page"] = 1
return self._pagination(url, params)
class ArtstationImageExtractor(ArtstationExtractor):
"""Extractor for images from a single artstation project"""
subcategory = "image"