prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  motherless extractor - test 0 fails
  ```
  $ python ~/projects/youtube-dl/test/test_download.py TestDownload.test_Motherless
  [Motherless] AC3FFE1: Downloading webpage
  [info] Writing video description metadata as JSON to: AC3FFE1.info.json
  [debug] Invoking downloader on 'http://s17.motherlessmedia.com/dev386/0/572/287/0572287847.mp4/5cb6d38eccba71d7f6bb2ef260997c3d/544A96C0.mp4'
  [download] Destination: AC3FFE1.mp4
  [download] 100% of 10.00KiB in 00:00
  F
  ======================================================================
  FAIL: test_Motherless (__main__.TestDownload)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
  File "/home/crabman/projects/youtube-dl/test/test_download.py", line 170, in test_template
      self.assertTrue(os.path.exists(tc_filename), msg='Missing file ' + tc_filename)
  AssertionError: False is not true : Missing file AC3FFE1.flv
  
  ----------------------------------------------------------------------
  Ran 1 test in 1.690s
  
  FAILED (failures=1)
  ```
  
  Apparently that video's page no longer give you flv, but instead gives you mp4 file. I am not sure why it happened. Maybe motherless doesn't serve flv files anymore, maybe it still does for some videos - I don't know.
  
  
  </issue>
  <code>
  [start of youtube_dl/extractor/motherless.py]
  1 from __future__ import unicode_literals
  2 
  3 import datetime
  4 import re
  5 
  6 from .common import InfoExtractor
  7 from ..utils import (
  8     int_or_none,
  9     unified_strdate,
  10 )
  11 
  12 
  13 class MotherlessIE(InfoExtractor):
  14     _VALID_URL = r'http://(?:www\.)?motherless\.com/(?P<id>[A-Z0-9]+)'
  15     _TESTS = [
  16         {
  17             'url': 'http://motherless.com/AC3FFE1',
  18             'md5': '5527fef81d2e529215dad3c2d744a7d9',
  19             'info_dict': {
  20                 'id': 'AC3FFE1',
  21                 'ext': 'flv',
  22                 'title': 'Fucked in the ass while playing PS3',
  23                 'categories': ['Gaming', 'anal', 'reluctant', 'rough', 'Wife'],
  24                 'upload_date': '20100913',
  25                 'uploader_id': 'famouslyfuckedup',
  26                 'thumbnail': 're:http://.*\.jpg',
  27                 'age_limit': 18,
  28             }
  29         },
  30         {
  31             'url': 'http://motherless.com/532291B',
  32             'md5': 'bc59a6b47d1f958e61fbd38a4d31b131',
  33             'info_dict': {
  34                 'id': '532291B',
  35                 'ext': 'mp4',
  36                 'title': 'Amazing girl playing the omegle game, PERFECT!',
  37                 'categories': ['Amateur', 'webcam', 'omegle', 'pink', 'young', 'masturbate', 'teen', 'game', 'hairy'],
  38                 'upload_date': '20140622',
  39                 'uploader_id': 'Sulivana7x',
  40                 'thumbnail': 're:http://.*\.jpg',
  41                 'age_limit': 18,
  42             }
  43         }
  44     ]
  45 
  46     def _real_extract(self,url):
  47         mobj = re.match(self._VALID_URL, url)
  48         video_id = mobj.group('id')
  49 
  50         webpage = self._download_webpage(url, video_id)
  51 
  52         title = self._html_search_regex(r'id="view-upload-title">\s+([^<]+)<', webpage, 'title')
  53         
  54         video_url = self._html_search_regex(r'setup\(\{\s+"file".+: "([^"]+)",', webpage, 'video_url')
  55         age_limit = self._rta_search(webpage)
  56 
  57         view_count = self._html_search_regex(r'<strong>Views</strong>\s+([^<]+)<', webpage, 'view_count')
  58  
  59         upload_date = self._html_search_regex(r'<strong>Uploaded</strong>\s+([^<]+)<', webpage, 'upload_date')
  60         if 'Ago' in upload_date:
  61             days = int(re.search(r'([0-9]+)', upload_date).group(1))
  62             upload_date = (datetime.datetime.now() - datetime.timedelta(days=days)).strftime('%Y%m%d')
  63         else:
  64             upload_date = unified_strdate(upload_date)
  65 
  66         like_count = self._html_search_regex(r'<strong>Favorited</strong>\s+([^<]+)<', webpage, 'like_count')
  67 
  68         comment_count = webpage.count('class="media-comment-contents"')
  69         uploader_id = self._html_search_regex(r'"thumb-member-username">\s+<a href="/m/([^"]+)"', webpage, 'uploader_id')
  70 
  71         categories = self._html_search_meta('keywords', webpage)
  72         if categories:
  73             categories = [cat.strip() for cat in categories.split(',')]
  74 
  75         return {
  76             'id': video_id,
  77             'title': title,
  78             'upload_date': upload_date,
  79             'uploader_id': uploader_id,
  80             'thumbnail': self._og_search_thumbnail(webpage),
  81             'categories': categories,
  82             'view_count': int_or_none(view_count.replace(',', '')),
  83             'like_count': int_or_none(like_count.replace(',', '')),
  84             'comment_count': comment_count,
  85             'age_limit': age_limit,
  86             'url': video_url,
  87         }
  88
  [end of youtube_dl/extractor/motherless.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/youtube_dl/extractor/motherless.py b/youtube_dl/extractor/motherless.py
  --- a/youtube_dl/extractor/motherless.py
  +++ b/youtube_dl/extractor/motherless.py
  @@ -11,14 +11,14 @@
   
   
   class MotherlessIE(InfoExtractor):
  -    _VALID_URL = r'http://(?:www\.)?motherless\.com/(?P<id>[A-Z0-9]+)'
  +    _VALID_URL = r'http://(?:www\.)?motherless\.com/(?:g/[a-z0-9_]+/)?(?P<id>[A-Z0-9]+)'
       _TESTS = [
           {
               'url': 'http://motherless.com/AC3FFE1',
  -            'md5': '5527fef81d2e529215dad3c2d744a7d9',
  +            'md5': '310f62e325a9fafe64f68c0bccb6e75f',
               'info_dict': {
                   'id': 'AC3FFE1',
  -                'ext': 'flv',
  +                'ext': 'mp4',
                   'title': 'Fucked in the ass while playing PS3',
                   'categories': ['Gaming', 'anal', 'reluctant', 'rough', 'Wife'],
                   'upload_date': '20100913',
  @@ -40,6 +40,20 @@
                   'thumbnail': 're:http://.*\.jpg',
                   'age_limit': 18,
               }
  +        },
  +        {
  +            'url': 'http://motherless.com/g/cosplay/633979F',
  +            'md5': '0b2a43f447a49c3e649c93ad1fafa4a0',
  +            'info_dict': {
  +                'id': '633979F',
  +                'ext': 'mp4',
  +                'title': 'Turtlette',
  +                'categories': ['superheroine heroine  superher'],
  +                'upload_date': '20140827',
  +                'uploader_id': 'shade0230',
  +                'thumbnail': 're:http://.*\.jpg',
  +                'age_limit': 18,
  +            }
           }
       ]
  
verification_info: {"golden_diff": "diff --git a/youtube_dl/extractor/motherless.py b/youtube_dl/extractor/motherless.py\n--- a/youtube_dl/extractor/motherless.py\n+++ b/youtube_dl/extractor/motherless.py\n@@ -11,14 +11,14 @@\n \n \n class MotherlessIE(InfoExtractor):\n-    _VALID_URL = r'http://(?:www\\.)?motherless\\.com/(?P<id>[A-Z0-9]+)'\n+    _VALID_URL = r'http://(?:www\\.)?motherless\\.com/(?:g/[a-z0-9_]+/)?(?P<id>[A-Z0-9]+)'\n     _TESTS = [\n         {\n             'url': 'http://motherless.com/AC3FFE1',\n-            'md5': '5527fef81d2e529215dad3c2d744a7d9',\n+            'md5': '310f62e325a9fafe64f68c0bccb6e75f',\n             'info_dict': {\n                 'id': 'AC3FFE1',\n-                'ext': 'flv',\n+                'ext': 'mp4',\n                 'title': 'Fucked in the ass while playing PS3',\n                 'categories': ['Gaming', 'anal', 'reluctant', 'rough', 'Wife'],\n                 'upload_date': '20100913',\n@@ -40,6 +40,20 @@\n                 'thumbnail': 're:http://.*\\.jpg',\n                 'age_limit': 18,\n             }\n+        },\n+        {\n+            'url': 'http://motherless.com/g/cosplay/633979F',\n+            'md5': '0b2a43f447a49c3e649c93ad1fafa4a0',\n+            'info_dict': {\n+                'id': '633979F',\n+                'ext': 'mp4',\n+                'title': 'Turtlette',\n+                'categories': ['superheroine heroine  superher'],\n+                'upload_date': '20140827',\n+                'uploader_id': 'shade0230',\n+                'thumbnail': 're:http://.*\\.jpg',\n+                'age_limit': 18,\n+            }\n         }\n     ]\n", "issue": "motherless extractor - test 0 fails\n```\n$ python ~/projects/youtube-dl/test/test_download.py TestDownload.test_Motherless\n[Motherless] AC3FFE1: Downloading webpage\n[info] Writing video description metadata as JSON to: AC3FFE1.info.json\n[debug] Invoking downloader on 'http://s17.motherlessmedia.com/dev386/0/572/287/0572287847.mp4/5cb6d38eccba71d7f6bb2ef260997c3d/544A96C0.mp4'\n[download] Destination: AC3FFE1.mp4\n[download] 100% of 10.00KiB in 00:00\nF\n======================================================================\nFAIL: test_Motherless (__main__.TestDownload)\n----------------------------------------------------------------------\nTraceback (most recent call last):\nFile \"/home/crabman/projects/youtube-dl/test/test_download.py\", line 170, in test_template\n    self.assertTrue(os.path.exists(tc_filename), msg='Missing file ' + tc_filename)\nAssertionError: False is not true : Missing file AC3FFE1.flv\n\n----------------------------------------------------------------------\nRan 1 test in 1.690s\n\nFAILED (failures=1)\n```\n\nApparently that video's page no longer give you flv, but instead gives you mp4 file. I am not sure why it happened. Maybe motherless doesn't serve flv files anymore, maybe it still does for some videos - I don't know.\n\n", "before_files": [{"content": "from __future__ import unicode_literals\n\nimport datetime\nimport re\n\nfrom .common import InfoExtractor\nfrom ..utils import (\n    int_or_none,\n    unified_strdate,\n)\n\n\nclass MotherlessIE(InfoExtractor):\n    _VALID_URL = r'http://(?:www\\.)?motherless\\.com/(?P<id>[A-Z0-9]+)'\n    _TESTS = [\n        {\n            'url': 'http://motherless.com/AC3FFE1',\n            'md5': '5527fef81d2e529215dad3c2d744a7d9',\n            'info_dict': {\n                'id': 'AC3FFE1',\n                'ext': 'flv',\n                'title': 'Fucked in the ass while playing PS3',\n                'categories': ['Gaming', 'anal', 'reluctant', 'rough', 'Wife'],\n                'upload_date': '20100913',\n                'uploader_id': 'famouslyfuckedup',\n                'thumbnail': 're:http://.*\\.jpg',\n                'age_limit': 18,\n            }\n        },\n        {\n            'url': 'http://motherless.com/532291B',\n            'md5': 'bc59a6b47d1f958e61fbd38a4d31b131',\n            'info_dict': {\n                'id': '532291B',\n                'ext': 'mp4',\n                'title': 'Amazing girl playing the omegle game, PERFECT!',\n                'categories': ['Amateur', 'webcam', 'omegle', 'pink', 'young', 'masturbate', 'teen', 'game', 'hairy'],\n                'upload_date': '20140622',\n                'uploader_id': 'Sulivana7x',\n                'thumbnail': 're:http://.*\\.jpg',\n                'age_limit': 18,\n            }\n        }\n    ]\n\n    def _real_extract(self,url):\n        mobj = re.match(self._VALID_URL, url)\n        video_id = mobj.group('id')\n\n        webpage = self._download_webpage(url, video_id)\n\n        title = self._html_search_regex(r'id=\"view-upload-title\">\\s+([^<]+)<', webpage, 'title')\n        \n        video_url = self._html_search_regex(r'setup\\(\\{\\s+\"file\".+: \"([^\"]+)\",', webpage, 'video_url')\n        age_limit = self._rta_search(webpage)\n\n        view_count = self._html_search_regex(r'<strong>Views</strong>\\s+([^<]+)<', webpage, 'view_count')\n \n        upload_date = self._html_search_regex(r'<strong>Uploaded</strong>\\s+([^<]+)<', webpage, 'upload_date')\n        if 'Ago' in upload_date:\n            days = int(re.search(r'([0-9]+)', upload_date).group(1))\n            upload_date = (datetime.datetime.now() - datetime.timedelta(days=days)).strftime('%Y%m%d')\n        else:\n            upload_date = unified_strdate(upload_date)\n\n        like_count = self._html_search_regex(r'<strong>Favorited</strong>\\s+([^<]+)<', webpage, 'like_count')\n\n        comment_count = webpage.count('class=\"media-comment-contents\"')\n        uploader_id = self._html_search_regex(r'\"thumb-member-username\">\\s+<a href=\"/m/([^\"]+)\"', webpage, 'uploader_id')\n\n        categories = self._html_search_meta('keywords', webpage)\n        if categories:\n            categories = [cat.strip() for cat in categories.split(',')]\n\n        return {\n            'id': video_id,\n            'title': title,\n            'upload_date': upload_date,\n            'uploader_id': uploader_id,\n            'thumbnail': self._og_search_thumbnail(webpage),\n            'categories': categories,\n            'view_count': int_or_none(view_count.replace(',', '')),\n            'like_count': int_or_none(like_count.replace(',', '')),\n            'comment_count': comment_count,\n            'age_limit': age_limit,\n            'url': video_url,\n        }\n", "path": "youtube_dl/extractor/motherless.py"}]}