0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-24 02:35:12 +00:00

Merge pull request #7382 from remitamine/miomio

[miomio] fix info extraction (fixes #7366)
This commit is contained in:
Yen Chi Hsuan 2015-11-06 14:50:39 +08:00
commit 123c781044

View file

@ -4,6 +4,7 @@
import random
from .common import InfoExtractor
from ..compat import compat_urllib_request
from ..utils import (
xpath_text,
int_or_none,
@ -51,6 +52,8 @@ def _real_extract(self, url):
mioplayer_path = self._search_regex(
r'src="(/mioplayer/[^"]+)"', webpage, 'ref_path')
http_headers = {'Referer': 'http://www.miomio.tv%s' % mioplayer_path,}
xml_config = self._search_regex(
r'flashvars="type=(?:sina|video)&(.+?)&',
webpage, 'xml config')
@ -60,14 +63,12 @@ def _real_extract(self, url):
'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/xml.php?id=%s&r=%s' % (id, random.randint(100, 999)),
video_id)
# the following xml contains the actual configuration information on the video file(s)
vid_config = self._download_xml(
vid_config_request = compat_urllib_request.Request(
'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/sina.php?{0}'.format(xml_config),
video_id)
headers=http_headers)
http_headers = {
'Referer': 'http://www.miomio.tv%s' % mioplayer_path,
}
# the following xml contains the actual configuration information on the video file(s)
vid_config = self._download_xml(vid_config_request, video_id)
if not int_or_none(xpath_text(vid_config, 'timelength')):
raise ExtractorError('Unable to load videos!', expected=True)