aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/text.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2022-03-15 00:20:05 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2022-03-15 00:20:05 -0400
commit8167b5c0be04172b11188d5a62b5dfd9c92b484b (patch)
tree2e5e86f9aa02937f365de88a7bb6b8a3d0fe845a /gallery_dl/text.py
parent3ad4e25f8d7984bd38128ed406013ca2e32b9ac1 (diff)
parentc2e774d3f5a4499b8beb5a12ab46a0099b16b1e7 (diff)
Update upstream source from tag 'upstream/1.21.0'
Update to upstream version '1.21.0' with Debian dir b17d3fc3ba4860aceb7f154a3f477cef9bbb23d4
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 ac4bbcb..97ef3ac 100644
--- a/gallery_dl/text.py
+++ b/gallery_dl/text.py
@@ -46,6 +46,13 @@ def ensure_http_scheme(url, scheme="https://"):
return url
+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)]
+
+
def filename_from_url(url):
"""Extract the last part of an URL to use as a filename"""
try: