From a4ed7859661e8bc9d7c9eab1a0c04eaf8fc7836d Mon Sep 17 00:00:00 2001 From: Zhang Ning Date: Sat, 2 Jul 2016 06:54:35 +0800 Subject: [PATCH] iqiyi: fix when no vip info Signed-off-by: Zhang Ning --- src/you_get/extractors/iqiyi.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/you_get/extractors/iqiyi.py b/src/you_get/extractors/iqiyi.py index a1552fe4..dc9b05fd 100644 --- a/src/you_get/extractors/iqiyi.py +++ b/src/you_get/extractors/iqiyi.py @@ -148,12 +148,17 @@ class Iqiyi(VideoExtractor): log.i("vd: {} is not handled".format(stream['vd'])) log.i("info is {}".format(stream)) # why I need do below??? - if not 'BD' in self.stream_types: + try: + vip_vds = info['data']['ctl']['vip']['bids'] + vip_conf = info['data']['ctl']['configs'] + except: + return + if not 'BD' in self.streams.keys(): p1080_vids = [] - if 18 in info['data']['ctl']['vip']['bids']: - p1080_vids.append(info['data']['ctl']['configs']['18']['vid']) - if 5 in info['data']['ctl']['vip']['bids']: - p1080_vids.append(info['data']['ctl']['configs']['5']['vid']) + if 18 in vip_vds: + p1080_vids.append(vip_conf['18']['vid']) + if 5 in vip_vds: + p1080_vids.append(vip_conf['5']['vid']) for v in p1080_vids: p1080_info = getVMS(tvid, v) if info['code'] == 'A00000': @@ -161,12 +166,12 @@ class Iqiyi(VideoExtractor): self.streams['BD'] = {'video_profile': '1080p', 'container': 'm3u8', 'src': [p1080_url], 'size' : 0} break - if not '4k' in self.stream_types: + if not '4k' in self.streams.keys(): k4_vids = [] - if 19 in info['data']['ctl']['vip']['bids']: - k4_vids.append(info['data']['ctl']['configs']['19']['vid']) - if 10 in info['data']['ctl']['vip']['bids']: - k4_vids.append(info['data']['ctl']['configs']['10']['vid']) + if 19 in vip_vds: + k4_vids.append(vip_conf['19']['vid']) + if 10 in vip_vds: + k4_vids.append(vip_conf['10']['vid']) for v in k4_vids: k4_info = getVMS(tvid, v) if info['code'] == 'A00000': @@ -246,4 +251,4 @@ class Iqiyi(VideoExtractor): site = Iqiyi() download = site.download_by_url iqiyi_download_by_vid = site.download_by_vid -download_playlist = site.download_playlist_by_url \ No newline at end of file +download_playlist = site.download_playlist_by_url