From 5dd7b5fd10fdc7a912a1c71a18727bb38f568bfd Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Wed, 21 Oct 2015 20:53:14 +0200 Subject: [PATCH] [youtube] fix VEVO when no 's' field presents --- src/you_get/common.py | 2 +- src/you_get/extractors/youtube.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/you_get/common.py b/src/you_get/common.py index fd3d7cd7..76871458 100755 --- a/src/you_get/common.py +++ b/src/you_get/common.py @@ -72,7 +72,7 @@ SITES = { 'vk' : 'vk', 'xiami' : 'xiami', 'yinyuetai' : 'yinyuetai', - 'miaopai': 'yixia_miaopai', + 'miaopai' : 'yixia_miaopai', 'youku' : 'youku', 'youtu' : 'youtube', 'youtube' : 'youtube', diff --git a/src/you_get/extractors/youtube.py b/src/you_get/extractors/youtube.py index fe6df15a..b0189ca1 100644 --- a/src/you_get/extractors/youtube.py +++ b/src/you_get/extractors/youtube.py @@ -276,13 +276,15 @@ class YouTube(VideoExtractor): for stream in streams: # audio if stream['type'].startswith('audio/mp4'): dash_mp4_a_url = stream['url'] - sig = self.__class__.decipher(self.js, stream['s']) - dash_mp4_a_url += '&signature={}'.format(sig) + if 's' in stream: + sig = self.__class__.decipher(self.js, stream['s']) + dash_mp4_a_url += '&signature={}'.format(sig) dash_mp4_a_size = stream['clen'] elif stream['type'].startswith('audio/webm'): dash_webm_a_url = stream['url'] - sig = self.__class__.decipher(self.js, stream['s']) - dash_webm_a_url += '&signature={}'.format(sig) + if 's' in stream: + sig = self.__class__.decipher(self.js, stream['s']) + dash_webm_a_url += '&signature={}'.format(sig) dash_webm_a_size = stream['clen'] for stream in streams: # video if 'size' in stream: