1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

Merge branch 'sceext2-fix-iqiyi-2015-07-17'

This commit is contained in:
Yen Chi Hsuan 2015-07-19 03:57:36 +08:00
commit 4b0f45f667

View file

@ -3,19 +3,13 @@ from __future__ import unicode_literals
import hashlib import hashlib
import math import math
import os.path
import random import random
import re
import time import time
import uuid import uuid
import zlib
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_urllib_parse from ..compat import compat_urllib_parse
from ..utils import ( from ..utils import ExtractorError
ExtractorError,
url_basename,
)
class IqiyiIE(InfoExtractor): class IqiyiIE(InfoExtractor):
@ -39,56 +33,48 @@ class IqiyiIE(InfoExtractor):
'title': '名侦探柯南第752集', 'title': '名侦探柯南第752集',
}, },
'playlist': [{ 'playlist': [{
'md5': '7e49376fecaffa115d951634917fe105',
'info_dict': { 'info_dict': {
'id': 'e3f585b550a280af23c98b6cb2be19fb_part1', 'id': 'e3f585b550a280af23c98b6cb2be19fb_part1',
'ext': 'f4v', 'ext': 'f4v',
'title': '名侦探柯南第752集', 'title': '名侦探柯南第752集',
}, },
}, { }, {
'md5': '41b75ba13bb7ac0e411131f92bc4f6ca',
'info_dict': { 'info_dict': {
'id': 'e3f585b550a280af23c98b6cb2be19fb_part2', 'id': 'e3f585b550a280af23c98b6cb2be19fb_part2',
'ext': 'f4v', 'ext': 'f4v',
'title': '名侦探柯南第752集', 'title': '名侦探柯南第752集',
}, },
}, { }, {
'md5': '0cee1dd0a3d46a83e71e2badeae2aab0',
'info_dict': { 'info_dict': {
'id': 'e3f585b550a280af23c98b6cb2be19fb_part3', 'id': 'e3f585b550a280af23c98b6cb2be19fb_part3',
'ext': 'f4v', 'ext': 'f4v',
'title': '名侦探柯南第752集', 'title': '名侦探柯南第752集',
}, },
}, { }, {
'md5': '4f8ad72373b0c491b582e7c196b0b1f9',
'info_dict': { 'info_dict': {
'id': 'e3f585b550a280af23c98b6cb2be19fb_part4', 'id': 'e3f585b550a280af23c98b6cb2be19fb_part4',
'ext': 'f4v', 'ext': 'f4v',
'title': '名侦探柯南第752集', 'title': '名侦探柯南第752集',
}, },
}, { }, {
'md5': 'd89ad028bcfad282918e8098e811711d',
'info_dict': { 'info_dict': {
'id': 'e3f585b550a280af23c98b6cb2be19fb_part5', 'id': 'e3f585b550a280af23c98b6cb2be19fb_part5',
'ext': 'f4v', 'ext': 'f4v',
'title': '名侦探柯南第752集', 'title': '名侦探柯南第752集',
}, },
}, { }, {
'md5': '9cb1e5c95da25dff0660c32ae50903b7',
'info_dict': { 'info_dict': {
'id': 'e3f585b550a280af23c98b6cb2be19fb_part6', 'id': 'e3f585b550a280af23c98b6cb2be19fb_part6',
'ext': 'f4v', 'ext': 'f4v',
'title': '名侦探柯南第752集', 'title': '名侦探柯南第752集',
}, },
}, { }, {
'md5': '155116e0ff1867bbc9b98df294faabc9',
'info_dict': { 'info_dict': {
'id': 'e3f585b550a280af23c98b6cb2be19fb_part7', 'id': 'e3f585b550a280af23c98b6cb2be19fb_part7',
'ext': 'f4v', 'ext': 'f4v',
'title': '名侦探柯南第752集', 'title': '名侦探柯南第752集',
}, },
}, { }, {
'md5': '53f5db77622ae14fa493ed2a278a082b',
'info_dict': { 'info_dict': {
'id': 'e3f585b550a280af23c98b6cb2be19fb_part8', 'id': 'e3f585b550a280af23c98b6cb2be19fb_part8',
'ext': 'f4v', 'ext': 'f4v',
@ -212,20 +198,7 @@ class IqiyiIE(InfoExtractor):
return raw_data return raw_data
def get_enc_key(self, swf_url, video_id): def get_enc_key(self, swf_url, video_id):
filename, _ = os.path.splitext(url_basename(swf_url)) enc_key = '8e29ab5666d041c3a1ea76e06dabdffb'
enc_key_json = self._downloader.cache.load('iqiyi-enc-key', filename)
if enc_key_json is not None:
return enc_key_json[0]
req = self._request_webpage(
swf_url, video_id, note='download swf content')
cn = req.read()
cn = zlib.decompress(cn[8:])
pt = re.compile(b'MixerRemote\x08(?P<enc_key>.+?)\$&vv')
enc_key = self._search_regex(pt, cn, 'enc_key').decode('utf8')
self._downloader.cache.store('iqiyi-enc-key', filename, [enc_key])
return enc_key return enc_key
def _real_extract(self, url): def _real_extract(self, url):