prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Gigablast crash
  Greetings,
  
  I have been experimenting with SearX lately and have been seeing this message:
  
  "
  Engines cannot retrieve results:
  
  gigablast (unexpected crash: No JSON object could be decoded)
  "
  
  Seems like something is wrong with the Gigablast driver but I am not sure how to fix it.
  
  I'm using:  searx - 0.14.0 
  
  Thanks
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `searx/engines/gigablast.py`
  Content:
  ```
  1 """
  2  Gigablast (Web)
  3 
  4  @website     https://gigablast.com
  5  @provide-api yes (https://gigablast.com/api.html)
  6 
  7  @using-api   yes
  8  @results     XML
  9  @stable      yes
  10  @parse       url, title, content
  11 """
  12 
  13 import random
  14 from json import loads
  15 from time import time
  16 from lxml.html import fromstring
  17 from searx.url_utils import urlencode
  18 
  19 # engine dependent config
  20 categories = ['general']
  21 paging = True
  22 number_of_results = 10
  23 language_support = True
  24 safesearch = True
  25 
  26 # search-url
  27 base_url = 'https://gigablast.com/'
  28 search_string = 'search?{query}'\
  29     '&n={number_of_results}'\
  30     '&c=main'\
  31     '&s={offset}'\
  32     '&format=json'\
  33     '&qh=0'\
  34     '&qlang={lang}'\
  35     '&ff={safesearch}'\
  36     '&rxiec={rxieu}'\
  37     '&rand={rxikd}'  # current unix timestamp
  38 
  39 # specific xpath variables
  40 results_xpath = '//response//result'
  41 url_xpath = './/url'
  42 title_xpath = './/title'
  43 content_xpath = './/sum'
  44 
  45 supported_languages_url = 'https://gigablast.com/search?&rxikd=1'
  46 
  47 
  48 # do search-request
  49 def request(query, params):
  50     offset = (params['pageno'] - 1) * number_of_results
  51 
  52     language = params['language'].replace('-', '_').lower()
  53     if language.split('-')[0] != 'zh':
  54         language = language.split('-')[0]
  55 
  56     if params['safesearch'] >= 1:
  57         safesearch = 1
  58     else:
  59         safesearch = 0
  60 
  61     # rxieu is some kind of hash from the search query, but accepts random atm
  62     search_path = search_string.format(query=urlencode({'q': query}),
  63                                        offset=offset,
  64                                        number_of_results=number_of_results,
  65                                        rxikd=int(time() * 1000),
  66                                        rxieu=random.randint(1000000000, 9999999999),
  67                                        lang=language,
  68                                        safesearch=safesearch)
  69 
  70     params['url'] = base_url + search_path
  71 
  72     return params
  73 
  74 
  75 # get response from search-request
  76 def response(resp):
  77     results = []
  78 
  79     # parse results
  80     response_json = loads(resp.text)
  81 
  82     for result in response_json['results']:
  83         # append result
  84         results.append({'url': result['url'],
  85                         'title': result['title'],
  86                         'content': result['sum']})
  87 
  88     # return results
  89     return results
  90 
  91 
  92 # get supported languages from their site
  93 def _fetch_supported_languages(resp):
  94     supported_languages = []
  95     dom = fromstring(resp.text)
  96     links = dom.xpath('//span[@id="menu2"]/a')
  97     for link in links:
  98         href = link.xpath('./@href')[0].split('lang%3A')
  99         if len(href) == 2:
  100             code = href[1].split('_')
  101             if len(code) == 2:
  102                 code = code[0] + '-' + code[1].upper()
  103             else:
  104                 code = code[0]
  105             supported_languages.append(code)
  106 
  107     return supported_languages
  108
  ```
  --- 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/searx/engines/gigablast.py b/searx/engines/gigablast.py
  --- a/searx/engines/gigablast.py
  +++ b/searx/engines/gigablast.py
  @@ -34,6 +34,7 @@
       '&qlang={lang}'\
       '&ff={safesearch}'\
       '&rxiec={rxieu}'\
  +    '&ulse={ulse}'\
       '&rand={rxikd}'  # current unix timestamp
   
   # specific xpath variables
  @@ -64,6 +65,7 @@
                                          number_of_results=number_of_results,
                                          rxikd=int(time() * 1000),
                                          rxieu=random.randint(1000000000, 9999999999),
  +                                       ulse=random.randint(100000000, 999999999),
                                          lang=language,
                                          safesearch=safesearch)
  
