[cnet] Fall back to "videos" key
authorPhilipp Hagemeister <phihag@phihag.de>
Fri, 4 Apr 2014 00:09:04 +0000 (02:09 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Fri, 4 Apr 2014 00:09:04 +0000 (02:09 +0200)
youtube_dl/extractor/cnet.py

index 6a2f5ce363a536bc0f87ddf453416f30f2385e30..f5ab443d2d06fbdf027b7a58655497d1406fd321 100644 (file)
@@ -6,6 +6,7 @@ import re
 
 from .common import InfoExtractor
 from ..utils import (
+    ExtractorError,
     int_or_none,
 )
 
@@ -36,6 +37,10 @@ class CNETIE(InfoExtractor):
             webpage, 'data json')
         data = json.loads(data_json)
         vdata = data['video']
+        if not vdata:
+            vdata = data['videos'][0]
+        if not vdata:
+            raise ExtractorError('Cannot find video data')
 
         video_id = vdata['id']
         title = vdata['headline']