mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
[artstation] support collections (#146)
https://github.com/mikf/gallery-dl/issues/146#issuecomment-1972101003
This commit is contained in:
parent
32ec695195
commit
cf9e99c07b
@ -100,7 +100,7 @@ Consider all listed sites to potentially be NSFW.
|
||||
<tr>
|
||||
<td>ArtStation</td>
|
||||
<td>https://www.artstation.com/</td>
|
||||
<td>Albums, Artwork Listings, Challenges, Followed Users, individual Images, Likes, Search Results, User Profiles</td>
|
||||
<td>Albums, Artwork Listings, Challenges, Collections, Followed Users, individual Images, Likes, Search Results, User Profiles</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -226,7 +226,7 @@ class ArtstationLikesExtractor(ArtstationExtractor):
|
||||
directory_fmt = ("{category}", "{userinfo[username]}", "Likes")
|
||||
archive_fmt = "f_{userinfo[id]}_{asset[id]}"
|
||||
pattern = (r"(?:https?://)?(?:www\.)?artstation\.com"
|
||||
r"/(?!artwork|projects|search)([^/?#]+)/likes/?")
|
||||
r"/(?!artwork|projects|search)([^/?#]+)/likes")
|
||||
example = "https://www.artstation.com/USER/likes"
|
||||
|
||||
def projects(self):
|
||||
@ -234,6 +234,54 @@ class ArtstationLikesExtractor(ArtstationExtractor):
|
||||
return self._pagination(url)
|
||||
|
||||
|
||||
class ArtstationCollectionExtractor(ArtstationExtractor):
|
||||
"""Extractor for an artstation collection"""
|
||||
subcategory = "collection"
|
||||
directory_fmt = ("{category}", "{user}",
|
||||
"{collection[id]} {collection[name]}")
|
||||
archive_fmt = "c_{collection[id]}_{asset[id]}"
|
||||
pattern = (r"(?:https?://)?(?:www\.)?artstation\.com"
|
||||
r"/(?!artwork|projects|search)([^/?#]+)/collections/(\d+)")
|
||||
example = "https://www.artstation.com/USER/collections/12345"
|
||||
|
||||
def __init__(self, match):
|
||||
ArtstationExtractor.__init__(self, match)
|
||||
self.collection_id = match.group(2)
|
||||
|
||||
def metadata(self):
|
||||
url = "{}/collections/{}.json".format(
|
||||
self.root, self.collection_id)
|
||||
params = {"username": self.user}
|
||||
collection = self.request(
|
||||
url, params=params, notfound="collection").json()
|
||||
return {"collection": collection, "user": self.user}
|
||||
|
||||
def projects(self):
|
||||
url = "{}/collections/{}/projects.json".format(
|
||||
self.root, self.collection_id)
|
||||
params = {"collection_id": self.collection_id}
|
||||
return self._pagination(url, params)
|
||||
|
||||
|
||||
class ArtstationCollectionsExtractor(ArtstationExtractor):
|
||||
"""Extractor for an artstation user's collections"""
|
||||
subcategory = "collections"
|
||||
pattern = (r"(?:https?://)?(?:www\.)?artstation\.com"
|
||||
r"/(?!artwork|projects|search)([^/?#]+)/collections/?$")
|
||||
example = "https://www.artstation.com/USER/collections"
|
||||
|
||||
def items(self):
|
||||
url = self.root + "/collections.json"
|
||||
params = {"username": self.user}
|
||||
|
||||
for collection in self.request(
|
||||
url, params=params, notfound="collections").json():
|
||||
url = "{}/{}/collections/{}".format(
|
||||
self.root, self.user, collection["id"])
|
||||
collection["_extractor"] = ArtstationCollectionExtractor
|
||||
yield Message.Queue, url, collection
|
||||
|
||||
|
||||
class ArtstationChallengeExtractor(ArtstationExtractor):
|
||||
"""Extractor for submissions of artstation challenges"""
|
||||
subcategory = "challenge"
|
||||
|
@ -176,6 +176,7 @@ SUBCATEGORY_MAP = {
|
||||
|
||||
"artstation": {
|
||||
"artwork": "Artwork Listings",
|
||||
"collections": "",
|
||||
},
|
||||
"bluesky": {
|
||||
"posts": "",
|
||||
|
@ -64,6 +64,44 @@ __tests__ = (
|
||||
"#count" : 6,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.artstation.com/mikf/collections/2647023",
|
||||
"#category": ("", "artstation", "collection"),
|
||||
"#class" : artstation.ArtstationCollectionExtractor,
|
||||
"#count" : 10,
|
||||
|
||||
"collection": {
|
||||
"active_projects_count": 3,
|
||||
"id" : 2647023,
|
||||
"is_private" : False,
|
||||
"micro_square_image_url": "https://cdna.artstation.com/p/assets/images/images/005/131/434/micro_square/gaeri-kim-cat-front.jpg?1488720625",
|
||||
"name" : "テスト",
|
||||
"projects_count": 3,
|
||||
"small_square_image_url": "https://cdna.artstation.com/p/assets/images/images/005/131/434/small_square/gaeri-kim-cat-front.jpg?1488720625",
|
||||
"user_id" : 697975,
|
||||
},
|
||||
"user": "mikf",
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.artstation.com/mikf/collections",
|
||||
"#category": ("", "artstation", "collections"),
|
||||
"#class" : artstation.ArtstationCollectionsExtractor,
|
||||
"#urls" : (
|
||||
"https://www.artstation.com/mikf/collections/2647023",
|
||||
"https://www.artstation.com/mikf/collections/2647719",
|
||||
),
|
||||
|
||||
"active_projects_count": int,
|
||||
"id" : range(2647023, 2647719),
|
||||
"is_private" : False,
|
||||
"micro_square_image_url": str,
|
||||
"name" : r"re:テスト|empty",
|
||||
"projects_count": int,
|
||||
"small_square_image_url": str,
|
||||
"user_id" : 697975,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.artstation.com/sungchoi/likes",
|
||||
"#comment" : "no likes",
|
||||
|
Loading…
Reference in New Issue
Block a user