aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-12-17 14:56:29 +0100
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-12-17 14:56:29 +0100
commit9b8aaeed856f189fef016563a10f7f4e46a1590e (patch)
treec28eb1d098aea869efd95493baee0c199894f860
parent6086d121cbc3e49c30e3ef64151cc2c4b22ed713 (diff)
Simplify url_basename
Use urlparse from the standard library.
-rw-r--r--youtube_dl/utils.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index d5069dcca..4c7ad89c0 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1092,7 +1092,5 @@ def remove_start(s, start):
def url_basename(url):
- m = re.match(r'(?:https?:|)//[^/]+/(?:[^?#]+/)?([^/?#]+)/?(?:[?#]|$)', url)
- if not m:
- return u''
- return m.group(1)
+ path = compat_urlparse.urlparse(url).path
+ return path.strip(u'/').split(u'/')[-1]