[miomio] use the formats urls headers for downloading xml

This commit is contained in:
remitamine 2015-11-06 06:33:05 +01:00
parent 6953d8e95a
commit e68dd1921a

View file

@ -52,6 +52,8 @@ def _real_extract(self, url):
mioplayer_path = self._search_regex( mioplayer_path = self._search_regex(
r'src="(/mioplayer/[^"]+)"', webpage, 'ref_path') r'src="(/mioplayer/[^"]+)"', webpage, 'ref_path')
http_headers = {'Referer': 'http://www.miomio.tv%s' % mioplayer_path,}
xml_config = self._search_regex( xml_config = self._search_regex(
r'flashvars="type=(?:sina|video)&(.+?)&', r'flashvars="type=(?:sina|video)&(.+?)&',
webpage, 'xml config') webpage, 'xml config')
@ -63,15 +65,11 @@ def _real_extract(self, url):
vid_config_request = compat_urllib_request.Request( vid_config_request = compat_urllib_request.Request(
'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/sina.php?{0}'.format(xml_config), 'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/sina.php?{0}'.format(xml_config),
headers={'Referer': 'http://www.miomio.tv/mioplayer/mioplayer-v3.0.swf'}) headers=http_headers)
# the following xml contains the actual configuration information on the video file(s) # the following xml contains the actual configuration information on the video file(s)
vid_config = self._download_xml(vid_config_request, video_id) vid_config = self._download_xml(vid_config_request, video_id)
http_headers = {
'Referer': 'http://www.miomio.tv%s' % mioplayer_path,
}
if not int_or_none(xpath_text(vid_config, 'timelength')): if not int_or_none(xpath_text(vid_config, 'timelength')):
raise ExtractorError('Unable to load videos!', expected=True) raise ExtractorError('Unable to load videos!', expected=True)