about summary refs log tree commit diff
path: root/youtube_dl/extractor/youku.py
diff options
context:
space:
mode:
authorCelthi <txtlu0@gmail.com>2015-12-11 19:18:14 +0800
committerCelthi <txtlu0@gmail.com>2015-12-11 19:18:14 +0800
commit98c3806b15adfcbd7a24fa67c8702c8a1adb0783 (patch)
tree81d384492963aa5f59742d8ce7532b0c874a9dcb /youtube_dl/extractor/youku.py
parentfdf01663d1fd362d9886dbe2e4136bca23cc1543 (diff)
downloadyoutube-dl-98c3806b15adfcbd7a24fa67c8702c8a1adb0783.tar.gz
youtube-dl-98c3806b15adfcbd7a24fa67c8702c8a1adb0783.tar.xz
youtube-dl-98c3806b15adfcbd7a24fa67c8702c8a1adb0783.zip
fix some not important codesnips
Diffstat (limited to 'youtube_dl/extractor/youku.py')
-rw-r--r--youtube_dl/extractor/youku.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/youtube_dl/extractor/youku.py b/youtube_dl/extractor/youku.py
index 155286fc5..0e955db8a 100644
--- a/youtube_dl/extractor/youku.py
+++ b/youtube_dl/extractor/youku.py
@@ -1,15 +1,11 @@
 # coding: utf-8
 from __future__ import unicode_literals
 
-import json
 import base64
 
 from .common import InfoExtractor
 from ..compat import (
     compat_urllib_parse,
-    compat_cookiejar,
-    compat_cookies,
-    compat_urllib_request,
     compat_ord,
 )
 from ..utils import (
@@ -89,7 +85,7 @@ class YoukuIE(InfoExtractor):
         ).decode('ascii').split('_')
 
         # get oip
-        oip = data2['security']['ip']
+        oip = data1['security']['ip']
 
         # get fileid
         string_ls = list(
@@ -136,7 +132,8 @@ class YoukuIE(InfoExtractor):
             format = stream.get('stream_type')
             video_urls = []
             for dt in stream['segs']:
-                n = str(int(dt['size']))
+                #n = str(int(dt['size']))
+                n = str(stream['segs'].index(dt))
                 param = {
                     'K': dt['key'],
                     'hd': self.get_hd(format),
@@ -177,6 +174,8 @@ class YoukuIE(InfoExtractor):
         ext_dict = {
             'flv': 'flv',
             'mp4': 'mp4',
+            'mp4hd': 'mp4',
+            'mp4hd2': 'mp4',
             'hd2': 'flv',
             'hd3': 'flv',
             '3gp': 'flv',
@@ -214,7 +213,6 @@ class YoukuIE(InfoExtractor):
                 req.add_header('Ytdl-request-proxy', cn_verification_proxy)
 
             raw_data = self._download_json(req, video_id, note=note)
-            jsonDumpIn = json.dumps(raw_data,indent = 1)
 
             return raw_data['data']
 
@@ -260,7 +258,7 @@ class YoukuIE(InfoExtractor):
             'formats': [],
             # some formats are not available for all parts, we have to detect
             # which one has all
-        } for i in range(max(len(v) for v in data1['stream']))]
+        } for i in range(max(len(v.get('segs')) for v in data1['stream']))]
         for stream in data1['stream']:
             fm = stream.get('stream_type')
             video_urls = video_urls_dict[fm]