[youku] Cleanup and PEP8

This commit is contained in:
Yen Chi Hsuan 2015-12-12 14:41:53 +08:00
parent 1faa66f005
commit f133fd326b
1 changed files with 6 additions and 18 deletions

View File

@ -2,7 +2,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import base64 import base64
import json
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import ( from ..compat import (
@ -88,10 +87,6 @@ class YoukuIE(InfoExtractor):
# get oip # get oip
oip = data['security']['ip'] oip = data['security']['ip']
# get fileid
string_ls = list(
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\:._-1234567890')
fileid_dict = {} fileid_dict = {}
for stream in data['stream']: for stream in data['stream']:
format = stream.get('stream_type') format = stream.get('stream_type')
@ -122,13 +117,11 @@ class YoukuIE(InfoExtractor):
format = stream.get('stream_type') format = stream.get('stream_type')
video_urls = [] video_urls = []
for dt in stream['segs']: for dt in stream['segs']:
#n = str(int(dt['size']))
n = str(stream['segs'].index(dt)) n = str(stream['segs'].index(dt))
param = { param = {
'K': dt['key'], 'K': dt['key'],
'hd': self.get_hd(format), 'hd': self.get_hd(format),
'myp': 0, 'myp': 0,
#'ts': dt['total_milliseconds_video'],
'ypp': 0, 'ypp': 0,
'ctype': 12, 'ctype': 12,
'ev': 1, 'ev': 1,
@ -196,8 +189,6 @@ class YoukuIE(InfoExtractor):
video_id = self._match_id(url) video_id = self._match_id(url)
def retrieve_data(req_url, note): def retrieve_data(req_url, note):
headers = { headers = {
'Referer': req_url, 'Referer': req_url,
} }
@ -209,11 +200,9 @@ class YoukuIE(InfoExtractor):
req.add_header('Ytdl-request-proxy', cn_verification_proxy) req.add_header('Ytdl-request-proxy', cn_verification_proxy)
raw_data = self._download_json(req, video_id, note=note) raw_data = self._download_json(req, video_id, note=note)
js = json.dumps(raw_data)
return raw_data['data'] return raw_data['data']
video_password = self._downloader.params.get('videopassword', None) video_password = self._downloader.params.get('videopassword', None)
# request basic data # request basic data
@ -240,7 +229,6 @@ class YoukuIE(InfoExtractor):
# get video title # get video title
title = data['video']['title'] title = data['video']['title']
# generate video_urls_dict # generate video_urls_dict
video_urls_dict = self.construct_video_urls(data) video_urls_dict = self.construct_video_urls(data)