aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorremitamine <remitamine@gmail.com>2015-12-05 09:29:14 +0100
committerremitamine <remitamine@gmail.com>2015-12-05 09:42:00 +0100
commit02e3952f3b2a289dd69ee2f922d7e8f5d8759e4d (patch)
tree9892c56f9445da2a2820be706f41ce56beb07676 /youtube_dl
parent64b7e89c0c1f52502ce4fdb7fda4cc1531e578fd (diff)
[trilulilu] handle errors
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/trilulilu.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/youtube_dl/extractor/trilulilu.py b/youtube_dl/extractor/trilulilu.py
index 515632527..a800449e9 100644
--- a/youtube_dl/extractor/trilulilu.py
+++ b/youtube_dl/extractor/trilulilu.py
@@ -49,6 +49,15 @@ class TriluliluIE(InfoExtractor):
display_id = self._match_id(url)
media_info = self._download_json('http://m.trilulilu.ro/%s?format=json' % display_id, display_id)
+ age_limit = 0
+ errors = media_info.get('errors', {})
+ if errors.get('friends'):
+ raise ExtractorError('This video is private.', expected=True)
+ elif errors.get('geoblock'):
+ raise ExtractorError('This video is not available in your country.', expected=True)
+ elif errors.get('xxx_unlogged'):
+ age_limit = 18
+
media_class = media_info.get('class')
if media_class not in ('video', 'audio'):
raise ExtractorError('not a video or an audio')
@@ -90,4 +99,5 @@ class TriluliluIE(InfoExtractor):
'view_count': int_or_none(media_info.get('count_views')),
'like_count': int_or_none(media_info.get('count_likes')),
'comment_count': int_or_none(media_info.get('count_comments')),
+ 'age_limit': age_limit,
}