projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a14292e
)
[extractor/common] Add new helper method _family_friendly_search
author
Naglis Jonaitis
<njonaitis@gmail.com>
Sun, 8 Feb 2015 15:39:00 +0000
(17:39 +0200)
committer
Naglis Jonaitis
<njonaitis@gmail.com>
Sun, 8 Feb 2015 15:39:00 +0000
(17:39 +0200)
youtube_dl/extractor/common.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/common.py
b/youtube_dl/extractor/common.py
index 980b63680255793291b9857d1e1dfb657a9836d8..2f5ba7aee37fa7b4f26c6ebc68bc1a5abe31296c 100644
(file)
--- 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)
}
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')
def _twitter_search_player(self, html):
return self._html_search_meta('twitter:player', html,
'twitter card player')