diff options
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r-- | youtube_dl/utils.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 68d590ba2..29c9b1a4c 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1186,7 +1186,7 @@ def parse_duration(s): return None m = re.match( - r'(?:(?:(?P<hours>[0-9]+)[:h])?(?P<mins>[0-9]+)[:m])?(?P<secs>[0-9]+)s?$', s) + r'(?:(?:(?P<hours>[0-9]+)[:h])?(?P<mins>[0-9]+)[:m])?(?P<secs>[0-9]+)s?(?::[0-9]+)?$', s) if not m: return None res = int(m.group('secs')) @@ -1328,3 +1328,7 @@ US_RATINGS = { 'R': 16, 'NC': 18, } + + +def strip_jsonp(code): + return re.sub(r'(?s)^[a-zA-Z_]+\s*\(\s*(.*)\);\s*?\s*$', r'\1', code) |