prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Google Images & DeviantArt don't work anymore
  From one day to another, Google Images and DeviantArt stopped to show me anything, even with simple searches.
  ![Screenshot_1](https://user-images.githubusercontent.com/48600424/63694426-f73ef200-c805-11e9-93a9-10124fb32b85.png)
  ![Screenshot_2](https://user-images.githubusercontent.com/48600424/63694427-f7d78880-c805-11e9-9e37-87042fba85a6.png)
  They are of course activated in the engines. It has been a few days, with a restart every day (local instance using Docker), without modifying engines nor any other setting. Using searx 0.15.0
  
  </issue>
  <code>
  [start of searx/engines/google_images.py]
  1 """
  2  Google (Images)
  3 
  4  @website     https://www.google.com
  5  @provide-api yes (https://developers.google.com/custom-search/)
  6 
  7  @using-api   no
  8  @results     HTML chunks with JSON inside
  9  @stable      no
  10  @parse       url, title, img_src
  11 """
  12 
  13 from datetime import date, timedelta
  14 from json import loads
  15 from lxml import html
  16 from searx.url_utils import urlencode
  17 
  18 # engine dependent config
  19 categories = ['images']
  20 paging = True
  21 safesearch = True
  22 time_range_support = True
  23 number_of_results = 100
  24 
  25 search_url = 'https://www.google.com/search'\
  26     '?{query}'\
  27     '&tbm=isch'\
  28     '&yv=2'\
  29     '&{search_options}'
  30 time_range_attr = "qdr:{range}"
  31 time_range_custom_attr = "cdr:1,cd_min:{start},cd_max{end}"
  32 time_range_dict = {'day': 'd',
  33                    'week': 'w',
  34                    'month': 'm'}
  35 
  36 
  37 # do search-request
  38 def request(query, params):
  39     search_options = {
  40         'ijn': params['pageno'] - 1,
  41         'start': (params['pageno'] - 1) * number_of_results
  42     }
  43 
  44     if params['time_range'] in time_range_dict:
  45         search_options['tbs'] = time_range_attr.format(range=time_range_dict[params['time_range']])
  46     elif params['time_range'] == 'year':
  47         now = date.today()
  48         then = now - timedelta(days=365)
  49         start = then.strftime('%m/%d/%Y')
  50         end = now.strftime('%m/%d/%Y')
  51         search_options['tbs'] = time_range_custom_attr.format(start=start, end=end)
  52 
  53     if safesearch and params['safesearch']:
  54         search_options['safe'] = 'on'
  55 
  56     params['url'] = search_url.format(query=urlencode({'q': query}),
  57                                       search_options=urlencode(search_options))
  58 
  59     return params
  60 
  61 
  62 # get response from search-request
  63 def response(resp):
  64     results = []
  65 
  66     dom = html.fromstring(resp.text)
  67 
  68     # parse results
  69     for result in dom.xpath('//div[contains(@class, "rg_meta")]/text()'):
  70 
  71         try:
  72             metadata = loads(result)
  73             img_format = "{0} {1}x{2}".format(metadata['ity'], str(metadata['ow']), str(metadata['oh']))
  74             source = "{0} ({1})".format(metadata['st'], metadata['isu'])
  75             results.append({'url': metadata['ru'],
  76                             'title': metadata['pt'],
  77                             'content': metadata['s'],
  78                             'source': source,
  79                             'img_format': img_format,
  80                             'thumbnail_src': metadata['tu'],
  81                             'img_src': metadata['ou'],
  82                             'template': 'images.html'})
  83 
  84         except:
  85             continue
  86 
  87     return results
  88
  [end of searx/engines/google_images.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/google_images.py b/searx/engines/google_images.py
  --- a/searx/engines/google_images.py
  +++ b/searx/engines/google_images.py
  @@ -70,11 +70,21 @@
   
           try:
               metadata = loads(result)
  -            img_format = "{0} {1}x{2}".format(metadata['ity'], str(metadata['ow']), str(metadata['oh']))
  -            source = "{0} ({1})".format(metadata['st'], metadata['isu'])
  +
  +            img_format = metadata.get('ity', '')
  +            img_width = metadata.get('ow', '')
  +            img_height = metadata.get('oh', '')
  +            if img_width and img_height:
  +                img_format += " {0}x{1}".format(img_width, img_height)
  +
  +            source = metadata.get('st', '')
  +            source_url = metadata.get('isu', '')
  +            if source_url:
  +                source += " ({0})".format(source_url)
  +
               results.append({'url': metadata['ru'],
                               'title': metadata['pt'],
  -                            'content': metadata['s'],
  +                            'content': metadata.get('s', ''),
                               'source': source,
                               'img_format': img_format,
                               'thumbnail_src': metadata['tu'],
  
verification_info: {"golden_diff": "diff --git a/searx/engines/google_images.py b/searx/engines/google_images.py\n--- a/searx/engines/google_images.py\n+++ b/searx/engines/google_images.py\n@@ -70,11 +70,21 @@\n \n         try:\n             metadata = loads(result)\n-            img_format = \"{0} {1}x{2}\".format(metadata['ity'], str(metadata['ow']), str(metadata['oh']))\n-            source = \"{0} ({1})\".format(metadata['st'], metadata['isu'])\n+\n+            img_format = metadata.get('ity', '')\n+            img_width = metadata.get('ow', '')\n+            img_height = metadata.get('oh', '')\n+            if img_width and img_height:\n+                img_format += \" {0}x{1}\".format(img_width, img_height)\n+\n+            source = metadata.get('st', '')\n+            source_url = metadata.get('isu', '')\n+            if source_url:\n+                source += \" ({0})\".format(source_url)\n+\n             results.append({'url': metadata['ru'],\n                             'title': metadata['pt'],\n-                            'content': metadata['s'],\n+                            'content': metadata.get('s', ''),\n                             'source': source,\n                             'img_format': img_format,\n                             'thumbnail_src': metadata['tu'],\n", "issue": "Google Images & DeviantArt don't work anymore\nFrom one day to another, Google Images and DeviantArt stopped to show me anything, even with simple searches.\r\n![Screenshot_1](https://user-images.githubusercontent.com/48600424/63694426-f73ef200-c805-11e9-93a9-10124fb32b85.png)\r\n![Screenshot_2](https://user-images.githubusercontent.com/48600424/63694427-f7d78880-c805-11e9-9e37-87042fba85a6.png)\r\nThey are of course activated in the engines. It has been a few days, with a restart every day (local instance using Docker), without modifying engines nor any other setting. Using searx 0.15.0\n", "before_files": [{"content": "\"\"\"\n Google (Images)\n\n @website     https://www.google.com\n @provide-api yes (https://developers.google.com/custom-search/)\n\n @using-api   no\n @results     HTML chunks with JSON inside\n @stable      no\n @parse       url, title, img_src\n\"\"\"\n\nfrom datetime import date, timedelta\nfrom json import loads\nfrom lxml import html\nfrom searx.url_utils import urlencode\n\n# engine dependent config\ncategories = ['images']\npaging = True\nsafesearch = True\ntime_range_support = True\nnumber_of_results = 100\n\nsearch_url = 'https://www.google.com/search'\\\n    '?{query}'\\\n    '&tbm=isch'\\\n    '&yv=2'\\\n    '&{search_options}'\ntime_range_attr = \"qdr:{range}\"\ntime_range_custom_attr = \"cdr:1,cd_min:{start},cd_max{end}\"\ntime_range_dict = {'day': 'd',\n                   'week': 'w',\n                   'month': 'm'}\n\n\n# do search-request\ndef request(query, params):\n    search_options = {\n        'ijn': params['pageno'] - 1,\n        'start': (params['pageno'] - 1) * number_of_results\n    }\n\n    if params['time_range'] in time_range_dict:\n        search_options['tbs'] = time_range_attr.format(range=time_range_dict[params['time_range']])\n    elif params['time_range'] == 'year':\n        now = date.today()\n        then = now - timedelta(days=365)\n        start = then.strftime('%m/%d/%Y')\n        end = now.strftime('%m/%d/%Y')\n        search_options['tbs'] = time_range_custom_attr.format(start=start, end=end)\n\n    if safesearch and params['safesearch']:\n        search_options['safe'] = 'on'\n\n    params['url'] = search_url.format(query=urlencode({'q': query}),\n                                      search_options=urlencode(search_options))\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 dom.xpath('//div[contains(@class, \"rg_meta\")]/text()'):\n\n        try:\n            metadata = loads(result)\n            img_format = \"{0} {1}x{2}\".format(metadata['ity'], str(metadata['ow']), str(metadata['oh']))\n            source = \"{0} ({1})\".format(metadata['st'], metadata['isu'])\n            results.append({'url': metadata['ru'],\n                            'title': metadata['pt'],\n                            'content': metadata['s'],\n                            'source': source,\n                            'img_format': img_format,\n                            'thumbnail_src': metadata['tu'],\n                            'img_src': metadata['ou'],\n                            'template': 'images.html'})\n\n        except:\n            continue\n\n    return results\n", "path": "searx/engines/google_images.py"}]}