diff options
Diffstat (limited to 'gallery_dl/text.py')
| -rw-r--r-- | gallery_dl/text.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gallery_dl/text.py b/gallery_dl/text.py index 1fb1851..b7b5211 100644 --- a/gallery_dl/text.py +++ b/gallery_dl/text.py @@ -59,8 +59,14 @@ def ensure_http_scheme(url, scheme="https://"): def root_from_url(url, scheme="https://"): """Extract scheme and domain from a URL""" if not url.startswith(("https://", "http://")): - return scheme + url[:url.index("/")] - return url[:url.index("/", 8)] + try: + return scheme + url[:url.index("/")] + except ValueError: + return scheme + url + try: + return url[:url.index("/", 8)] + except ValueError: + return url def filename_from_url(url): |
