projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 1:
6086d12
)
Merge pull request #1997 from rg3/simplify-url_basename
author
Philipp Hagemeister
<phihag@phihag.de>
Tue, 17 Dec 2013 15:08:48 +0000
(07:08 -0800)
committer
Philipp Hagemeister
<phihag@phihag.de>
Tue, 17 Dec 2013 15:08:48 +0000
(07:08 -0800)
Simplify url_basename
youtube_dl/utils.py
patch
|
blob
|
history
diff --git
a/youtube_dl/utils.py
b/youtube_dl/utils.py
index d5069dcca98dea4e6071d3d7d35a42576dcd4604..4c7ad89c0b39602bf50de3b5ea2a6289c2215cfe 100644
(file)
--- 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]