summaryrefslogtreecommitdiffstats
path: root/gallery_dl/text.py
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/text.py')
-rw-r--r--gallery_dl/text.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/gallery_dl/text.py b/gallery_dl/text.py
index 3bb6390..4dc0963 100644
--- a/gallery_dl/text.py
+++ b/gallery_dl/text.py
@@ -60,6 +60,13 @@ def split_html(txt, sep=None):
return []
+def ensure_http_scheme(url, scheme="https://"):
+ """Prepend 'scheme' to 'url' if it doesn't have one"""
+ if url and not url.startswith(("https://", "http://")):
+ return scheme + url.lstrip("/:")
+ return url
+
+
def filename_from_url(url):
"""Extract the last part of an URL to use as a filename"""
try: