deedy5 / duckduckgo_search

Search for words, documents, images, videos, news, maps and text translation using the DuckDuckGo.com search engine. Downloading files and images to a local hard drive.
MIT License
948 stars 117 forks source link

Colon plus an Asterix in search results causes an Error #2

Closed peterjschroeder closed 2 years ago

peterjschroeder commented 2 years ago

Adding a colon followed by an asterix to the search term causes an error.

    data = resp.json()["results"]
  File "/usr/local/lib/python3.9/dist-packages/requests/models.py", line 899, in json
    return complexjson.loads(
  File "/usr/local/lib/python3.9/dist-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.9/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.9/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
deedy5 commented 2 years ago

Please write all the function arguments that cause the error. Search syntax: https://help.duckduckgo.com/duckduckgo-help-pages/results/syntax/.

peterjschroeder commented 2 years ago

This will trigger it.

ddg("stuff -site:*.pinterest.com", region='us-en', safesearch='Off', time=None, max_results=30)

deedy5 commented 2 years ago

This is an invalid request, try entering it on the site: https://duckduckgo.com/?q=stuff+-site%3A*.pinterest.com&t=ffab&ia=web

peterjschroeder commented 2 years ago

Ah. You are right. I guess DuckDuckGo doesn't support that.