aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-11-02 02:14:01 +0700
committerSergey M․ <dstftw@gmail.com>2016-11-02 02:30:18 +0700
commit02dc0a36b72b7312996d59b9ec96768f925cb4a4 (patch)
tree9131cde2d8f6ed7463b1254a33fada2ed8530d73 /youtube_dl/utils.py
parent639e3b5c9985aacf7c0dc018c211a78161bbafd2 (diff)
[utils] Introduce base_url
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 1a5ce8688..9595bcf9f 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1691,6 +1691,10 @@ def url_basename(url):
return path.strip('/').split('/')[-1]
+def base_url(url):
+ return re.match(r'https?://[^?#&]+/', url).group()
+
+
class HEADRequest(compat_urllib_request.Request):
def get_method(self):
return 'HEAD'