prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  youtube-dl bug due to new ARD layout
   youtube-dl --verbose http://www.ardmediathek.de/tv/14-Tageb%C3%BCcher-des-Ersten-Weltkriegs/Folge-4-Die-Entscheidung/Das-Erste/Video?documentId=21568646&bcastId=20282330
  [1] 7470
  [x@yhost ~]$ [debug] System config: []
  [debug] User config: []
  [debug] Command-line args: ['--verbose', 'http://www.ardmediathek.de/tv/14-Tageb%C3%BCcher-des-Ersten-Weltkriegs/Folge-4-Die-Entscheidung/Das-Erste/Video?documentId=21568646']
  [debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
  [debug] youtube-dl version 2014.05.19
  [debug] Python version 3.4.1 - Linux-3.14.4xxxxxx
  [debug] Proxy map: {}
  [ARD] 21568646: Downloading webpage
  ERROR: Unable to extract title; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.
  Traceback (most recent call last):
    File "/usr/lib/python3.4/site-packages/youtube_dl/YoutubeDL.py", line 516, in extract_info
      ie_result = ie.extract(url)
    File "/usr/lib/python3.4/site-packages/youtube_dl/extractor/common.py", line 163, in extract
      return self._real_extract(url)
    File "/usr/lib/python3.4/site-packages/youtube_dl/extractor/ard.py", line 41, in _real_extract
      r'<h1(?:\s+class="boxTopHeadline")?>(.*?)</h1>', webpage, 'title')
    File "/usr/lib/python3.4/site-packages/youtube_dl/extractor/common.py", line 389, in _html_search_regex
      res = self._search_regex(pattern, string, name, default, fatal, flags)
    File "/usr/lib/python3.4/site-packages/youtube_dl/extractor/common.py", line 379, in _search_regex
      raise RegexNotFoundError(u'Unable to extract %s' % _name)
  youtube_dl.utils.RegexNotFoundError: Unable to extract title; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.
  
  [1]+  Exit 1                  youtube-dl --verbose http://www.ardmediathek.de/tv/14-Tageb%C3%BCcher-des-Ersten-Weltkriegs/Folge-4-Die-Entscheidung/Das-Erste/Video?documentId=21568646
  
  
  --- 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/ard.py`
  Content:
  ```
  1 # coding: utf-8
  2 from __future__ import unicode_literals
  3 
  4 import re
  5 
  6 from .common import InfoExtractor
  7 from ..utils import (
  8     determine_ext,
  9     ExtractorError,
  10 )
  11 
  12 
  13 class ARDIE(InfoExtractor):
  14     _VALID_URL = r'^https?://(?:(?:www\.)?ardmediathek\.de|mediathek\.daserste\.de)/(?:.*/)(?P<video_id>[^/\?]+)(?:\?.*)?'
  15 
  16     _TEST = {
  17         'url': 'http://www.ardmediathek.de/das-erste/guenther-jauch/edward-snowden-im-interview-held-oder-verraeter?documentId=19288786',
  18         'file': '19288786.mp4',
  19         'md5': '515bf47ce209fb3f5a61b7aad364634c',
  20         'info_dict': {
  21             'title': 'Edward Snowden im Interview - Held oder Verräter?',
  22             'description': 'Edward Snowden hat alles aufs Spiel gesetzt, um die weltweite \xdcberwachung durch die Geheimdienste zu enttarnen. Nun stellt sich der ehemalige NSA-Mitarbeiter erstmals weltweit in einem TV-Interview den Fragen eines NDR-Journalisten. Die Sendung vom Sonntagabend.',
  23             'thumbnail': 'http://www.ardmediathek.de/ard/servlet/contentblob/19/28/87/90/19288790/bild/2250037',
  24         },
  25         'skip': 'Blocked outside of Germany',
  26     }
  27 
  28     def _real_extract(self, url):
  29         # determine video id from url
  30         m = re.match(self._VALID_URL, url)
  31 
  32         numid = re.search(r'documentId=([0-9]+)', url)
  33         if numid:
  34             video_id = numid.group(1)
  35         else:
  36             video_id = m.group('video_id')
  37 
  38         webpage = self._download_webpage(url, video_id)
  39 
  40         title = self._html_search_regex(
  41             [r'<h1(?:\s+class="boxTopHeadline")?>(.*?)</h1>',
  42              r'<h4 class="headline">(.*?)</h4>'],
  43             webpage, 'title')
  44         description = self._html_search_meta(
  45             'dcterms.abstract', webpage, 'description')
  46         thumbnail = self._og_search_thumbnail(webpage)
  47 
  48         streams = [
  49             mo.groupdict()
  50             for mo in re.finditer(
  51                 r'mediaCollection\.addMediaStream\((?P<media_type>\d+), (?P<quality>\d+), "(?P<rtmp_url>[^"]*)", "(?P<video_url>[^"]*)", "[^"]*"\)', webpage)]
  52         if not streams:
  53             if '"fsk"' in webpage:
  54                 raise ExtractorError('This video is only available after 20:00')
  55 
  56         formats = []
  57         for s in streams:
  58             format = {
  59                 'quality': int(s['quality']),
  60             }
  61             if s.get('rtmp_url'):
  62                 format['protocol'] = 'rtmp'
  63                 format['url'] = s['rtmp_url']
  64                 format['playpath'] = s['video_url']
  65             else:
  66                 format['url'] = s['video_url']
  67 
  68             quality_name = self._search_regex(
  69                 r'[,.]([a-zA-Z0-9_-]+),?\.mp4', format['url'],
  70                 'quality name', default='NA')
  71             format['format_id'] = '%s-%s-%s-%s' % (
  72                 determine_ext(format['url']), quality_name, s['media_type'],
  73                 s['quality'])
  74 
  75             formats.append(format)
  76 
  77         self._sort_formats(formats)
  78 
  79         return {
  80             'id': video_id,
  81             'title': title,
  82             'description': description,
  83             'formats': formats,
  84             'thumbnail': thumbnail,
  85         }
  86
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/youtube_dl/extractor/ard.py b/youtube_dl/extractor/ard.py
  --- a/youtube_dl/extractor/ard.py
  +++ b/youtube_dl/extractor/ard.py
  @@ -39,16 +39,18 @@
   
           title = self._html_search_regex(
               [r'<h1(?:\s+class="boxTopHeadline")?>(.*?)</h1>',
  +             r'<meta name="dcterms.title" content="(.*?)"/>',
                r'<h4 class="headline">(.*?)</h4>'],
               webpage, 'title')
           description = self._html_search_meta(
               'dcterms.abstract', webpage, 'description')
           thumbnail = self._og_search_thumbnail(webpage)
   
  -        streams = [
  -            mo.groupdict()
  -            for mo in re.finditer(
  -                r'mediaCollection\.addMediaStream\((?P<media_type>\d+), (?P<quality>\d+), "(?P<rtmp_url>[^"]*)", "(?P<video_url>[^"]*)", "[^"]*"\)', webpage)]
  +
  +        media_info = self._download_json(
  +            'http://www.ardmediathek.de/play/media/%s' % video_id, video_id)
  +        # The second element of the _mediaArray contains the standard http urls
  +        streams = media_info['_mediaArray'][1]['_mediaStreamArray']
           if not streams:
               if '"fsk"' in webpage:
                   raise ExtractorError('This video is only available after 20:00')
  @@ -56,21 +58,12 @@
           formats = []
           for s in streams:
               format = {
  -                'quality': int(s['quality']),
  +                'quality': s['_quality'],
  +                'url': s['_stream'],
               }
  -            if s.get('rtmp_url'):
  -                format['protocol'] = 'rtmp'
  -                format['url'] = s['rtmp_url']
  -                format['playpath'] = s['video_url']
  -            else:
  -                format['url'] = s['video_url']
  -
  -            quality_name = self._search_regex(
  -                r'[,.]([a-zA-Z0-9_-]+),?\.mp4', format['url'],
  -                'quality name', default='NA')
  -            format['format_id'] = '%s-%s-%s-%s' % (
  -                determine_ext(format['url']), quality_name, s['media_type'],
  -                s['quality'])
  +
  +            format['format_id'] = '%s-%s' % (
  +                determine_ext(format['url']), format['quality'])
   
               formats.append(format)
  
