1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-22 16:44:32 +01:00

[utils] Default age_limit to None

If we can't parse it, it means we don't have any information, not that the content is unrestricted.
This commit is contained in:
Philipp Hagemeister 2014-10-03 20:17:10 +02:00
parent fe506288bd
commit d838b1bd4a
2 changed files with 4 additions and 2 deletions

View File

@ -138,6 +138,8 @@ class InfoExtractor(object):
Unless mentioned otherwise, the fields should be Unicode strings. Unless mentioned otherwise, the fields should be Unicode strings.
Unless mentioned otherwise, None is equivalent to absence of information.
Subclasses of this one should re-define the _real_initialize() and Subclasses of this one should re-define the _real_initialize() and
_real_extract() methods and define a _VALID_URL regexp. _real_extract() methods and define a _VALID_URL regexp.
Probably, they should also be added to the list of extractors. Probably, they should also be added to the list of extractors.

View File

@ -1576,9 +1576,9 @@ US_RATINGS = {
def parse_age_limit(s): def parse_age_limit(s):
if s is None: if s is None:
return 0 return None
m = re.match(r'^(?P<age>\d{1,2})\+?$', s) m = re.match(r'^(?P<age>\d{1,2})\+?$', s)
return int(m.group('age')) if m else US_RATINGS.get(s, 0) return int(m.group('age')) if m else US_RATINGS.get(s, None)
def strip_jsonp(code): def strip_jsonp(code):