Browse Source

Simplify url_basename

Use urlparse from the standard library.
master
Jaime Marquínez Ferrándiz 11 years ago
parent
commit
9b8aaeed85
1 changed files with 2 additions and 4 deletions
  1. 6
      youtube_dl/utils.py

6
youtube_dl/utils.py

@ -1092,7 +1092,5 @@ def remove_start(s, start):
def url_basename(url): 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]
Loading…
Cancel
Save