verification_info: {"golden_diff": "diff --git a/searx/engines/gigablast.py b/searx/engines/gigablast.py\n--- a/searx/engines/gigablast.py\n+++ b/searx/engines/gigablast.py\n@@ -34,6 +34,7 @@\n     '&qlang={lang}'\\\n     '&ff={safesearch}'\\\n     '&rxiec={rxieu}'\\\n+    '&ulse={ulse}'\\\n     '&rand={rxikd}'  # current unix timestamp\n \n # specific xpath variables\n@@ -64,6 +65,7 @@\n                                        number_of_results=number_of_results,\n                                        rxikd=int(time() * 1000),\n                                        rxieu=random.randint(1000000000, 9999999999),\n+                                       ulse=random.randint(100000000, 999999999),\n                                        lang=language,\n                                        safesearch=safesearch)\n", "issue": "Gigablast crash\nGreetings,\r\n\r\nI have been experimenting with SearX lately and have been seeing this message:\r\n\r\n\"\r\nEngines cannot retrieve results:\r\n\r\ngigablast (unexpected crash: No JSON object could be decoded)\r\n\"\r\n\r\nSeems like something is wrong with the Gigablast driver but I am not sure how to fix it.\r\n\r\nI'm using:  searx - 0.14.0 \r\n\r\nThanks\n", "before_files": [{"content": "\"\"\"\n Gigablast (Web)\n\n @website     https://gigablast.com\n @provide-api yes (https://gigablast.com/api.html)\n\n @using-api   yes\n @results     XML\n @stable      yes\n @parse       url, title, content\n\"\"\"\n\nimport random\nfrom json import loads\nfrom time import time\nfrom lxml.html import fromstring\nfrom searx.url_utils import urlencode\n\n# engine dependent config\ncategories = ['general']\npaging = True\nnumber_of_results = 10\nlanguage_support = True\nsafesearch = True\n\n# search-url\nbase_url = 'https://gigablast.com/'\nsearch_string = 'search?{query}'\\\n    '&n={number_of_results}'\\\n    '&c=main'\\\n    '&s={offset}'\\\n    '&format=json'\\\n    '&qh=0'\\\n    '&qlang={lang}'\\\n    '&ff={safesearch}'\\\n    '&rxiec={rxieu}'\\\n    '&rand={rxikd}'  # current unix timestamp\n\n# specific xpath variables\nresults_xpath = '//response//result'\nurl_xpath = './/url'\ntitle_xpath = './/title'\ncontent_xpath = './/sum'\n\nsupported_languages_url = 'https://gigablast.com/search?&rxikd=1'\n\n\n# do search-request\ndef request(query, params):\n    offset = (params['pageno'] - 1) * number_of_results\n\n    language = params['language'].replace('-', '_').lower()\n    if language.split('-')[0] != 'zh':\n        language = language.split('-')[0]\n\n    if params['safesearch'] >= 1:\n        safesearch = 1\n    else:\n        safesearch = 0\n\n    # rxieu is some kind of hash from the search query, but accepts random atm\n    search_path = search_string.format(query=urlencode({'q': query}),\n                                       offset=offset,\n                                       number_of_results=number_of_results,\n                                       rxikd=int(time() * 1000),\n                                       rxieu=random.randint(1000000000, 9999999999),\n                                       lang=language,\n                                       safesearch=safesearch)\n\n    params['url'] = base_url + search_path\n\n    return params\n\n\n# get response from search-request\ndef response(resp):\n    results = []\n\n    # parse results\n    response_json = loads(resp.text)\n\n    for result in response_json['results']:\n        # append result\n        results.append({'url': result['url'],\n                        'title': result['title'],\n                        'content': result['sum']})\n\n    # return results\n    return results\n\n\n# get supported languages from their site\ndef _fetch_supported_languages(resp):\n    supported_languages = []\n    dom = fromstring(resp.text)\n    links = dom.xpath('//span[@id=\"menu2\"]/a')\n    for link in links:\n        href = link.xpath('./@href')[0].split('lang%3A')\n        if len(href) == 2:\n            code = href[1].split('_')\n            if len(code) == 2:\n                code = code[0] + '-' + code[1].upper()\n            else:\n                code = code[0]\n            supported_languages.append(code)\n\n    return supported_languages\n", "path": "searx/engines/gigablast.py"}], "after_files": [{"content": "\"\"\"\n Gigablast (Web)\n\n @website     https://gigablast.com\n @provide-api yes (https://gigablast.com/api.html)\n\n @using-api   yes\n @results     XML\n @stable      yes\n @parse       url, title, content\n\"\"\"\n\nimport random\nfrom json import loads\nfrom time import time\nfrom lxml.html import fromstring\nfrom searx.url_utils import urlencode\n\n# engine dependent config\ncategories = ['general']\npaging = True\nnumber_of_results = 10\nlanguage_support = True\nsafesearch = True\n\n# search-url\nbase_url = 'https://gigablast.com/'\nsearch_string = 'search?{query}'\\\n    '&n={number_of_results}'\\\n    '&c=main'\\\n    '&s={offset}'\\\n    '&format=json'\\\n    '&qh=0'\\\n    '&qlang={lang}'\\\n    '&ff={safesearch}'\\\n    '&rxiec={rxieu}'\\\n    '&ulse={ulse}'\\\n    '&rand={rxikd}'  # current unix timestamp\n\n# specific xpath variables\nresults_xpath = '//response//result'\nurl_xpath = './/url'\ntitle_xpath = './/title'\ncontent_xpath = './/sum'\n\nsupported_languages_url = 'https://gigablast.com/search?&rxikd=1'\n\n\n# do search-request\ndef request(query, params):\n    offset = (params['pageno'] - 1) * number_of_results\n\n    language = params['language'].replace('-', '_').lower()\n    if language.split('-')[0] != 'zh':\n        language = language.split('-')[0]\n\n    if params['safesearch'] >= 1:\n        safesearch = 1\n    else:\n        safesearch = 0\n\n    # rxieu is some kind of hash from the search query, but accepts random atm\n    search_path = search_string.format(query=urlencode({'q': query}),\n                                       offset=offset,\n                                       number_of_results=number_of_results,\n                                       rxikd=int(time() * 1000),\n                                       rxieu=random.randint(1000000000, 9999999999),\n                                       ulse=random.randint(100000000, 999999999),\n                                       lang=language,\n                                       safesearch=safesearch)\n\n    params['url'] = base_url + search_path\n\n    return params\n\n\n# get response from search-request\ndef response(resp):\n    results = []\n\n    # parse results\n    response_json = loads(resp.text)\n\n    for result in response_json['results']:\n        # append result\n        results.append({'url': result['url'],\n                        'title': result['title'],\n                        'content': result['sum']})\n\n    # return results\n    return results\n\n\n# get supported languages from their site\ndef _fetch_supported_languages(resp):\n    supported_languages = []\n    dom = fromstring(resp.text)\n    links = dom.xpath('//span[@id=\"menu2\"]/a')\n    for link in links:\n        href = link.xpath('./@href')[0].split('lang%3A')\n        if len(href) == 2:\n            code = href[1].split('_')\n            if len(code) == 2:\n                code = code[0] + '-' + code[1].upper()\n            else:\n                code = code[0]\n            supported_languages.append(code)\n\n    return supported_languages\n", "path": "searx/engines/gigablast.py"}]}