We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
MioMio youtube-dl failing with HTTPError()
I get an HTTP Error 404 when try to download video from MioMio.
I experience this error only in MioMio.
Pretty sure download from MioMio was working till last week.
# 

pi@raspberrypi2 ~ $ youtube-dl --version
2015.11.02
pi@raspberrypi2 ~ $ youtube-dl --verbose 'http://www.miomio.tv/watch/cc223353/'
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'--verbose', u'http://www.miomio.tv/watch/cc223353/']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2015.11.02
[debug] Python version 2.7.3 - Linux-4.1.6-v7+-armv7l-with-debian-7.8
[debug] exe versions: avconv 9.14-6, avprobe 9.14-6, ffmpeg 0.8.17-6
[debug] Proxy map: {}
[miomio.tv] 223353: Downloading webpage
[miomio.tv] 223353: Downloading webpage
[miomio.tv] 223353: Downloading XML
ERROR: Unable to download XML: HTTP Error 404: Not Found (caused by HTTPError()); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 329, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 1873, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/lib/python2.7/urllib2.py", line 407, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 520, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 439, in error
    result = self._call_chain(_args)
  File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
    result = func(_args)
  File "/usr/lib/python2.7/urllib2.py", line 626, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python2.7/urllib2.py", line 407, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 520, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 445, in error
    return self._call_chain(_args)
  File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
    result = func(_args)
  File "/usr/lib/python2.7/urllib2.py", line 528, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

pi@raspberrypi2 ~ $
# 

