summaryrefslogtreecommitdiffstats
path: root/gallery_dl/text.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2020-06-01 23:11:37 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2020-06-01 23:11:37 -0400
commita70a3246927b72f1ded37acd55ee719515441b5b (patch)
tree57f0d3ab0b1387b665325f42a24b8aab63cbce07 /gallery_dl/text.py
parent90e50db2e3c38f523bb5195d295290b06e5cedb0 (diff)
New upstream version 1.14.0.upstream/1.14.0
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: