Skip to content

Commit

Permalink
[artstation] add extractor for artwork listings (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Feb 18, 2019
1 parent 937a802 commit 22d3a2f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/supportedsites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Turboimagehost https://www.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-0| replace:: Images from Users, Albums, Artwork Listings, Challenges, individual Images, Likes, Search Results
.. |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
Expand Down
23 changes: 23 additions & 0 deletions gallery_dl/extractor/artstation.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,29 @@ def projects(self):
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"
Expand Down

0 comments on commit 22d3a2f

Please sign in to comment.