diff --git a/gallery_dl/extractor/common.py b/gallery_dl/extractor/common.py index 9cf07335..03956654 100644 --- a/gallery_dl/extractor/common.py +++ b/gallery_dl/extractor/common.py @@ -731,9 +731,8 @@ class GalleryExtractor(Extractor): def __init__(self, match, url=None): Extractor.__init__(self, match) - if url is None: - path = self.groups[0] - self.page_url = self.root + path if path[0] == "/" else None + if url is None and (path := self.groups[0]) and path[0] == "/": + self.page_url = f"{self.root}{path}" else: self.page_url = url @@ -829,9 +828,8 @@ class MangaExtractor(Extractor): def __init__(self, match, url=None): Extractor.__init__(self, match) - if url is None: - path = self.groups[0] - self.page_url = self.root + path if path[0] == "/" else None + if url is None and (path := self.groups[0]) and path[0] == "/": + self.page_url = f"{self.root}{path}" else: self.page_url = url