diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2013-12-17 04:13:36 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2013-12-17 04:13:36 +0100 |
commit | 29eb5174031cfc0b5de556da3da7761ac377de4e (patch) | |
tree | bdc0158bbf6a069777719d70c89b96939c1c651a /youtube_dl/utils.py | |
parent | 44c471c3b873473157adb8ba8a55667ab54b2602 (diff) |
Add webpage_url_basename info_dict field (Fixes #1938)
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r-- | youtube_dl/utils.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index dbfac0f43..a249c7ec1 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -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) |