2
0
mirror of https://gitea.eponym.info/Mirrors/youtube-dl synced 2025-08-31 19:41:36 +00:00

Add webpage_url_basename info_dict field (Fixes #1938)

This commit is contained in:
Philipp Hagemeister
2013-12-17 04:13:36 +01:00
parent 44c471c3b8
commit 29eb517403
3 changed files with 27 additions and 9 deletions

View File

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