From a493fed37675647d62b61dad813a0afbad89b7e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 29 Aug 2018 15:59:58 +0200 Subject: [PATCH] [deviantart] fix journal creation if no 'username' is set --- gallery_dl/extractor/deviantart.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gallery_dl/extractor/deviantart.py b/gallery_dl/extractor/deviantart.py index c21fbcc9..73657832 100644 --- a/gallery_dl/extractor/deviantart.py +++ b/gallery_dl/extractor/deviantart.py @@ -141,11 +141,13 @@ class DeviantartExtractor(Extractor): itertools.accumulate(catlist, lambda t, c: t + "/" + c) ) ) + username = deviation["author"]["username"] + urlname = deviation.get("username") or username.lower() header = HEADER_TEMPLATE.format( title=title, url=url, - userurl="{}/{}/".format(self.root, deviation["username"]), - username=deviation["author"]["username"], + userurl="{}/{}/".format(self.root, urlname), + username=username, date=date, categories=categories, ) @@ -410,7 +412,7 @@ class DeviantartPopularExtractor(DeviantartExtractor): pattern = [r"(?:https?://)?www\.deviantart\.com" r"((?:/\w+)*)/(?:popular-([^/?&#]+))/?(?:\?([^#]*))?"] test = [ - ("https://www.deviantart.com/popular-8-hours/?q=tree+house", { + ("https://www.deviantart.com/popular-24-hours/?q=tree+house", { "options": (("original", False),), }), ("https://www.deviantart.com/artisan/popular-all-time/?q=tree", None),