prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Bakabt URL change
  Bakabt url has change from http://www.bakabt.com to https://bakabt.me, the url rewriter plugin needs to be updated to match
  
  </issue>
  <code>
  [start of flexget/plugins/sites/bakabt.py]
  1 from __future__ import unicode_literals, division, absolute_import
  2 from builtins import *  # noqa pylint: disable=unused-import, redefined-builtin
  3 
  4 import logging
  5 
  6 from flexget import plugin
  7 from flexget.event import event
  8 from flexget.plugins.internal.urlrewriting import UrlRewritingError
  9 from flexget.utils.soup import get_soup
  10 
  11 log = logging.getLogger('bakabt')
  12 
  13 
  14 class UrlRewriteBakaBT(object):
  15     """BakaBT urlrewriter."""
  16 
  17     # urlrewriter API
  18     def url_rewritable(self, task, entry):
  19         url = entry['url']
  20         if url.startswith('http://www.bakabt.com/download/'):
  21             return False
  22         if url.startswith('http://www.bakabt.com/') or url.startswith('http://bakabt.com/'):
  23             return True
  24         return False
  25 
  26     # urlrewriter API
  27     def url_rewrite(self, task, entry):
  28         entry['url'] = self.parse_download_page(entry['url'], task.requests)
  29 
  30     @plugin.internet(log)
  31     def parse_download_page(self, url, requests):
  32         txheaders = {'User-agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'}
  33         page = requests.get(url, headers=txheaders)
  34         try:
  35             soup = get_soup(page.text)
  36         except Exception as e:
  37             raise UrlRewritingError(e)
  38         tag_a = soup.find('a', attrs={'class': 'download_link'})
  39         if not tag_a:
  40             raise UrlRewritingError('Unable to locate download link from url %s' % url)
  41         torrent_url = 'http://www.bakabt.com' + tag_a.get('href')
  42         return torrent_url
  43 
  44 
  45 @event('plugin.register')
  46 def register_plugin():
  47     plugin.register(UrlRewriteBakaBT, 'bakabt', groups=['urlrewriter'], api_ver=2)
  48
  [end of flexget/plugins/sites/bakabt.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/flexget/plugins/sites/bakabt.py b/flexget/plugins/sites/bakabt.py
  --- a/flexget/plugins/sites/bakabt.py
  +++ b/flexget/plugins/sites/bakabt.py
  @@ -17,9 +17,9 @@
       # urlrewriter API
       def url_rewritable(self, task, entry):
           url = entry['url']
  -        if url.startswith('http://www.bakabt.com/download/'):
  +        if url.startswith('http://www.bakabt.me/download/'):
               return False
  -        if url.startswith('http://www.bakabt.com/') or url.startswith('http://bakabt.com/'):
  +        if url.startswith('http://www.bakabt.me/') or url.startswith('http://bakabt.me/'):
               return True
           return False
   
  @@ -38,7 +38,7 @@
           tag_a = soup.find('a', attrs={'class': 'download_link'})
           if not tag_a:
               raise UrlRewritingError('Unable to locate download link from url %s' % url)
  -        torrent_url = 'http://www.bakabt.com' + tag_a.get('href')
  +        torrent_url = 'http://www.bakabt.me' + tag_a.get('href')
           return torrent_url
  
verification_info: {"golden_diff": "diff --git a/flexget/plugins/sites/bakabt.py b/flexget/plugins/sites/bakabt.py\n--- a/flexget/plugins/sites/bakabt.py\n+++ b/flexget/plugins/sites/bakabt.py\n@@ -17,9 +17,9 @@\n     # urlrewriter API\n     def url_rewritable(self, task, entry):\n         url = entry['url']\n-        if url.startswith('http://www.bakabt.com/download/'):\n+        if url.startswith('http://www.bakabt.me/download/'):\n             return False\n-        if url.startswith('http://www.bakabt.com/') or url.startswith('http://bakabt.com/'):\n+        if url.startswith('http://www.bakabt.me/') or url.startswith('http://bakabt.me/'):\n             return True\n         return False\n \n@@ -38,7 +38,7 @@\n         tag_a = soup.find('a', attrs={'class': 'download_link'})\n         if not tag_a:\n             raise UrlRewritingError('Unable to locate download link from url %s' % url)\n-        torrent_url = 'http://www.bakabt.com' + tag_a.get('href')\n+        torrent_url = 'http://www.bakabt.me' + tag_a.get('href')\n         return torrent_url\n", "issue": "Bakabt URL change\nBakabt url has change from http://www.bakabt.com to https://bakabt.me, the url rewriter plugin needs to be updated to match\n", "before_files": [{"content": "from __future__ import unicode_literals, division, absolute_import\nfrom builtins import *  # noqa pylint: disable=unused-import, redefined-builtin\n\nimport logging\n\nfrom flexget import plugin\nfrom flexget.event import event\nfrom flexget.plugins.internal.urlrewriting import UrlRewritingError\nfrom flexget.utils.soup import get_soup\n\nlog = logging.getLogger('bakabt')\n\n\nclass UrlRewriteBakaBT(object):\n    \"\"\"BakaBT urlrewriter.\"\"\"\n\n    # urlrewriter API\n    def url_rewritable(self, task, entry):\n        url = entry['url']\n        if url.startswith('http://www.bakabt.com/download/'):\n            return False\n        if url.startswith('http://www.bakabt.com/') or url.startswith('http://bakabt.com/'):\n            return True\n        return False\n\n    # urlrewriter API\n    def url_rewrite(self, task, entry):\n        entry['url'] = self.parse_download_page(entry['url'], task.requests)\n\n    @plugin.internet(log)\n    def parse_download_page(self, url, requests):\n        txheaders = {'User-agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'}\n        page = requests.get(url, headers=txheaders)\n        try:\n            soup = get_soup(page.text)\n        except Exception as e:\n            raise UrlRewritingError(e)\n        tag_a = soup.find('a', attrs={'class': 'download_link'})\n        if not tag_a:\n            raise UrlRewritingError('Unable to locate download link from url %s' % url)\n        torrent_url = 'http://www.bakabt.com' + tag_a.get('href')\n        return torrent_url\n\n\n@event('plugin.register')\ndef register_plugin():\n    plugin.register(UrlRewriteBakaBT, 'bakabt', groups=['urlrewriter'], api_ver=2)\n", "path": "flexget/plugins/sites/bakabt.py"}]}