Skip to content

Instantly share code, notes, and snippets.

@isaackogan
Last active July 21, 2022 04:53
Show Gist options
  • Save isaackogan/c8c8db53a4a27e719fcffe2f38c26f92 to your computer and use it in GitHub Desktop.
Save isaackogan/c8c8db53a4a27e719fcffe2f38c26f92 to your computer and use it in GitHub Desktop.
Temporary fix to TikTokLive by providing authentication details
from TikTokLive import TikTokLiveClient
from TikTokLive.types.events import ConnectEvent, CommentEvent
sessionid = "SESSION_ID_HERE"
sid_guard = "SID_GUARD_HERE"
client = TikTokLiveClient("@PERSON_YOU_WANT_TO_WATCH", **{
"headers": {
"Cookie": f"sessionid={sessionid}; sid_guard={sid_guard};"
}
})
@client.on("connect")
async def on_connect(_: ConnectEvent):
print("Connected to Room ID:", client.room_id)
@client.on("comment")
async def on_comment(event: CommentEvent):
print(f"{event.user.nickname} -> {event.comment}")
if __name__ == '__main__':
client.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment