Skip to content

Commit

Permalink
merge #5224: [artstation] update URL patterns to recognize usernames …
Browse files Browse the repository at this point in the history
…with dashes
  • Loading branch information
mikf committed Feb 21, 2024
2 parents fe7e228 + 962f55c commit b4c46de
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gallery_dl/extractor/artstation.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class ArtstationUserExtractor(ArtstationExtractor):
subcategory = "user"
pattern = (r"(?:https?://)?(?:(?:www\.)?artstation\.com"
r"/(?!artwork|projects|search)([^/?#]+)(?:/albums/all)?"
r"|((?!www)\w+)\.artstation\.com(?:/projects)?)/?$")
r"|((?!www)[\w-]+)\.artstation\.com(?:/projects)?)/?$")
example = "https://www.artstation.com/USER"

def projects(self):
Expand All @@ -192,7 +192,7 @@ class ArtstationAlbumExtractor(ArtstationExtractor):
archive_fmt = "a_{album[id]}_{asset[id]}"
pattern = (r"(?:https?://)?(?:(?:www\.)?artstation\.com"
r"/(?!artwork|projects|search)([^/?#]+)"
r"|((?!www)\w+)\.artstation\.com)/albums/(\d+)")
r"|((?!www)[\w-]+)\.artstation\.com)/albums/(\d+)")
example = "https://www.artstation.com/USER/albums/12345"

def __init__(self, match):
Expand Down Expand Up @@ -355,7 +355,7 @@ class ArtstationImageExtractor(ArtstationExtractor):
"""Extractor for images from a single artstation project"""
subcategory = "image"
pattern = (r"(?:https?://)?(?:"
r"(?:\w+\.)?artstation\.com/(?:artwork|projects|search)"
r"(?:[\w-]+\.)?artstation\.com/(?:artwork|projects|search)"
r"|artstn\.co/p)/(\w+)")
example = "https://www.artstation.com/artwork/abcde"

Expand Down
21 changes: 21 additions & 0 deletions test/results/artstation.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,25 @@
"#count" : ">= 40",
},

{
"#url" : "https://fede-x-rojas.artstation.com/projects/WBdaZy",
"#comment" : "dash in username",
"#category": ("", "artstation", "image"),
"#class" : artstation.ArtstationImageExtractor,
},

{
"#url" : "https://fede-x-rojas.artstation.com/albums/8533110",
"#comment" : "dash in username",
"#category": ("", "artstation", "album"),
"#class" : artstation.ArtstationAlbumExtractor,
},

{
"#url" : "https://fede-x-rojas.artstation.com/",
"#comment" : "dash in username",
"#category": ("", "artstation", "user"),
"#class" : artstation.ArtstationUserExtractor,
},

)

0 comments on commit b4c46de

Please sign in to comment.