diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2013-12-17 07:08:48 -0800 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2013-12-17 07:08:48 -0800 |
commit | f5567e401cf012de85bc1471efca80fa947ba4c0 (patch) | |
tree | c28eb1d098aea869efd95493baee0c199894f860 | |
parent | 6086d121cbc3e49c30e3ef64151cc2c4b22ed713 (diff) | |
parent | 9b8aaeed856f189fef016563a10f7f4e46a1590e (diff) | |
download | youtube-dl-f5567e401cf012de85bc1471efca80fa947ba4c0.zip youtube-dl-f5567e401cf012de85bc1471efca80fa947ba4c0.tar.gz youtube-dl-f5567e401cf012de85bc1471efca80fa947ba4c0.tar.bz2 |
Merge pull request #1997 from rg3/simplify-url_basename
Simplify url_basename
-rw-r--r-- | youtube_dl/utils.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index d5069dc..4c7ad89 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] |