Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

add peertube engine #2109

Merged
merged 5 commits into from Aug 8, 2020
Merged

add peertube engine #2109

merged 5 commits into from Aug 8, 2020

Conversation

mikeri
Copy link
Contributor

@mikeri mikeri commented Jul 31, 2020

What does this PR do?

Adds a peertube engine

Why is this change important?

This will let users search for videos on peertube

How to test this PR locally?

Perform a video search

@kvch
Copy link
Member

kvch commented Aug 1, 2020

When I tested this engine I got the following error:

ERROR:searx.search:engine peertube : requests exception(search duration : 0.5958149433135986 s, timeout: 2.0 s): HTTPSConnectionPool(host='peertube.live', port=443): Max retries exceeded with url: /api/v1/search/videos/?pageno
=0&search=horse&languageOneOf=hu (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))
Traceback (most recent call last):
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 485, in wrap_socket
    cnx.do_handshake()
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1915, in do_handshake
    self._raise_ssl_error(self._ssl, result)
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1647, in _raise_ssl_error
    _raise_current_error()
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 376, in _make_request
    self._validate_conn(conn)
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn
    conn.connect()
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/connection.py", line 360, in connect
    ssl_context=context,
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/util/ssl_.py", line 370, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 491, in wrap_socket
    raise ssl.SSLError("bad handshake: %r" % e)
ssl.SSLError: ("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/urllib3/util/retry.py", line 436, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='peertube.live', port=443): Max retries exceeded with url: /api/v1/search/videos/?pageno=0&search=horse&languageOneOf=hu (Caused by SSLError(SSLError("bad handshake: E
rror([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/n/p/searx/searx/search.py", line 160, in search_one_http_request_safe
    search_results = search_one_http_request(engine, query, request_params)
  File "/home/n/p/searx/searx/search.py", line 97, in search_one_http_request
    response = send_http_request(engine, request_params)
  File "/home/n/p/searx/searx/search.py", line 81, in send_http_request
    return req(request_params['url'], **request_args)
  File "/home/n/p/searx/searx/poolrequests.py", line 133, in get
    return request('get', url, **kwargs)
  File "/home/n/p/searx/searx/poolrequests.py", line 109, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/home/n/p/searx/venv3.6/lib/python3.6/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='peertube.live', port=443): Max retries exceeded with url: /api/v1/search/videos/?pageno=0&search=horse&languageOneOf=hu (Caused by SSLError(SSLError("bad handshake: Error
([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

It seems that the service does not provide a proper HTTPS connection. Do you mind changing the base_url? Also, could you please set it to be disabled by default?

@mikeri
Copy link
Contributor Author

mikeri commented Aug 1, 2020

Indeed, the peertube.live certificate expired on August 1st, after I pushed the commit. Hence the issue is related to that specific peertube instance, not to the engine. I've changed the default base_url to peer.tube (although I have the impression peertube.live is usually a better/faster instance) and disabled the peertube engine in settings.yml.

@kvch kvch merged commit a1ce141 into searx:master Aug 8, 2020
@kvch
Copy link
Member

kvch commented Aug 8, 2020

Thank you!

mikeri added a commit to mikeri/searx that referenced this pull request Mar 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants