summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-02-25 11:15:34 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-02-25 11:15:34 +0100
commit6cadf8c858be4cdaa1fd8da2b4e8bee53434b03b (patch)
tree3e0d37b25824a9a60968e0ec04367cdb4584b3ad
parent27579b9e4c4adf5411faeacbbf45dae97a7df5e9 (diff)
downloadyoutube-dl-6cadf8c858be4cdaa1fd8da2b4e8bee53434b03b.tar.gz
youtube-dl-6cadf8c858be4cdaa1fd8da2b4e8bee53434b03b.tar.xz
youtube-dl-6cadf8c858be4cdaa1fd8da2b4e8bee53434b03b.zip
[vevo] Add age_limit support
-rw-r--r--youtube_dl/extractor/vevo.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/youtube_dl/extractor/vevo.py b/youtube_dl/extractor/vevo.py
index dd87158db..fa147a575 100644
--- a/youtube_dl/extractor/vevo.py
+++ b/youtube_dl/extractor/vevo.py
@@ -46,6 +46,21 @@ class VevoIE(InfoExtractor):
             'uploader': 'Cassadee Pope',
             'title': 'I Wish I Could Break Your Heart',
             'duration': 226.101,
+            'age_limit': 0,
+        }
+    }, {
+        'note': 'Age-limited video',
+        'url': 'https://www.vevo.com/watch/justin-timberlake/tunnel-vision-explicit/USRV81300282',
+        'info_dict': {
+            'id': 'USRV81300282',
+            'ext': 'mp4',
+            'age_limit': 18,
+            'title': 'Tunnel Vision (Explicit)',
+            'uploader': 'Justin Timberlake',
+            'upload_date': '20130704',
+        },
+        'params': {
+            'skip_download': 'true',
         }
     }]
     _SMIL_BASE_URL = 'http://smil.lvl3.vevo.com/'
@@ -119,6 +134,14 @@ class VevoIE(InfoExtractor):
 
         formats = self._formats_from_json(video_info)
 
+        is_explicit = video_info.get('isExplicit')
+        if is_explicit is True:
+            age_limit = 18
+        elif is_explicit is False:
+            age_limit = 0
+        else:
+            age_limit = None
+
         # Download SMIL
         smil_blocks = sorted((
             f for f in video_info['videoVersions']
@@ -155,4 +178,5 @@ class VevoIE(InfoExtractor):
             'upload_date': upload_date.strftime('%Y%m%d'),
             'uploader': video_info['mainArtists'][0]['artistName'],
             'duration': video_info['duration'],
+            'age_limit': age_limit,
         }