prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Startpage parser breaks on Spanish date format
  To reproduce, follow these steps:
  
  1. open searx.info (or another instance)
  
  2. search for a spanish term, eg "madrid tiempo ahora"
  
  This results in an error like the following:
  ```
  Los motores no pueden obtener resultados: (english: engines cant obtain results)
  
  startpage (unexpected crash: ('Unknown string format:', '22 Ene 2020'))
  ```
  
  </issue>
  <code>
  [start of searx/engines/startpage.py]
  1 #  Startpage (Web)
  2 #
  3 # @website     https://startpage.com
  4 # @provide-api no (nothing found)
  5 #
  6 # @using-api   no
  7 # @results     HTML
  8 # @stable      no (HTML can change)
  9 # @parse       url, title, content
  10 #
  11 # @todo        paging
  12 
  13 from lxml import html
  14 from dateutil import parser
  15 from datetime import datetime, timedelta
  16 import re
  17 from searx.engines.xpath import extract_text
  18 from searx.languages import language_codes
  19 from searx.utils import eval_xpath
  20 
  21 # engine dependent config
  22 categories = ['general']
  23 # there is a mechanism to block "bot" search
  24 # (probably the parameter qid), require
  25 # storing of qid's between mulitble search-calls
  26 
  27 paging = True
  28 language_support = True
  29 
  30 # search-url
  31 base_url = 'https://startpage.com/'
  32 search_url = base_url + 'do/search'
  33 
  34 # specific xpath variables
  35 # ads xpath //div[@id="results"]/div[@id="sponsored"]//div[@class="result"]
  36 # not ads: div[@class="result"] are the direct childs of div[@id="results"]
  37 results_xpath = '//div[@class="w-gl__result"]'
  38 link_xpath = './/a[@class="w-gl__result-title"]'
  39 content_xpath = './/p[@class="w-gl__description"]'
  40 
  41 
  42 # do search-request
  43 def request(query, params):
  44 
  45     params['url'] = search_url
  46     params['method'] = 'POST'
  47     params['data'] = {
  48         'query': query,
  49         'page': params['pageno'],
  50         'cat': 'web',
  51         'cmd': 'process_search',
  52         'engine0': 'v1all',
  53     }
  54 
  55     # set language if specified
  56     if params['language'] != 'all':
  57         language = 'english'
  58         for lc, _, _, lang in language_codes:
  59             if lc == params['language']:
  60                 language = lang
  61         params['data']['language'] = language
  62         params['data']['lui'] = language
  63 
  64     return params
  65 
  66 
  67 # get response from search-request
  68 def response(resp):
  69     results = []
  70 
  71     dom = html.fromstring(resp.text)
  72 
  73     # parse results
  74     for result in eval_xpath(dom, results_xpath):
  75         links = eval_xpath(result, link_xpath)
  76         if not links:
  77             continue
  78         link = links[0]
  79         url = link.attrib.get('href')
  80 
  81         # block google-ad url's
  82         if re.match(r"^http(s|)://(www\.)?google\.[a-z]+/aclk.*$", url):
  83             continue
  84 
  85         # block startpage search url's
  86         if re.match(r"^http(s|)://(www\.)?startpage\.com/do/search\?.*$", url):
  87             continue
  88 
  89         title = extract_text(link)
  90 
  91         if eval_xpath(result, content_xpath):
  92             content = extract_text(eval_xpath(result, content_xpath))
  93         else:
  94             content = ''
  95 
  96         published_date = None
  97 
  98         # check if search result starts with something like: "2 Sep 2014 ... "
  99         if re.match(r"^([1-9]|[1-2][0-9]|3[0-1]) [A-Z][a-z]{2} [0-9]{4} \.\.\. ", content):
  100             date_pos = content.find('...') + 4
  101             date_string = content[0:date_pos - 5]
  102             published_date = parser.parse(date_string, dayfirst=True)
  103 
  104             # fix content string
  105             content = content[date_pos:]
  106 
  107         # check if search result starts with something like: "5 days ago ... "
  108         elif re.match(r"^[0-9]+ days? ago \.\.\. ", content):
  109             date_pos = content.find('...') + 4
  110             date_string = content[0:date_pos - 5]
  111 
  112             # calculate datetime
  113             published_date = datetime.now() - timedelta(days=int(re.match(r'\d+', date_string).group()))
  114 
  115             # fix content string
  116             content = content[date_pos:]
  117 
  118         if published_date:
  119             # append result
  120             results.append({'url': url,
  121                             'title': title,
  122                             'content': content,
  123                             'publishedDate': published_date})
  124         else:
  125             # append result
  126             results.append({'url': url,
  127                             'title': title,
  128                             'content': content})
  129 
  130     # return results
  131     return results
  132
  [end of searx/engines/startpage.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/searx/engines/startpage.py b/searx/engines/startpage.py
  --- a/searx/engines/startpage.py
  +++ b/searx/engines/startpage.py
  @@ -99,11 +99,14 @@
           if re.match(r"^([1-9]|[1-2][0-9]|3[0-1]) [A-Z][a-z]{2} [0-9]{4} \.\.\. ", content):
               date_pos = content.find('...') + 4
               date_string = content[0:date_pos - 5]
  -            published_date = parser.parse(date_string, dayfirst=True)
  -
               # fix content string
               content = content[date_pos:]
   
  +            try:
  +                published_date = parser.parse(date_string, dayfirst=True)
  +            except ValueError:
  +                pass
  +
           # check if search result starts with something like: "5 days ago ... "
           elif re.match(r"^[0-9]+ days? ago \.\.\. ", content):
               date_pos = content.find('...') + 4
  
verification_info: {"golden_diff": "diff --git a/searx/engines/startpage.py b/searx/engines/startpage.py\n--- a/searx/engines/startpage.py\n+++ b/searx/engines/startpage.py\n@@ -99,11 +99,14 @@\n         if re.match(r\"^([1-9]|[1-2][0-9]|3[0-1]) [A-Z][a-z]{2} [0-9]{4} \\.\\.\\. \", content):\n             date_pos = content.find('...') + 4\n             date_string = content[0:date_pos - 5]\n-            published_date = parser.parse(date_string, dayfirst=True)\n-\n             # fix content string\n             content = content[date_pos:]\n \n+            try:\n+                published_date = parser.parse(date_string, dayfirst=True)\n+            except ValueError:\n+                pass\n+\n         # check if search result starts with something like: \"5 days ago ... \"\n         elif re.match(r\"^[0-9]+ days? ago \\.\\.\\. \", content):\n             date_pos = content.find('...') + 4\n", "issue": "Startpage parser breaks on Spanish date format\nTo reproduce, follow these steps:\r\n\r\n1. open searx.info (or another instance)\r\n\r\n2. search for a spanish term, eg \"madrid tiempo ahora\"\r\n\r\nThis results in an error like the following:\r\n```\r\nLos motores no pueden obtener resultados: (english: engines cant obtain results)\r\n\r\nstartpage (unexpected crash: ('Unknown string format:', '22 Ene 2020'))\r\n```\n", "before_files": [{"content": "#  Startpage (Web)\n#\n# @website     https://startpage.com\n# @provide-api no (nothing found)\n#\n# @using-api   no\n# @results     HTML\n# @stable      no (HTML can change)\n# @parse       url, title, content\n#\n# @todo        paging\n\nfrom lxml import html\nfrom dateutil import parser\nfrom datetime import datetime, timedelta\nimport re\nfrom searx.engines.xpath import extract_text\nfrom searx.languages import language_codes\nfrom searx.utils import eval_xpath\n\n# engine dependent config\ncategories = ['general']\n# there is a mechanism to block \"bot\" search\n# (probably the parameter qid), require\n# storing of qid's between mulitble search-calls\n\npaging = True\nlanguage_support = True\n\n# search-url\nbase_url = 'https://startpage.com/'\nsearch_url = base_url + 'do/search'\n\n# specific xpath variables\n# ads xpath //div[@id=\"results\"]/div[@id=\"sponsored\"]//div[@class=\"result\"]\n# not ads: div[@class=\"result\"] are the direct childs of div[@id=\"results\"]\nresults_xpath = '//div[@class=\"w-gl__result\"]'\nlink_xpath = './/a[@class=\"w-gl__result-title\"]'\ncontent_xpath = './/p[@class=\"w-gl__description\"]'\n\n\n# do search-request\ndef request(query, params):\n\n    params['url'] = search_url\n    params['method'] = 'POST'\n    params['data'] = {\n        'query': query,\n        'page': params['pageno'],\n        'cat': 'web',\n        'cmd': 'process_search',\n        'engine0': 'v1all',\n    }\n\n    # set language if specified\n    if params['language'] != 'all':\n        language = 'english'\n        for lc, _, _, lang in language_codes:\n            if lc == params['language']:\n                language = lang\n        params['data']['language'] = language\n        params['data']['lui'] = language\n\n    return params\n\n\n# get response from search-request\ndef response(resp):\n    results = []\n\n    dom = html.fromstring(resp.text)\n\n    # parse results\n    for result in eval_xpath(dom, results_xpath):\n        links = eval_xpath(result, link_xpath)\n        if not links:\n            continue\n        link = links[0]\n        url = link.attrib.get('href')\n\n        # block google-ad url's\n        if re.match(r\"^http(s|)://(www\\.)?google\\.[a-z]+/aclk.*$\", url):\n            continue\n\n        # block startpage search url's\n        if re.match(r\"^http(s|)://(www\\.)?startpage\\.com/do/search\\?.*$\", url):\n            continue\n\n        title = extract_text(link)\n\n        if eval_xpath(result, content_xpath):\n            content = extract_text(eval_xpath(result, content_xpath))\n        else:\n            content = ''\n\n        published_date = None\n\n        # check if search result starts with something like: \"2 Sep 2014 ... \"\n        if re.match(r\"^([1-9]|[1-2][0-9]|3[0-1]) [A-Z][a-z]{2} [0-9]{4} \\.\\.\\. \", content):\n            date_pos = content.find('...') + 4\n            date_string = content[0:date_pos - 5]\n            published_date = parser.parse(date_string, dayfirst=True)\n\n            # fix content string\n            content = content[date_pos:]\n\n        # check if search result starts with something like: \"5 days ago ... \"\n        elif re.match(r\"^[0-9]+ days? ago \\.\\.\\. \", content):\n            date_pos = content.find('...') + 4\n            date_string = content[0:date_pos - 5]\n\n            # calculate datetime\n            published_date = datetime.now() - timedelta(days=int(re.match(r'\\d+', date_string).group()))\n\n            # fix content string\n            content = content[date_pos:]\n\n        if published_date:\n            # append result\n            results.append({'url': url,\n                            'title': title,\n                            'content': content,\n                            'publishedDate': published_date})\n        else:\n            # append result\n            results.append({'url': url,\n                            'title': title,\n                            'content': content})\n\n    # return results\n    return results\n", "path": "searx/engines/startpage.py"}]}