mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-10 00:58:17 +02:00
[utils] Add parse_age_limit
This commit is contained in:
parent
f78c01f68b
commit
146c80e256
@ -1574,6 +1574,13 @@ def compat_getpass(prompt, *args, **kwargs):
|
||||
}
|
||||
|
||||
|
||||
def parse_age_limit(s):
|
||||
if s is None:
|
||||
return 0
|
||||
m = re.match(r'^(?P<age>\d{1,2})\+?$', s)
|
||||
return int(m.group('age')) if m else US_RATINGS.get(s, 0)
|
||||
|
||||
|
||||
def strip_jsonp(code):
|
||||
return re.sub(r'(?s)^[a-zA-Z0-9_]+\s*\(\s*(.*)\);?\s*?\s*$', r'\1', code)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user