[youku]cna hacks

This commit is contained in:
MaxwellGoblin 2017-06-03 10:12:12 +08:00
parent 1a3752781a
commit 525f052332

View File

@ -23,10 +23,17 @@ def fetch_cna():
if cookie.name == 'cna' and cookie.domain == '.youku.com':
log.i('Found cna in imported cookies. Use it')
return quote_cna(cookie.value)
url = 'http://gm.mmstat.com/yt/ykcomment.play.commentInit?cna='
url = 'http://log.mmstat.com/eg.js'
req = urllib.request.urlopen(url)
cna = req.info()['Set-Cookie'].split(';')[0].split('=')[1]
return quote_cna(cna)
headers = req.getheaders()
for header in headers:
if header[0].lower() == 'set-cookie':
n_v = header[1].split(';')[0]
name, value = n_v.split('=')
if name == 'cna':
return quote_cna(value)
log.w('It seems that the client failed to fetch a cna cookie. Please load your own cookie if possible')
return quote_cna('DOG4EdW4qzsCAbZyXbU+t7Jt')
def youku_ups(vid, ccode='0401'):
url = 'https://ups.youku.com/ups/get.json?vid={}&ccode={}'.format(vid, ccode)