Fix YoukuIE in Python3 (and in general)
authorPhilipp Hagemeister <phihag@phihag.de>
Sat, 15 Dec 2012 16:57:13 +0000 (17:57 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Sat, 15 Dec 2012 16:57:13 +0000 (17:57 +0100)
youtube_dl/InfoExtractors.py

index 1f5e189679989a030e1a11c31123a544e0e8ed06..fd977d2d99878228137cab321fd81321cdbdaa69 100644 (file)
@@ -3372,15 +3372,8 @@ class YoukuIE(InfoExtractor):
 
 
             fileid = config['data'][0]['streamfileids'][format]
-            seg_number = len(config['data'][0]['segs'][format])
-
-            keys=[]
-            for i in xrange(seg_number):
-                keys.append(config['data'][0]['segs'][format][i]['k'])
-
-            #TODO check error
-            #youku only could be viewed from mainland china
-        except:
+            keys = [s['k'] for s in config['data'][0]['segs'][format]]
+        except (ValueError, KeyError):
             self._downloader.trouble(u'ERROR: unable to extract info section')
             return