isaackogan / TikTokLive

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

Passing room_id to the start method returns error from the sign API #215

Open xerovue opened 1 month ago

xerovue commented 1 month ago

It seems that the room_id is not being set when it is passed to the start method and the sign API returns the following:

TikTokLive.client.web.routes.fetch_sign.SignAPIError: 

[SIGN_NOT_200] Failed request to Sign API with status code 401 and payload 

"b'{"code":401,"error":"Validation error","detail":{"room_id":{"message":"\'room_id\' is required"}}}'".

Here is the code:

import asyncio
from TikTokLive import TikTokLiveClient

client = TikTokLiveClient(unique_id="@los.versus")

async def main():
    await client.start(room_id="7357181668077833002")

if __name__ == "__main__":
    asyncio.run(main())

Package Version

v6.0.4

isaackogan commented 1 month ago

Interrestinggggg

diego-fmachado commented 1 month ago

Try instantiating the client this way: client = TikTokLiveClient(unique_id="@los.versus", web_kwargs={"params": {"room_id": "7357181668077833002"}}) Then, you can pass room_id to client.start() so it doesn't try to fetch it again.