mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
Merge pull request #1997 from rg3/simplify-url_basename
Simplify url_basename
This commit is contained in:
commit
f5567e401c
1 changed files with 2 additions and 4 deletions
|
@ -1092,7 +1092,5 @@ def remove_start(s, start):
|
||||||
|
|
||||||
|
|
||||||
def url_basename(url):
|
def url_basename(url):
|
||||||
m = re.match(r'(?:https?:|)//[^/]+/(?:[^?#]+/)?([^/?#]+)/?(?:[?#]|$)', url)
|
path = compat_urlparse.urlparse(url).path
|
||||||
if not m:
|
return path.strip(u'/').split(u'/')[-1]
|
||||||
return u''
|
|
||||||
return m.group(1)
|
|
||||||
|
|
Loading…
Reference in a new issue