Best Regards


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `youtube_dl/extractor/miomio.py`
Content:
```
1 # coding: utf-8
2 from __future__ import unicode_literals
3 
4 import random
5 
6 from .common import InfoExtractor
7 from ..utils import (
8     xpath_text,
9     int_or_none,
10     ExtractorError,
11 )
12 
13 
14 class MioMioIE(InfoExtractor):
15     IE_NAME = 'miomio.tv'
16     _VALID_URL = r'https?://(?:www\.)?miomio\.tv/watch/cc(?P<id>[0-9]+)'
17     _TESTS = [{
18         # "type=video" in flashvars
19         'url': 'http://www.miomio.tv/watch/cc88912/',
20         'md5': '317a5f7f6b544ce8419b784ca8edae65',
21         'info_dict': {
22             'id': '88912',
23             'ext': 'flv',
24             'title': '【SKY】字幕 铠武昭和VS平成 假面骑士大战FEAT战队 魔星字幕组 字幕',
25             'duration': 5923,
26         },
27     }, {
28         'url': 'http://www.miomio.tv/watch/cc184024/',
29         'info_dict': {
30             'id': '43729',
31             'title': '《动漫同人插画绘制》',
32         },
33         'playlist_mincount': 86,
34         'skip': 'This video takes time too long for retrieving the URL',
35     }, {
36         'url': 'http://www.miomio.tv/watch/cc173113/',
37         'info_dict': {
38             'id': '173113',
39             'title': 'The New Macbook 2015 上手试玩与简评'
40         },
41         'playlist_mincount': 2,
42     }]
43 
44     def _real_extract(self, url):
45         video_id = self._match_id(url)
46         webpage = self._download_webpage(url, video_id)
47 
48         title = self._html_search_meta(
49             'description', webpage, 'title', fatal=True)
50 
51         mioplayer_path = self._search_regex(
52             r'src="(/mioplayer/[^"]+)"', webpage, 'ref_path')
53 
54         xml_config = self._search_regex(
55             r'flashvars="type=(?:sina|video)&amp;(.+?)&amp;',
56             webpage, 'xml config')
57 
58         # skipping the following page causes lags and eventually connection drop-outs
59         self._request_webpage(
60             'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/xml.php?id=%s&r=%s' % (id, random.randint(100, 999)),
61             video_id)
62 
63         # the following xml contains the actual configuration information on the video file(s)
64         vid_config = self._download_xml(
65             'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/sina.php?{0}'.format(xml_config),
66             video_id)
67 
68         http_headers = {
69             'Referer': 'http://www.miomio.tv%s' % mioplayer_path,
70         }
71 
72         if not int_or_none(xpath_text(vid_config, 'timelength')):
73             raise ExtractorError('Unable to load videos!', expected=True)
74 
75         entries = []
76         for f in vid_config.findall('./durl'):
77             segment_url = xpath_text(f, 'url', 'video url')
78             if not segment_url:
79                 continue
80             order = xpath_text(f, 'order', 'order')
81             segment_id = video_id
82             segment_title = title
83             if order:
84                 segment_id += '-%s' % order
85                 segment_title += ' part %s' % order
86             entries.append({
87                 'id': segment_id,
88                 'url': segment_url,
89                 'title': segment_title,
90                 'duration': int_or_none(xpath_text(f, 'length', 'duration'), 1000),
91                 'http_headers': http_headers,
92             })
93 
94         if len(entries) == 1:
95             segment = entries[0]
96             segment['id'] = video_id
97             segment['title'] = title
98             return segment
99 
100         return {
101             '_type': 'multi_video',
102             'id': video_id,
103             'entries': entries,
104             'title': title,
105             'http_headers': http_headers,
106         }
107
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/youtube_dl/extractor/miomio.py b/youtube_dl/extractor/miomio.py
--- a/youtube_dl/extractor/miomio.py
+++ b/youtube_dl/extractor/miomio.py
@@ -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 @@
         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 @@
             '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)

{"golden_diff": "diff --git a/youtube_dl/extractor/miomio.py b/youtube_dl/extractor/miomio.py\n--- a/youtube_dl/extractor/miomio.py\n+++ b/youtube_dl/extractor/miomio.py\n@@ -4,6 +4,7 @@\n import random\n \n from .common import InfoExtractor\n+from ..compat import compat_urllib_request\n from ..utils import (\n     xpath_text,\n     int_or_none,\n@@ -51,6 +52,8 @@\n         mioplayer_path = self._search_regex(\n             r'src=\"(/mioplayer/[^\"]+)\"', webpage, 'ref_path')\n \n+        http_headers = {'Referer': 'http://www.miomio.tv%s' % mioplayer_path,}\n+\n         xml_config = self._search_regex(\n             r'flashvars=\"type=(?:sina|video)&amp;(.+?)&amp;',\n             webpage, 'xml config')\n@@ -60,14 +63,12 @@\n             'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/xml.php?id=%s&r=%s' % (id, random.randint(100, 999)),\n             video_id)\n \n-        # the following xml contains the actual configuration information on the video file(s)\n-        vid_config = self._download_xml(\n+        vid_config_request = compat_urllib_request.Request(\n             'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/sina.php?{0}'.format(xml_config),\n-            video_id)\n+            headers=http_headers)\n \n-        http_headers = {\n-            'Referer': 'http://www.miomio.tv%s' % mioplayer_path,\n-        }\n+        # the following xml contains the actual configuration information on the video file(s)\n+        vid_config = self._download_xml(vid_config_request, video_id)\n \n         if not int_or_none(xpath_text(vid_config, 'timelength')):\n             raise ExtractorError('Unable to load videos!', expected=True)\n", "issue": "MioMio youtube-dl failing with HTTPError()\nI get an HTTP Error 404 when try to download video from MioMio.\nI experience this error only in MioMio.\nPretty sure download from MioMio was working till last week.\n# \n\npi@raspberrypi2 ~ $ youtube-dl --version\n2015.11.02\npi@raspberrypi2 ~ $ youtube-dl --verbose 'http://www.miomio.tv/watch/cc223353/'\n[debug] System config: []\n[debug] User config: []\n[debug] Command-line args: [u'--verbose', u'http://www.miomio.tv/watch/cc223353/']\n[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8\n[debug] youtube-dl version 2015.11.02\n[debug] Python version 2.7.3 - Linux-4.1.6-v7+-armv7l-with-debian-7.8\n[debug] exe versions: avconv 9.14-6, avprobe 9.14-6, ffmpeg 0.8.17-6\n[debug] Proxy map: {}\n[miomio.tv] 223353: Downloading webpage\n[miomio.tv] 223353: Downloading webpage\n[miomio.tv] 223353: Downloading XML\nERROR: Unable to download XML: HTTP Error 404: Not Found (caused by HTTPError()); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.\n  File \"/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py\", line 329, in _request_webpage\n    return self._downloader.urlopen(url_or_request)\n  File \"/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py\", line 1873, in urlopen\n    return self._opener.open(req, timeout=self._socket_timeout)\n  File \"/usr/lib/python2.7/urllib2.py\", line 407, in open\n    response = meth(req, response)\n  File \"/usr/lib/python2.7/urllib2.py\", line 520, in http_response\n    'http', request, response, code, msg, hdrs)\n  File \"/usr/lib/python2.7/urllib2.py\", line 439, in error\n    result = self._call_chain(_args)\n  File \"/usr/lib/python2.7/urllib2.py\", line 379, in _call_chain\n    result = func(_args)\n  File \"/usr/lib/python2.7/urllib2.py\", line 626, in http_error_302\n    return self.parent.open(new, timeout=req.timeout)\n  File \"/usr/lib/python2.7/urllib2.py\", line 407, in open\n    response = meth(req, response)\n  File \"/usr/lib/python2.7/urllib2.py\", line 520, in http_response\n    'http', request, response, code, msg, hdrs)\n  File \"/usr/lib/python2.7/urllib2.py\", line 445, in error\n    return self._call_chain(_args)\n  File \"/usr/lib/python2.7/urllib2.py\", line 379, in _call_chain\n    result = func(_args)\n  File \"/usr/lib/python2.7/urllib2.py\", line 528, in http_error_default\n    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)\n\npi@raspberrypi2 ~ $\n# \n\nBest Regards\n\n", "before_files": [{"content": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nimport random\n\nfrom .common import InfoExtractor\nfrom ..utils import (\n    xpath_text,\n    int_or_none,\n    ExtractorError,\n)\n\n\nclass MioMioIE(InfoExtractor):\n    IE_NAME = 'miomio.tv'\n    _VALID_URL = r'https?://(?:www\\.)?miomio\\.tv/watch/cc(?P<id>[0-9]+)'\n    _TESTS = [{\n        # \"type=video\" in flashvars\n        'url': 'http://www.miomio.tv/watch/cc88912/',\n        'md5': '317a5f7f6b544ce8419b784ca8edae65',\n        'info_dict': {\n            'id': '88912',\n            'ext': 'flv',\n            'title': '\u3010SKY\u3011\u5b57\u5e55 \u94e0\u6b66\u662d\u548cVS\u5e73\u6210 \u5047\u9762\u9a91\u58eb\u5927\u6218FEAT\u6218\u961f \u9b54\u661f\u5b57\u5e55\u7ec4 \u5b57\u5e55',\n            'duration': 5923,\n        },\n    }, {\n        'url': 'http://www.miomio.tv/watch/cc184024/',\n        'info_dict': {\n            'id': '43729',\n            'title': '\u300a\u52a8\u6f2b\u540c\u4eba\u63d2\u753b\u7ed8\u5236\u300b',\n        },\n        'playlist_mincount': 86,\n        'skip': 'This video takes time too long for retrieving the URL',\n    }, {\n        'url': 'http://www.miomio.tv/watch/cc173113/',\n        'info_dict': {\n            'id': '173113',\n            'title': 'The New Macbook 2015 \u4e0a\u624b\u8bd5\u73a9\u4e0e\u7b80\u8bc4'\n        },\n        'playlist_mincount': 2,\n    }]\n\n    def _real_extract(self, url):\n        video_id = self._match_id(url)\n        webpage = self._download_webpage(url, video_id)\n\n        title = self._html_search_meta(\n            'description', webpage, 'title', fatal=True)\n\n        mioplayer_path = self._search_regex(\n            r'src=\"(/mioplayer/[^\"]+)\"', webpage, 'ref_path')\n\n        xml_config = self._search_regex(\n            r'flashvars=\"type=(?:sina|video)&amp;(.+?)&amp;',\n            webpage, 'xml config')\n\n        # skipping the following page causes lags and eventually connection drop-outs\n        self._request_webpage(\n            'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/xml.php?id=%s&r=%s' % (id, random.randint(100, 999)),\n            video_id)\n\n        # the following xml contains the actual configuration information on the video file(s)\n        vid_config = self._download_xml(\n            'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/sina.php?{0}'.format(xml_config),\n            video_id)\n\n        http_headers = {\n            'Referer': 'http://www.miomio.tv%s' % mioplayer_path,\n        }\n\n        if not int_or_none(xpath_text(vid_config, 'timelength')):\n            raise ExtractorError('Unable to load videos!', expected=True)\n\n        entries = []\n        for f in vid_config.findall('./durl'):\n            segment_url = xpath_text(f, 'url', 'video url')\n            if not segment_url:\n                continue\n            order = xpath_text(f, 'order', 'order')\n            segment_id = video_id\n            segment_title = title\n            if order:\n                segment_id += '-%s' % order\n                segment_title += ' part %s' % order\n            entries.append({\n                'id': segment_id,\n                'url': segment_url,\n                'title': segment_title,\n                'duration': int_or_none(xpath_text(f, 'length', 'duration'), 1000),\n                'http_headers': http_headers,\n            })\n\n        if len(entries) == 1:\n            segment = entries[0]\n            segment['id'] = video_id\n            segment['title'] = title\n            return segment\n\n        return {\n            '_type': 'multi_video',\n            'id': video_id,\n            'entries': entries,\n            'title': title,\n            'http_headers': http_headers,\n        }\n", "path": "youtube_dl/extractor/miomio.py"}], "after_files": [{"content": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nimport random\n\nfrom .common import InfoExtractor\nfrom ..compat import compat_urllib_request\nfrom ..utils import (\n    xpath_text,\n    int_or_none,\n    ExtractorError,\n)\n\n\nclass MioMioIE(InfoExtractor):\n    IE_NAME = 'miomio.tv'\n    _VALID_URL = r'https?://(?:www\\.)?miomio\\.tv/watch/cc(?P<id>[0-9]+)'\n    _TESTS = [{\n        # \"type=video\" in flashvars\n        'url': 'http://www.miomio.tv/watch/cc88912/',\n        'md5': '317a5f7f6b544ce8419b784ca8edae65',\n        'info_dict': {\n            'id': '88912',\n            'ext': 'flv',\n            'title': '\u3010SKY\u3011\u5b57\u5e55 \u94e0\u6b66\u662d\u548cVS\u5e73\u6210 \u5047\u9762\u9a91\u58eb\u5927\u6218FEAT\u6218\u961f \u9b54\u661f\u5b57\u5e55\u7ec4 \u5b57\u5e55',\n            'duration': 5923,\n        },\n    }, {\n        'url': 'http://www.miomio.tv/watch/cc184024/',\n        'info_dict': {\n            'id': '43729',\n            'title': '\u300a\u52a8\u6f2b\u540c\u4eba\u63d2\u753b\u7ed8\u5236\u300b',\n        },\n        'playlist_mincount': 86,\n        'skip': 'This video takes time too long for retrieving the URL',\n    }, {\n        'url': 'http://www.miomio.tv/watch/cc173113/',\n        'info_dict': {\n            'id': '173113',\n            'title': 'The New Macbook 2015 \u4e0a\u624b\u8bd5\u73a9\u4e0e\u7b80\u8bc4'\n        },\n        'playlist_mincount': 2,\n    }]\n\n    def _real_extract(self, url):\n        video_id = self._match_id(url)\n        webpage = self._download_webpage(url, video_id)\n\n        title = self._html_search_meta(\n            'description', webpage, 'title', fatal=True)\n\n        mioplayer_path = self._search_regex(\n            r'src=\"(/mioplayer/[^\"]+)\"', webpage, 'ref_path')\n\n        http_headers = {'Referer': 'http://www.miomio.tv%s' % mioplayer_path,}\n\n        xml_config = self._search_regex(\n            r'flashvars=\"type=(?:sina|video)&amp;(.+?)&amp;',\n            webpage, 'xml config')\n\n        # skipping the following page causes lags and eventually connection drop-outs\n        self._request_webpage(\n            'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/xml.php?id=%s&r=%s' % (id, random.randint(100, 999)),\n            video_id)\n\n        vid_config_request = compat_urllib_request.Request(\n            'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/sina.php?{0}'.format(xml_config),\n            headers=http_headers)\n\n        # the following xml contains the actual configuration information on the video file(s)\n        vid_config = self._download_xml(vid_config_request, video_id)\n\n        if not int_or_none(xpath_text(vid_config, 'timelength')):\n            raise ExtractorError('Unable to load videos!', expected=True)\n\n        entries = []\n        for f in vid_config.findall('./durl'):\n            segment_url = xpath_text(f, 'url', 'video url')\n            if not segment_url:\n                continue\n            order = xpath_text(f, 'order', 'order')\n            segment_id = video_id\n            segment_title = title\n            if order:\n                segment_id += '-%s' % order\n                segment_title += ' part %s' % order\n            entries.append({\n                'id': segment_id,\n                'url': segment_url,\n                'title': segment_title,\n                'duration': int_or_none(xpath_text(f, 'length', 'duration'), 1000),\n                'http_headers': http_headers,\n            })\n\n        if len(entries) == 1:\n            segment = entries[0]\n            segment['id'] = video_id\n            segment['title'] = title\n            return segment\n\n        return {\n            '_type': 'multi_video',\n            'id': video_id,\n            'entries': entries,\n            'title': title,\n            'http_headers': http_headers,\n        }\n", "path": "youtube_dl/extractor/miomio.py"}]}