From c689cd9720453dba09fb06af71a79c8772bc68e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 17 Aug 2023 15:31:37 +0200 Subject: [PATCH] [behance] show error for mature content (#4417) --- gallery_dl/extractor/behance.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/behance.py b/gallery_dl/extractor/behance.py index d8cc51d3..0a54a5d5 100644 --- a/gallery_dl/extractor/behance.py +++ b/gallery_dl/extractor/behance.py @@ -9,7 +9,7 @@ """Extractors for https://www.behance.net/""" from .common import Extractor, Message -from .. import text, util +from .. import text, util, exception class BehanceExtractor(Extractor): @@ -90,6 +90,10 @@ class BehanceGalleryExtractor(BehanceExtractor): r"/rend/\w+_720\.mp4\?", "count": 3, }), + # mature content (#4417) + ("https://www.behance.net/gallery/177464639/Kimori", { + "exception": exception.AuthorizationError, + }), ) def __init__(self, match): @@ -128,6 +132,18 @@ class BehanceGalleryExtractor(BehanceExtractor): def get_images(self, data): """Extract image results from an API response""" + if not data["modules"]: + access = data.get("matureAccess") + if access == "logged-out": + raise exception.AuthorizationError( + "Logged-in cookies required to access mature content") + if access == "restricted-safe": + raise exception.AuthorizationError( + "Mature content blocked in account settings") + if access and access != "allowed": + raise exception.AuthorizationError() + return () + result = [] append = result.append