Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with retrieving room_id #18

Closed
marione44 opened this issue Mar 29, 2022 · 1 comment
Closed

Issue with retrieving room_id #18

marione44 opened this issue Mar 29, 2022 · 1 comment

Comments

@marione44
Copy link

marione44 commented Mar 29, 2022

Describe the bug
When i launch the script it raise an raise Exception("User might be offline" if valid_response else "Your IP or country might be blocked by TikTok.") Exception: Your IP or country might be blocked by TikTok.
This error happens in this line of code self.__room_id = get_room_id_from_main_page_html(html) that can be found in TikTokLive/utils.py.
I'm in italy and tiktok is not blocked i can watch live streams with no problem from smartphone or laptop.

Additional context
Is raised because inside the html variable (html: str = await self._http.get_livestream_page_html(self.__unique_id)) there isn't a room_id and that happens cause when get_livestream_page_html(unique_id) is called tiktok redirect to a login page to be authenticated.
It's not a real bug instead a lack of control, i guess. Last thing if i hardcode the room_id then the script work flawless.

Desktop (please complete the following information):

  • OS: Windows 10

Traceback:

ERROR:root:Traceback (most recent call last):
  File "C:\Users\mari\Desktop\ycharmProjects\tiktok\tiktok\lib\site-packages\TikTokLive\client\base.py", line 91, in __fetch_room_id
    self.__room_id = get_room_id_from_main_page_html(html)
  File "C:\Users\mari\Desktop\ycharmProjects\tiktok\tiktok\lib\site-packages\TikTokLive\utils.py", line 20, in get_room_id_from_main_page_html
    raise Exception("User might be offline" if valid_response else "Your IP or country might be blocked by TikTok.")
Exception: Your IP or country might be blocked by TikTok.

Failed to retrieve room id from page source
Traceback (most recent call last):
  File "C:\Users\mari\Desktop\ycharmProjects\tiktok\tiktok\lib\site-packages\TikTokLive\client\base.py", line 210, in _connect
    raise LiveNotFound()
TikTokLive.types.errors.LiveNotFound

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\mari\Desktop\ycharmProjects\tiktok\live.py", line 23, in <module>
    client.run()
  File "C:\Users\mari\Desktop\ycharmProjects\tiktok\tiktok\lib\site-packages\TikTokLive\client\base.py", line 285, in run
    self.loop.run_until_complete(self._connect())
  File "C:\Users\mari\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "C:\Users\mari\Desktop\ycharmProjects\tiktok\tiktok\lib\site-packages\TikTokLive\client\client.py", line 39, in _connect
    result: str = await super(TikTokLiveClient, self)._connect()
  File "C:\Users\mari\Desktop\ycharmProjects\tiktok\tiktok\lib\site-packages\TikTokLive\client\base.py", line 239, in _connect
    raise FailedConnection(message)
TikTokLive.types.errors.FailedConnection```
@isaackogan
Copy link
Owner

isaackogan commented Mar 29, 2022

You are blocked.

It does not matter that you are able to access it from mobile. TikTok is sending you a captcha for web-browser requests, like the one being made here. Use a proxy.

Isaac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants