ZephrFish / GoogD0rk

41 stars 10 forks source link

errors? #4

Open sasholy opened 1 year ago

sasholy commented 1 year ago
ValueError: Invalid header value b'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36\n'
Exception in thread Thread-3278 (dorkthosethreads):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/kali/GoogD0rk/googd0rk.py", line 19, in dorkthosethreads
    result = googd0rk(query, user_agent)
  File "/home/kali/GoogD0rk/googd0rk.py", line 13, in googd0rk
    response = requests.get(url, headers=headers)
  File "/home/kali/.local/lib/python3.10/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "/home/kali/.local/lib/python3.10/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/kali/.local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/kali/.local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/home/kali/.local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
  File "/home/kali/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 665, in urlopen
    httplib_response = self._make_request(
  File "/home/kali/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 387, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.10/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1323, in _send_request
    self.putheader(hdr, value)
  File "/usr/lib/python3.10/http/client.py", line 1260, in putheader
    raise ValueError('Invalid header value %r' % (values[i],))
ValueError: Invalid header value b'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:59.0) Gecko/20100101 Firefox/59.0\n'

how to fix it? thx

rmrf-sl4sh commented 5 months ago

Tried using a venv, didn't work. Any possible information?

rmrf-sl4sh commented 5 months ago

Found a fix I think, you need to strip the user agents like this:

Line 11:

headers = {'User-Agent': user_agent.strip()}