[deviantart] fix journal creation if no 'username' is set
This commit is contained in:
@@ -141,11 +141,13 @@ class DeviantartExtractor(Extractor):
|
|||||||
itertools.accumulate(catlist, lambda t, c: t + "/" + c)
|
itertools.accumulate(catlist, lambda t, c: t + "/" + c)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
username = deviation["author"]["username"]
|
||||||
|
urlname = deviation.get("username") or username.lower()
|
||||||
header = HEADER_TEMPLATE.format(
|
header = HEADER_TEMPLATE.format(
|
||||||
title=title,
|
title=title,
|
||||||
url=url,
|
url=url,
|
||||||
userurl="{}/{}/".format(self.root, deviation["username"]),
|
userurl="{}/{}/".format(self.root, urlname),
|
||||||
username=deviation["author"]["username"],
|
username=username,
|
||||||
date=date,
|
date=date,
|
||||||
categories=categories,
|
categories=categories,
|
||||||
)
|
)
|
||||||
@@ -410,7 +412,7 @@ class DeviantartPopularExtractor(DeviantartExtractor):
|
|||||||
pattern = [r"(?:https?://)?www\.deviantart\.com"
|
pattern = [r"(?:https?://)?www\.deviantart\.com"
|
||||||
r"((?:/\w+)*)/(?:popular-([^/?&#]+))/?(?:\?([^#]*))?"]
|
r"((?:/\w+)*)/(?:popular-([^/?&#]+))/?(?:\?([^#]*))?"]
|
||||||
test = [
|
test = [
|
||||||
("https://www.deviantart.com/popular-8-hours/?q=tree+house", {
|
("https://www.deviantart.com/popular-24-hours/?q=tree+house", {
|
||||||
"options": (("original", False),),
|
"options": (("original", False),),
|
||||||
}),
|
}),
|
||||||
("https://www.deviantart.com/artisan/popular-all-time/?q=tree", None),
|
("https://www.deviantart.com/artisan/popular-all-time/?q=tree", None),
|
||||||
|
|||||||
Reference in New Issue
Block a user