aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/InfoExtractors.py
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-06-21 19:28:23 +0200
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-06-21 21:51:10 +0200
commit77d0f05f714eec81f076025f309d5d39325d5d0f (patch)
tree77f460f6062783ed722498eaf75cc89d511f7b8e /youtube_dl/InfoExtractors.py
parent50d2376769725fcab6472d09919d78f92cb19005 (diff)
downloadyoutube-dl-77d0f05f714eec81f076025f309d5d39325d5d0f.tar.xz
YoutubeIE: Detect new Vevo style videos
The url_encoded_fmt_stream_map can be found in the video page, but the signature must be decrypted, we get it from the webpage instead of the `get_video_info` pages because we have only discover the algorithm for keys with both sub keys of size 43.
Diffstat (limited to 'youtube_dl/InfoExtractors.py')
-rwxr-xr-xyoutube_dl/InfoExtractors.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index 8d228d40d..a12bffbe3 100755
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -724,6 +724,16 @@ class YoutubeIE(InfoExtractor):
# Decide which formats to download
req_format = self._downloader.params.get('format', None)
+ try:
+ mobj = re.search(r';ytplayer.config = ({.*?});', video_webpage)
+ info = json.loads(mobj.group(1))
+ if 'dashmpd' in info['args']:
+ # Vevo videos with encrypted signatures
+ self.to_screen(u'Vevo video detected.')
+ video_info['url_encoded_fmt_stream_map'] = [info['args']['url_encoded_fmt_stream_map']]
+ except ValueError:
+ pass
+
if 'conn' in video_info and video_info['conn'][0].startswith('rtmp'):
self.report_rtmp_download()
video_url_list = [(None, video_info['conn'][0])]
@@ -735,6 +745,16 @@ class YoutubeIE(InfoExtractor):
url = url_data['url'][0]
if 'sig' in url_data:
url += '&signature=' + url_data['sig'][0]
+ if 's' in url_data:
+ def k(s):
+ """Decrypt the key the two subkeys must have a length of 43"""
+ (a,b) = s.split('.')
+ b = ''.join([b[:8],a[0],b[9:18],b[-4],b[19:39], b[18]])[0:40]
+ a = a[-40:]
+ s_dec = '.'.join((a,b))[::-1]
+ return s_dec
+ key = k(url_data['s'][0])
+ url += '&signature=' + key
if 'ratebypass' not in url:
url += '&ratebypass=yes'
url_map[url_data['itag'][0]] = url