1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-19 17:32:51 +01:00

Merge pull request #1997 from rg3/simplify-url_basename

Simplify url_basename
This commit is contained in:
Philipp Hagemeister 2013-12-17 07:08:48 -08:00
commit f5567e401c

View File

@ -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]