[youku] PEP8

This commit is contained in:
Yen Chi Hsuan 2015-06-15 22:41:24 +08:00
parent 8268e94cd4
commit aed473ccf9

View file

@ -11,6 +11,7 @@
bytes_is_str = (bytes == str) # for compatible bytes_is_str = (bytes == str) # for compatible
class YoukuIE(InfoExtractor): class YoukuIE(InfoExtractor):
IE_NAME = 'youku' IE_NAME = 'youku'
_VALID_URL = r'''(?x) _VALID_URL = r'''(?x)
@ -52,8 +53,8 @@ def yk_t(s1, s2):
sid, token = yk_t( sid, token = yk_t(
'becaf9be', 'becaf9be',
base64.b64decode(bytes(data2['ep'], 'ascii')) \ base64.b64decode(bytes(data2['ep'], 'ascii'))
if not bytes_is_str \ if not bytes_is_str
else base64.b64decode(data2['ep']) else base64.b64decode(data2['ep'])
).split('_') ).split('_')
@ -89,13 +90,13 @@ def generate_ep(format, n):
fileid = get_fileid(format, n) fileid = get_fileid(format, n)
ep_t = yk_t( ep_t = yk_t(
'bf7e5f01', 'bf7e5f01',
bytes('%s_%s_%s' % (sid, fileid, token), 'ascii') \ bytes('%s_%s_%s' % (sid, fileid, token), 'ascii')
if not bytes_is_str \ if not bytes_is_str
else ('%s_%s_%s' % (sid, fileid, token)) else ('%s_%s_%s' % (sid, fileid, token))
) )
ep = base64.b64encode( ep = base64.b64encode(
bytes(ep_t, 'latin') \ bytes(ep_t, 'latin')
if not bytes_is_str \ if not bytes_is_str
else ep_t else ep_t
).decode() ).decode()
return ep return ep
@ -194,7 +195,6 @@ def _real_extract(self, url):
# construct info # construct info
entries = [] entries = []
for fm in data1['streamtypes']: for fm in data1['streamtypes']:
#formats = []
video_urls = video_urls_dict[fm] video_urls = video_urls_dict[fm]
for i in range(len(video_urls)): for i in range(len(video_urls)):
if len(entries) < i + 1: if len(entries) < i + 1: