isaackogan / TikTokLive

Python library to receive live stream events (comments, gifts, etc.) in realtime from TikTok LIVE.
https://isaackogan.github.io/TikTokLive/
MIT License
897 stars 176 forks source link

An error was reported during use #151

Closed OceanTan closed 11 months ago

OceanTan commented 1 year ago

{'http': 'http://127.0.0.1:51146', 'https': 'https://127.0.0.1:51146'}

Traceback (most recent call last): File "D:\miniconda\lib\site-packages\TikTokLive\client\base.py", line 150, in _fetch_room_id html: str = await self.http.get_livestream_page_html(self.unique_id) File "D:\miniconda\lib\site-packages\TikTokLive\client\httpx.py", line 184, in get_livestream_page_html response: bytes = await self.httpx_get_bytes(f"{config.TIKTOK_URL_WEB}@{unique_id}/live") File "D:\miniconda\lib\site-packages\TikTokLive\client\httpx.py", line 98, in httpx_get_bytes async with httpx.AsyncClient(trust_env=self.trust_env, proxies=self.proxies, cookies=self.cookies, verify=self.ssl_context) as client: File "D:\miniconda\lib\site-packages\httpx_client.py", line 1408, in init self._mounts: typing.Dict[URLPattern, typing.Optional[AsyncBaseTransport]] = { File "D:\miniconda\lib\site-packages\httpx_client.py", line 1409, in URLPattern(key): None File "D:\miniconda\lib\site-packages\httpx_utils.py", line 401, in init__ raise ValueError( ValueError: Proxy keys should use proper URL forms rather than plain scheme strings. Instead of "http", use "http://"

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

Traceback (most recent call last): File "g:\tiktok\main.py", line 32, in client.run() File "D:\miniconda\lib\site-packages\TikTokLive\client\base.py", line 376, in run self.loop.run_until_complete(self._start()) # TODO this is the reason the event loop stops. run until complete runs until the future ends, see docs File "D:\miniconda\lib\asyncio\base_events.py", line 647, in run_until_complete return future.result() File "D:\miniconda\lib\site-packages\TikTokLive\client\base.py", line 352, in _start await self.start() File "D:\miniconda\lib\site-packages\TikTokLive\client\base.py", line 343, in start await self._connect() File "D:\miniconda\lib\site-packages\TikTokLive\client\base.py", line 283, in _connect await self._fetch_room_id() File "D:\miniconda\lib\site-packages\TikTokLive\client\base.py", line 155, in _fetch_room_id await self._on_error(ex, FailedFetchRoomInfo("Failed to fetch room id from Webcast, see stacktrace for more info.")) File "D:\miniconda\lib\site-packages\TikTokLive\client\client.py", line 68, in _on_error raise _exc File "D:\miniconda\lib\site-packages\TikTokLive\client\client.py", line 62, in _on_error raise append from original TikTokLive.types.errors.FailedFetchRoomInfo: Failed to fetch room id from Webcast, see stacktrace for more info.

OceanTan commented 1 year ago

I connected according to the usage in the documentation, but he reported an error. At first, I thought it was an agency problem, but after I added the agency, I still reported an error. Have you encountered this problem?

OceanTan commented 1 year ago

The problem has been solved. I set the proxy format. The error correction method is `python

proxies = { "http://":"http://127.0.0.1:51146", "https://":"http://127.0.0.1:51146" }

` But a new Error, Google. Protobuf. Message. DecodeError: Error parsing the message with the type 'TikTok. WebcastResponse' When I print logs, I find that the returned data is ('WebcastResponse', b'{"error":"Your IP is temporarily blocked"}').

Do you have this kind of problem? I can open it on my browser!

isaackogan commented 11 months ago

It seems that your IP is blocked haha. The error says it all. Use a better proxy.