mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-07-01 03:22:50 -05:00
Add webpage_url_basename info_dict field (Fixes #1938)
This commit is contained in:
@ -1084,3 +1084,10 @@ def remove_start(s, start):
|
||||
if s.startswith(start):
|
||||
return s[len(start):]
|
||||
return s
|
||||
|
||||
|
||||
def url_basename(url):
|
||||
m = re.match(r'(?:https?:|)//[^/]+/(?:[^/?#]+/)?([^/?#]+)/?(?:[?#]|$)', url)
|
||||
if not m:
|
||||
return u''
|
||||
return m.group(1)
|
||||
|
Reference in New Issue
Block a user