Add webpage_url_basename info_dict field (Fixes #1938)
This commit is contained in:
parent
44c471c3b8
commit
29eb517403
3 changed files with 27 additions and 9 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue