d60/twikit

**使用这个库登录是不是需要加入国外代理ip

Closed this issue · 7 comments

我发现我在**通过这个库登录推特会出现ssl链接失败等问题,这个问题是不是需要加入一个海外代理ip才能解决。能不能给予我一些建议来解决这个问题,感谢!

d60 commented

@hxbylishenfan
根据调查,由于**的防火长城进行的审查,**国内禁止访问Twitter。不过,通过使用海外代理 ,可能可以实现访问。

要在twikit中使用代理,可以按照以下示例进行操作:

client = twikit.Client(proxy='http://0.0.0.0:0000')

此外,如果在登录时出现任何错误信息,请将该错误信息显示给我。

由于我使用的是ChatGPT编写此消息,如果有任何错误,请见谅。

好的万分感谢,我现在就去买一个海外代理试一下。感谢!

sure,i can logged in browser normally.but i suspect it is an issue with overseas agants

Traceback (most recent call last):
File "D:\Python3.12\Lib\site-packages\httpx_transports\default.py", line 69, in map_httpcore_exceptions
yield
File "D:\Python3.12\Lib\site-packages\httpx_transports\default.py", line 233, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python3.12\Lib\site-packages\httpcore_sync\connection_pool.py", line 216, in handle_request
raise exc from None
File "D:\Python3.12\Lib\site-packages\httpcore_sync\connection_pool.py", line 196, in handle_request
response = connection.handle_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python3.12\Lib\site-packages\httpcore_sync\http_proxy.py", line 298, in handle_request
raise ProxyError(msg)
httpcore.ProxyError: 403 Forbidden

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "D:\python_progress\outer_pack\reptile\tuite_get_post_data\test_0.py", line 43, in
test(i['ip'], i['port'])
File "D:\python_progress\outer_pack\reptile\tuite_get_post_data\test_0.py", line 19, in test
client.login(
File "D:\Python3.12\Lib\site-packages\twikit\client.py", line 363, in login
guest_token = self._get_guest_token()
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python3.12\Lib\site-packages\twikit\client.py", line 235, in _get_guest_token
response, _ = self.post(
^^^^^^^^^^
File "D:\Python3.12\Lib\site-packages\twikit\client.py", line 170, in post
return self.request('POST', url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python3.12\Lib\site-packages\twikit\client.py", line 109, in request
response = self.http.request(method, url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python3.12\Lib\site-packages\httpx_client.py", line 827, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python3.12\Lib\site-packages\httpx_client.py", line 914, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python3.12\Lib\site-packages\httpx_client.py", line 942, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python3.12\Lib\site-packages\httpx_client.py", line 979, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python3.12\Lib\site-packages\httpx_client.py", line 1015, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python3.12\Lib\site-packages\httpx_transports\default.py", line 232, in handle_request
with map_httpcore_exceptions():
File "D:\Python3.12\Lib\contextlib.py", line 158, in exit
self.gen.throw(typ, value, traceback)
File "D:\Python3.12\Lib\site-packages\httpx_transports\default.py", line 86, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ProxyError: 403 Forbidden

this is error message

Most proxy for bypassing GFW are not using traditional protocols like http(s) and socks5, you have to use special client software like Clash to establish connection with proxy and use the http(s) or socks5 local server it provides in your program.

应该是你代理配错了,可以把关键代码贴一下。