aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2015-11-06 14:50:39 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2015-11-06 14:50:39 +0800
commit123c781044a8ba0a39edbb839bfaccb929892389 (patch)
tree11d9545d5a6130607e27f8d629a07cb2f10e2ef6
parentb3613d36da14ab527166326707c0f911d192144d (diff)
parente68dd1921ad7528d225a8571066f99b9934b6a06 (diff)
downloadyoutube-dl-123c781044a8ba0a39edbb839bfaccb929892389.zip
youtube-dl-123c781044a8ba0a39edbb839bfaccb929892389.tar.gz
youtube-dl-123c781044a8ba0a39edbb839bfaccb929892389.tar.bz2
Merge pull request #7382 from remitamine/miomio
[miomio] fix info extraction (fixes #7366)
-rw-r--r--youtube_dl/extractor/miomio.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/youtube_dl/extractor/miomio.py b/youtube_dl/extractor/miomio.py
index a784fc5..6f40bf1 100644
--- a/youtube_dl/extractor/miomio.py
+++ b/youtube_dl/extractor/miomio.py
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
import random
from .common import InfoExtractor
+from ..compat import compat_urllib_request
from ..utils import (
xpath_text,
int_or_none,
@@ -51,6 +52,8 @@ class MioMioIE(InfoExtractor):
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)&amp;(.+?)&amp;',
webpage, 'xml config')
@@ -60,14 +63,12 @@ class MioMioIE(InfoExtractor):
'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)