zerodytrash / TikTok-Live-Connector

Node.js library to receive live stream events (comments, gifts, etc.) in realtime from TikTok LIVE.
https://discord.gg/2c6kX6g3Pa
MIT License
1.2k stars 259 forks source link

Failed to retrieve room_id from page source. Your IP or country might be blocked by TikTok. #67

Open iProGamer opened 1 year ago

iProGamer commented 1 year ago

Even tiktok is not blocked in my country why?

zerodytrash commented 1 year ago

Can you access e.g. https://www.tiktok.com/@domehathunger/live in your browser? If yes, something is wrong with the library or your code. In this case please provide your code.

iProGamer commented 1 year ago

Can you access e.g. https://www.tiktok.com/@domehathunger/live in your browser? If yes, something is wrong with the library or your code. In this case please provide your code.

Country: Italy I can access live from browser. This my code:

let ttConnection
let ttEvents = ['connected', 'disconnected', 'streamEnd', 'error', 'member', 'chat', 'gift', 'like', 'follow', 'share']
function connect(username){
    if (ttConnection != undefined && ttConnection.getState().isConnected){
        ttConnection.disconnect()
    }
    ttConnection = new WebcastPushConnection(username, {processInitialData: false})
    ttConnection.connect().then(state => {

    }).catch(err => {
        console.log(err)
    })
    ttEvents.forEach(e => {
        ttConnection.on(e, data => {
            if (data != undefined){
                data.event = e
                wss.broadcast(JSON.stringify(data))
            }
        })
    })
}
iProGamer commented 1 year ago

problem from my code or library?

iProGamer commented 1 year ago

so I just checked when access any live from my browser its included "og-url" and "roomId" but in tiktok-live-connector its not getting any of that!

iProGamer commented 1 year ago

and that is whats causing the error

iProGamer commented 1 year ago

its redirecting to the login page

iProGamer commented 1 year ago

its redirecting me to login page, is there any alternative solution for this?

Giampy1 commented 1 year ago

so I just checked when access any live from my browser its included "og-url" and "roomId" but in tiktok-live-connector its not getting any of that!

Hello, I'm also Italian, try to use a proxy connected to a country outside of Italy, it should work.

cesar-ioc commented 1 year ago

I´m also getting "Your IP or country might be blocked by TikTok", but I can watch lives in the browser so I don't think it is actually blocked. Something must have changed on TikTok side since yesterday the exact same code worked fine but today I´m seeing that error. The problem seems to be with the JS library only, the Python library works fine.

iProGamer commented 1 year ago

yes try go incognito mode and open any live in tiktok you will see it will redirect you to login the page and that is exactly the problem, because the library is entering the live to get room id but its redirecting to login

zerodytrash commented 1 year ago

can confirm, TikTok redirects to https://www.tiktok.com/login?redirect_url=https%3A%2F%2Fwww.tiktok.com%2F%40ninogashi%2Flive&lang=en&enter_method=mandatory I tried it over IPs from several countries and it only occurs from Italy. Adding a SessionID should fix the problem.

ghostmaster75 commented 1 year ago

I have the same problem with the C# library, always connecting from Italy. Has anyone found a solution in any way?

bakteribaik commented 11 months ago

can confirm, TikTok redirects to https://www.tiktok.com/login?redirect_url=https%3A%2F%2Fwww.tiktok.com%2F%40ninogashi%2Flive&lang=en&enter_method=mandatory I tried it over IPs from several countries and it only occurs from Italy. Adding a SessionID should fix the problem.

so i've add SessionID and working fine for a while, but after less or more than 10 minutes, the error just comback Error: Failed to retrieve room_id from page source. Your IP or country might be blocked by TikTok.

stevenjr1988 commented 11 months ago

Could this issue be caused because "tiktok.eulerstream.com" is rate limiting? And some reason "error code 429 - SignatureRateLimitReachedException" is not being given or displayed? While in development, I do need to restart the app multiple times. I noticed after X amount of times, this error shows up for X length of time.

as mentioned on https://github.com/isaackogan/TikTokLive/wiki/Signature-Server#what-rate-limits-exist

@zerodytrash @isaackogan

michelebissanti commented 8 months ago

I have the same problem with the C# library, always connecting from Italy. Has anyone found a solution in any way?

Also I am looking for a solution

ghostmaster75 commented 8 months ago

I have the same problem with the C# library, always connecting from Italy. Has anyone found a solution in any way?

Also I am looking for a solution

in Italy we cannot see TikTok live broadcasts without being logged in (due to age restrictions) and since TikTok does not provide a login service in its API to then "connect" to the live broadcasts you can't do anything other than go through a vpn that allows you to connect.

michelebissanti commented 8 months ago

I have the same problem with the C# library, always connecting from Italy. Has anyone found a solution in any way?

Also I am looking for a solution

in Italy we cannot see TikTok live broadcasts without being logged in (due to age restrictions) and since TikTok does not provide a login service in its API to then "connect" to the live broadcasts you can't do anything other than go through a vpn that allows you to connect.

Okay, thanks for the reply.

egunde commented 4 months ago

If anyone else is searching for this issue, I found a workaround for the C# library, which might work with the other libraries. All I did was add ClientSettings with SkipRoomInfo=true.

ClientSettings settings = new ClientSettings();
settings.SkipRoomInfo = true;

Console.WriteLine("Enter a username");
TikTokLiveClient client = new TikTokLiveClient(Console.ReadLine(), "", settings);