diff options
author | Naglis Jonaitis <[email protected]> | 2015-02-08 17:39:00 +0200 |
---|---|---|
committer | Naglis Jonaitis <[email protected]> | 2015-02-08 17:39:00 +0200 |
commit | 69319969de40f62ccf1c471427d309b6555483f9 (patch) | |
tree | ed2384da815c98a22a06304cecc71dcfcce035eb | |
parent | a14292e8480f339bdbf9e52e93460aec5c31ef13 (diff) | |
download | youtube-dl-69319969de40f62ccf1c471427d309b6555483f9.tar.gz youtube-dl-69319969de40f62ccf1c471427d309b6555483f9.zip |
[extractor/common] Add new helper method _family_friendly_search
-rw-r--r-- | youtube_dl/extractor/common.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 980b63680..2f5ba7aee 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -656,6 +656,21 @@ class InfoExtractor(object): } return RATING_TABLE.get(rating.lower(), None) + def _family_friendly_search(self, html): + # See http://schema.org/VideoObj + family_friendly = self._html_search_meta('isFamilyFriendly', html) + + if not family_friendly: + return None + + RATING_TABLE = { + '1': 0, + 'true': 0, + '0': 18, + 'false': 18, + } + return RATING_TABLE.get(family_friendly.lower(), None) + def _twitter_search_player(self, html): return self._html_search_meta('twitter:player', html, 'twitter card player') |