isaackogan / TikTokLive

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

Can't get the live broadcast barrage, no return failure #34

Closed wingceltis-c closed 2 years ago

wingceltis-c commented 2 years ago

Describe the bug Running the examples/gifts.py can't get the live broadcast information,

Not sure if it has something to do with my network。

Has tiktok modified the protocol?

isaackogan commented 2 years ago

Can you clarify, what do you mean you cannot get the live broadcast information?

wingceltis-c commented 2 years ago

yes , can't get gifts 、like、join、comment information.

isaackogan commented 2 years ago

Really gonna need more. What do you mean you can't get gifts, like, join, comment information. Why. What's wrong. What code do you have. What errors are you getting.

wingceltis-c commented 2 years ago
  1. Modify the room id of TikTokLiveClient("@satisfyy.me")
  2. Run example/gitfs.py
  3. There has been no result output, someone sent a gift.

Are your results correct?

isaackogan commented 2 years ago

known

kevinyasuo commented 2 years ago

I also encountered this problem

isaackogan commented 2 years ago

yes everyone will encounter this

klssem commented 2 years ago

TikTok no longer allows access to the webcast service without authentication.

  1. You need to retrieve the session ID using developer mode on a web browser. ----- Developer Tools > Application tab > Cookies > Session ID
  2. Add the header request to the client connection: client: TikTokLiveClient = TikTokLiveClient( unique_id='userID', **( { "enable_extended_gift_info": True, "headers": { "Cookie": "sessionid=sessionID#;", } } ) )
isaackogan commented 2 years ago

It's not a great idea to force people authenticate. There is still a way to do it without login; we are working on it atm.

yehesmurf commented 2 years ago

TikTok no longer allows access to the webcast service without authentication.

  1. You need to retrieve the session ID using developer mode on a web browser. ----- Developer Tools > Application tab > Cookies > Session ID
  2. Add the header request to the client connection: client: TikTokLiveClient = TikTokLiveClient( unique_id='userID', **( { "enable_extended_gift_info": True, "headers": { "Cookie": "sessionid=sessionID#;", } } ) ) 1a i cannot find Session ID
klssem commented 2 years ago
  1. Open the browser
  2. Navigate to tiktok.com
  3. Login
  4. Look for the cookies
isaackogan commented 2 years ago

A fix is coming in the next few days. In the meanwhile, it is still possible to use the library with minor modifications.

Please view the tutorial here: https://www.youtube.com/watch?v=wjLerdxKgu0 You can also directly view the code here: https://gist.github.com/isaackogan/c8c8db53a4a27e719fcffe2f38c26f92

The following are the textual steps to fix your projects:

  1. Go to https://www.tiktok.com/
  2. Log into the website with your account
  3. Ensure cookies are enabled. If they are not, enable them and refresh the page
  4. Access the cookies tab by clicking the lock next to the search bar and going to "cookies"
  5. Copy the values of sessionid and sid_guard into the required area in https://gist.github.com/isaackogan/c8c8db53a4a27e719fcffe2f38c26f92

What does this do? It bypasses TikTok's new security by logging you in to your account. While it is 99% likely you will not be banned for this, make a throwaway account for it just in case. TikTok can tell you are scraping, they are just choosing to let you because you are logged in.

On that note, I've been working on the fix for about 14 hours now, so, I'm going to go to bed.

Regards, Isaac

isaackogan commented 2 years ago

Fixed in the new release: https://github.com/isaackogan/TikTokLive/releases/tag/v4.2.5