verification_info: {"golden_diff": "diff --git a/youtube_dl/extractor/ard.py b/youtube_dl/extractor/ard.py\n--- a/youtube_dl/extractor/ard.py\n+++ b/youtube_dl/extractor/ard.py\n@@ -39,16 +39,18 @@\n \n         title = self._html_search_regex(\n             [r'<h1(?:\\s+class=\"boxTopHeadline\")?>(.*?)</h1>',\n+             r'<meta name=\"dcterms.title\" content=\"(.*?)\"/>',\n              r'<h4 class=\"headline\">(.*?)</h4>'],\n             webpage, 'title')\n         description = self._html_search_meta(\n             'dcterms.abstract', webpage, 'description')\n         thumbnail = self._og_search_thumbnail(webpage)\n \n-        streams = [\n-            mo.groupdict()\n-            for mo in re.finditer(\n-                r'mediaCollection\\.addMediaStream\\((?P<media_type>\\d+), (?P<quality>\\d+), \"(?P<rtmp_url>[^\"]*)\", \"(?P<video_url>[^\"]*)\", \"[^\"]*\"\\)', webpage)]\n+\n+        media_info = self._download_json(\n+            'http://www.ardmediathek.de/play/media/%s' % video_id, video_id)\n+        # The second element of the _mediaArray contains the standard http urls\n+        streams = media_info['_mediaArray'][1]['_mediaStreamArray']\n         if not streams:\n             if '\"fsk\"' in webpage:\n                 raise ExtractorError('This video is only available after 20:00')\n@@ -56,21 +58,12 @@\n         formats = []\n         for s in streams:\n             format = {\n-                'quality': int(s['quality']),\n+                'quality': s['_quality'],\n+                'url': s['_stream'],\n             }\n-            if s.get('rtmp_url'):\n-                format['protocol'] = 'rtmp'\n-                format['url'] = s['rtmp_url']\n-                format['playpath'] = s['video_url']\n-            else:\n-                format['url'] = s['video_url']\n-\n-            quality_name = self._search_regex(\n-                r'[,.]([a-zA-Z0-9_-]+),?\\.mp4', format['url'],\n-                'quality name', default='NA')\n-            format['format_id'] = '%s-%s-%s-%s' % (\n-                determine_ext(format['url']), quality_name, s['media_type'],\n-                s['quality'])\n+\n+            format['format_id'] = '%s-%s' % (\n+                determine_ext(format['url']), format['quality'])\n \n             formats.append(format)\n", "issue": "youtube-dl bug due to new ARD layout\n youtube-dl --verbose http://www.ardmediathek.de/tv/14-Tageb%C3%BCcher-des-Ersten-Weltkriegs/Folge-4-Die-Entscheidung/Das-Erste/Video?documentId=21568646&bcastId=20282330\n[1] 7470\n[x@yhost ~]$ [debug] System config: []\n[debug] User config: []\n[debug] Command-line args: ['--verbose', 'http://www.ardmediathek.de/tv/14-Tageb%C3%BCcher-des-Ersten-Weltkriegs/Folge-4-Die-Entscheidung/Das-Erste/Video?documentId=21568646']\n[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8\n[debug] youtube-dl version 2014.05.19\n[debug] Python version 3.4.1 - Linux-3.14.4xxxxxx\n[debug] Proxy map: {}\n[ARD] 21568646: Downloading webpage\nERROR: Unable to extract title; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.\nTraceback (most recent call last):\n  File \"/usr/lib/python3.4/site-packages/youtube_dl/YoutubeDL.py\", line 516, in extract_info\n    ie_result = ie.extract(url)\n  File \"/usr/lib/python3.4/site-packages/youtube_dl/extractor/common.py\", line 163, in extract\n    return self._real_extract(url)\n  File \"/usr/lib/python3.4/site-packages/youtube_dl/extractor/ard.py\", line 41, in _real_extract\n    r'<h1(?:\\s+class=\"boxTopHeadline\")?>(.*?)</h1>', webpage, 'title')\n  File \"/usr/lib/python3.4/site-packages/youtube_dl/extractor/common.py\", line 389, in _html_search_regex\n    res = self._search_regex(pattern, string, name, default, fatal, flags)\n  File \"/usr/lib/python3.4/site-packages/youtube_dl/extractor/common.py\", line 379, in _search_regex\n    raise RegexNotFoundError(u'Unable to extract %s' % _name)\nyoutube_dl.utils.RegexNotFoundError: Unable to extract title; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.\n\n[1]+  Exit 1                  youtube-dl --verbose http://www.ardmediathek.de/tv/14-Tageb%C3%BCcher-des-Ersten-Weltkriegs/Folge-4-Die-Entscheidung/Das-Erste/Video?documentId=21568646\n\n", "before_files": [{"content": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nimport re\n\nfrom .common import InfoExtractor\nfrom ..utils import (\n    determine_ext,\n    ExtractorError,\n)\n\n\nclass ARDIE(InfoExtractor):\n    _VALID_URL = r'^https?://(?:(?:www\\.)?ardmediathek\\.de|mediathek\\.daserste\\.de)/(?:.*/)(?P<video_id>[^/\\?]+)(?:\\?.*)?'\n\n    _TEST = {\n        'url': 'http://www.ardmediathek.de/das-erste/guenther-jauch/edward-snowden-im-interview-held-oder-verraeter?documentId=19288786',\n        'file': '19288786.mp4',\n        'md5': '515bf47ce209fb3f5a61b7aad364634c',\n        'info_dict': {\n            'title': 'Edward Snowden im Interview - Held oder Verr\u00e4ter?',\n            'description': 'Edward Snowden hat alles aufs Spiel gesetzt, um die weltweite \\xdcberwachung durch die Geheimdienste zu enttarnen. Nun stellt sich der ehemalige NSA-Mitarbeiter erstmals weltweit in einem TV-Interview den Fragen eines NDR-Journalisten. Die Sendung vom Sonntagabend.',\n            'thumbnail': 'http://www.ardmediathek.de/ard/servlet/contentblob/19/28/87/90/19288790/bild/2250037',\n        },\n        'skip': 'Blocked outside of Germany',\n    }\n\n    def _real_extract(self, url):\n        # determine video id from url\n        m = re.match(self._VALID_URL, url)\n\n        numid = re.search(r'documentId=([0-9]+)', url)\n        if numid:\n            video_id = numid.group(1)\n        else:\n            video_id = m.group('video_id')\n\n        webpage = self._download_webpage(url, video_id)\n\n        title = self._html_search_regex(\n            [r'<h1(?:\\s+class=\"boxTopHeadline\")?>(.*?)</h1>',\n             r'<h4 class=\"headline\">(.*?)</h4>'],\n            webpage, 'title')\n        description = self._html_search_meta(\n            'dcterms.abstract', webpage, 'description')\n        thumbnail = self._og_search_thumbnail(webpage)\n\n        streams = [\n            mo.groupdict()\n            for mo in re.finditer(\n                r'mediaCollection\\.addMediaStream\\((?P<media_type>\\d+), (?P<quality>\\d+), \"(?P<rtmp_url>[^\"]*)\", \"(?P<video_url>[^\"]*)\", \"[^\"]*\"\\)', webpage)]\n        if not streams:\n            if '\"fsk\"' in webpage:\n                raise ExtractorError('This video is only available after 20:00')\n\n        formats = []\n        for s in streams:\n            format = {\n                'quality': int(s['quality']),\n            }\n            if s.get('rtmp_url'):\n                format['protocol'] = 'rtmp'\n                format['url'] = s['rtmp_url']\n                format['playpath'] = s['video_url']\n            else:\n                format['url'] = s['video_url']\n\n            quality_name = self._search_regex(\n                r'[,.]([a-zA-Z0-9_-]+),?\\.mp4', format['url'],\n                'quality name', default='NA')\n            format['format_id'] = '%s-%s-%s-%s' % (\n                determine_ext(format['url']), quality_name, s['media_type'],\n                s['quality'])\n\n            formats.append(format)\n\n        self._sort_formats(formats)\n\n        return {\n            'id': video_id,\n            'title': title,\n            'description': description,\n            'formats': formats,\n            'thumbnail': thumbnail,\n        }\n", "path": "youtube_dl/extractor/ard.py"}], "after_files": [{"content": "# coding: utf-8\nfrom __future__ import unicode_literals\n\nimport re\n\nfrom .common import InfoExtractor\nfrom ..utils import (\n    determine_ext,\n    ExtractorError,\n)\n\n\nclass ARDIE(InfoExtractor):\n    _VALID_URL = r'^https?://(?:(?:www\\.)?ardmediathek\\.de|mediathek\\.daserste\\.de)/(?:.*/)(?P<video_id>[^/\\?]+)(?:\\?.*)?'\n\n    _TEST = {\n        'url': 'http://www.ardmediathek.de/das-erste/guenther-jauch/edward-snowden-im-interview-held-oder-verraeter?documentId=19288786',\n        'file': '19288786.mp4',\n        'md5': '515bf47ce209fb3f5a61b7aad364634c',\n        'info_dict': {\n            'title': 'Edward Snowden im Interview - Held oder Verr\u00e4ter?',\n            'description': 'Edward Snowden hat alles aufs Spiel gesetzt, um die weltweite \\xdcberwachung durch die Geheimdienste zu enttarnen. Nun stellt sich der ehemalige NSA-Mitarbeiter erstmals weltweit in einem TV-Interview den Fragen eines NDR-Journalisten. Die Sendung vom Sonntagabend.',\n            'thumbnail': 'http://www.ardmediathek.de/ard/servlet/contentblob/19/28/87/90/19288790/bild/2250037',\n        },\n        'skip': 'Blocked outside of Germany',\n    }\n\n    def _real_extract(self, url):\n        # determine video id from url\n        m = re.match(self._VALID_URL, url)\n\n        numid = re.search(r'documentId=([0-9]+)', url)\n        if numid:\n            video_id = numid.group(1)\n        else:\n            video_id = m.group('video_id')\n\n        webpage = self._download_webpage(url, video_id)\n\n        title = self._html_search_regex(\n            [r'<h1(?:\\s+class=\"boxTopHeadline\")?>(.*?)</h1>',\n             r'<meta name=\"dcterms.title\" content=\"(.*?)\"/>',\n             r'<h4 class=\"headline\">(.*?)</h4>'],\n            webpage, 'title')\n        description = self._html_search_meta(\n            'dcterms.abstract', webpage, 'description')\n        thumbnail = self._og_search_thumbnail(webpage)\n\n\n        media_info = self._download_json(\n            'http://www.ardmediathek.de/play/media/%s' % video_id, video_id)\n        # The second element of the _mediaArray contains the standard http urls\n        streams = media_info['_mediaArray'][1]['_mediaStreamArray']\n        if not streams:\n            if '\"fsk\"' in webpage:\n                raise ExtractorError('This video is only available after 20:00')\n\n        formats = []\n        for s in streams:\n            format = {\n                'quality': s['_quality'],\n                'url': s['_stream'],\n            }\n\n            format['format_id'] = '%s-%s' % (\n                determine_ext(format['url']), format['quality'])\n\n            formats.append(format)\n\n        self._sort_formats(formats)\n\n        return {\n            'id': video_id,\n            'title': title,\n            'description': description,\n            'formats': formats,\n            'thumbnail': thumbnail,\n        }\n", "path": "youtube_dl/extractor/ard.py"}]}