[myvideo] add support for videos that place the video info inside www.myvideo.de/service/data/video/{id}/config (fixes #616)

This commit is contained in:
Jaime Marquínez Ferrándiz 2013-08-02 21:09:17 +02:00
parent 09825cb5c0
commit fbf189a6ee

View file

@ -2,11 +2,13 @@
import base64 import base64
import hashlib import hashlib
import re import re
import json
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
compat_ord, compat_ord,
compat_urllib_parse, compat_urllib_parse,
compat_urllib_request,
ExtractorError, ExtractorError,
) )
@ -16,7 +18,7 @@
class MyVideoIE(InfoExtractor): class MyVideoIE(InfoExtractor):
"""Information Extractor for myvideo.de.""" """Information Extractor for myvideo.de."""
_VALID_URL = r'(?:http://)?(?:www\.)?myvideo\.de/watch/([0-9]+)/([^?/]+).*' _VALID_URL = r'(?:http://)?(?:www\.)?myvideo\.de/(?:[^/]+/)?watch/([0-9]+)/([^?/]+).*'
IE_NAME = u'myvideo' IE_NAME = u'myvideo'
_TEST = { _TEST = {
u'url': u'http://www.myvideo.de/watch/8229274/bowling_fail_or_win', u'url': u'http://www.myvideo.de/watch/8229274/bowling_fail_or_win',
@ -85,6 +87,20 @@ def _real_extract(self,url):
'ext': video_ext, 'ext': video_ext,
}] }]
mobj = re.search(r'data-video-service="/service/data/video/%s/config' % video_id, webpage)
if mobj is not None:
request = compat_urllib_request.Request('http://www.myvideo.de/service/data/video/%s/config' % video_id, '')
response = self._download_webpage(request, video_id,
u'Downloading video info')
info = json.loads(base64.b64decode(response).decode('utf-8'))
return {'id': video_id,
'title': info['title'],
'url': info['streaming_url'].replace('rtmpe', 'rtmpt'),
'play_path': info['filename'],
'ext': 'flv',
'thumbnail': info['thumbnail'][0]['url'],
}
# try encxml # try encxml
mobj = re.search('var flashvars={(.+?)}', webpage) mobj = re.search('var flashvars={(.+?)}', webpage)
if mobj is None: if mobj is None: