[behance] provide 'creator[name]' metadata (#7885)

This commit is contained in:
Mike Fährmann
2025-07-24 15:30:51 +02:00
parent 849a5b191f
commit aa6c2dcbac
2 changed files with 50 additions and 16 deletions

View File

@@ -51,10 +51,10 @@ class BehanceExtractor(Extractor):
def _update(self, data):
# compress data to simple lists
if data.get("fields") and isinstance(data["fields"][0], dict):
if (fields := data.get("fields")) and isinstance(fields[0], dict):
data["fields"] = [
field.get("name") or field.get("label")
for field in data["fields"]
for field in fields
]
data["owners"] = [
@@ -70,6 +70,9 @@ class BehanceExtractor(Extractor):
data["date"] = text.parse_timestamp(
data.get("publishedOn") or data.get("conceived_on") or 0)
if creator := data.get("creator"):
creator["name"] = creator["url"].rpartition("/")[2]
# backwards compatibility
data["gallery_id"] = data["id"]
data["title"] = data["name"]

View File

@@ -11,7 +11,6 @@ from gallery_dl import exception
__tests__ = (
{
"#url" : "https://www.behance.net/gallery/17386197/A-Short-Story",
"#category": ("", "behance", "gallery"),
"#class" : behance.BehanceGalleryExtractor,
"#results" : (
"ytdl:https://player.vimeo.com/video/97189640?title=0&byline=0&portrait=0&color=ffffff",
@@ -19,70 +18,101 @@ __tests__ = (
),
"id" : 17386197,
"date" : "dt:2014-06-03 15:41:51",
"name" : r"re:\"Hi\". A short story about the important things ",
"module": dict,
"owners": [
"Place Studio",
"Julio César Velazquez",
],
"creator": {
"displayName" : "Place Studio",
"hasAllowEmbeds" : True,
"hasPremiumAccess": False,
"id" : 119690,
"name" : "weareplace",
"url" : "https://www.behance.net/weareplace",
},
"?fields": [
"Animation",
"Character Design",
"Directing",
],
"tags" : list,
"module": dict,
"date" : "dt:2014-06-03 15:41:51",
"tags": [
"short",
"life",
"motion",
"hi",
"toon",
"kids",
"Character",
"story",
"happy",
"shape",
"disney",
],
},
{
"#url" : "https://www.behance.net/gallery/21324767/Nevada-City",
"#category": ("", "behance", "gallery"),
"#class" : behance.BehanceGalleryExtractor,
"#count" : 6,
"#sha1_url": "0258fe194fe7d828d6f2c7f6086a9a0a4140db1d",
"#results" : (
"https://mir-s3-cdn-cf.behance.net/project_modules/source/f5230a21324767.562ff473c2945.jpg",
"https://mir-s3-cdn-cf.behance.net/project_modules/source/5674c921324767.562ff473a3ef8.jpg",
"https://mir-s3-cdn-cf.behance.net/project_modules/source/9f6d3b21324767.562ff473c9da5.jpg",
"https://mir-s3-cdn-cf.behance.net/project_modules/source/3781c921324767.562ff473afa1c.jpg",
"https://mir-s3-cdn-cf.behance.net/project_modules/source/02011a21324767.562ff473bed3d.jpg",
"https://mir-s3-cdn-cf.behance.net/project_modules/source/2a65cf21324767.562ff473b7e3d.jpg",
),
"owners": ["Alex Strohl"],
"creator": {"name": "alexstrohl"},
"owners" : ["Alex Strohl"],
},
{
"#url" : "https://www.behance.net/gallery/88276087/Audi-R8-RWD",
"#comment" : "'media_collection' modules",
"#category": ("", "behance", "gallery"),
"#class" : behance.BehanceGalleryExtractor,
"#pattern" : r"https://mir-s3-cdn-cf\.behance\.net/project_modules/source/[0-9a-f]+.[0-9a-f]+\.jpg",
"#count" : 20,
"#sha1_url": "6bebff0d37f85349f9ad28bd8b76fd66627c1e2f",
"creator": {"name": "AgnieszkaDoroszewicz"},
"owners" : ["Agnieszka Doroszewicz"],
},
{
"#url" : "https://www.behance.net/gallery/101185577/COLCCI",
"#comment" : "'video' modules (#1282)",
"#category": ("", "behance", "gallery"),
"#class" : behance.BehanceGalleryExtractor,
"#pattern" : r"ytdl:https://cdn-prod-ccv\.adobe\.com/\w+/rend/master\.m3u8\?",
"#count" : 3,
"creator": {"name": "brnsimao"},
"owners" : ["Bruno Simao"],
},
{
"#url" : "https://www.behance.net/gallery/89270715/Moevir",
"#comment" : "'text' modules (#4799)",
"#category": ("", "behance", "gallery"),
"#class" : behance.BehanceGalleryExtractor,
"#options" : {"modules": "text"},
"#results" : """text:<div>Make Shift<br><a href="https://www.moevir.com/News/make-shif?fbclid=IwAR2MXL7mVDskdXHitLs4tv_RQFqB1tpAYix2EMIzea4lOSIPdPOR45wEJMA" target="_blank" rel="nofollow">https://www.moevir.com/News/make-shif</a><br>Moevir Magazine November Issue 2019<br>Photography by Caesar Lima @caephoto <br>Model: Bee @phamhuongbee <br>Makeup by Monica Alvarez @monicaalvarezmakeup <br>Styling by Jessica Boal @jessicaboal <br>Hair by James Gilbert @brandnewjames<br>Shot at Vila Sophia<br></div>""",
"creator": {"name": "caephoto"},
"owners" : ["Caesar Lima"],
},
{
"#url" : "https://www.behance.net/gallery/177464639/Kimori",
"#comment" : "mature content (#4417)",
"#category": ("", "behance", "gallery"),
"#class" : behance.BehanceGalleryExtractor,
"#exception": exception.AuthorizationError,
},
{
"#url" : "https://www.behance.net/alexstrohl",
"#category": ("", "behance", "user"),
"#class" : behance.BehanceUserExtractor,
"#pattern" : behance.BehanceGalleryExtractor.pattern,
"#count" : ">= 11",
@@ -90,10 +120,11 @@ __tests__ = (
{
"#url" : "https://www.behance.net/collection/71340149/inspiration",
"#category": ("", "behance", "collection"),
"#class" : behance.BehanceCollectionExtractor,
"#pattern" : behance.BehanceGalleryExtractor.pattern,
"#count" : ">= 150",
"!creator": dict,
},
)