aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-12-17 07:08:48 -0800
committerPhilipp Hagemeister <phihag@phihag.de>2013-12-17 07:08:48 -0800
commitf5567e401cf012de85bc1471efca80fa947ba4c0 (patch)
treec28eb1d098aea869efd95493baee0c199894f860
parent6086d121cbc3e49c30e3ef64151cc2c4b22ed713 (diff)
parent9b8aaeed856f189fef016563a10f7f4e46a1590e (diff)
Merge pull request #1997 from rg3/simplify-url_basename
Simplify url_basename
-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]