session id always invalid
liam8888999 opened this issue ยท 16 comments
session id always seems to be invalid/expired even when creating a new one
Hello. Could you try using https://api16-normal-useast5.us.tiktokv.com/media/api/text/speech/invoke
as customBaseUrl when running config()
const { config, createAudioFromText } = require('tiktok-tts')
async function yourFunction(){
config('888862717888888801771700808888888', 'https://api16-normal-useast5.us.tiktokv.com/media/api/text/speech/invoke');
createAudioFromText(newsFeedread, path.join(NEWSDIR, news-audio-${NEWSNUM}-tiktok.mp3
), 'en_us_stormtrooper');
}
await yourFunction();
error: Unhandled Rejection: Error: tiktok-tts Error: Your TikTok session id might be invalid or expired. Try getting a new one. status_code: 1
the session id has been replaced with all 8s for obvious reasons but even using that base address I am still getting the same error
Unfortunately, it seems like session IDs might be coupled to a specific region API URL. It can be tricky to get it, as it requires the usage of an emulator and software to intercept the request. However, here is a list of other URLs that you can try with:
https://api16-normal-c-useast1a.tiktokv.com/media/api/text/speech/invoke
https://api16-core-c-useast1a.tiktokv.com/media/api/text/speech/invoke
https://api16-normal-useast5.us.tiktokv.com/media/api/text/speech/invoke
https://api16-core.tiktokv.com/media/api/text/speech/invoke
https://api16-core-useast5.us.tiktokv.com/media/api/text/speech/invoke
https://api19-core-c-useast1a.tiktokv.com/media/api/text/speech/invoke
https://api-core.tiktokv.com/media/api/text/speech/invoke
https://api-normal.tiktokv.com/media/api/text/speech/invoke
https://api19-normal-c-useast1a.tiktokv.com/media/api/text/speech/invoke
https://api16-core-c-alisg.tiktokv.com/media/api/text/speech/invoke
https://api16-normal-c-alisg.tiktokv.com/media/api/text/speech/invoke
https://api22-core-c-alisg.tiktokv.com/media/api/text/speech/invoke
https://api16-normal-c-useast2a.tiktokv.com/media/api/text/speech/invoke
Unfortunately, it seems like session IDs might be coupled to a specific region API URL. It can be tricky to get it, as it requires the usage of an emulator and software to intercept the request. However, here is a list of other URLs that you can try with:
https://api16-normal-c-useast1a.tiktokv.com/media/api/text/speech/invoke https://api16-core-c-useast1a.tiktokv.com/media/api/text/speech/invoke https://api16-normal-useast5.us.tiktokv.com/media/api/text/speech/invoke https://api16-core.tiktokv.com/media/api/text/speech/invoke https://api16-core-useast5.us.tiktokv.com/media/api/text/speech/invoke https://api19-core-c-useast1a.tiktokv.com/media/api/text/speech/invoke https://api-core.tiktokv.com/media/api/text/speech/invoke https://api-normal.tiktokv.com/media/api/text/speech/invoke https://api19-normal-c-useast1a.tiktokv.com/media/api/text/speech/invoke https://api16-core-c-alisg.tiktokv.com/media/api/text/speech/invoke https://api16-normal-c-alisg.tiktokv.com/media/api/text/speech/invoke https://api22-core-c-alisg.tiktokv.com/media/api/text/speech/invoke https://api16-normal-c-useast2a.tiktokv.com/media/api/text/speech/invoke
How did you intercept those requests? I'm having the same problem in EU. I'd like to find a url that will work for me myself.
Same error here.
i have tried to forge the url by sniffing my own network, but api domain return me a 404. Seems like they have changed the authentication method on API
Managed to find my API url using HTTP Toolkit to look at the requests the app is making while adding TTS to a video. Since TikTok uses certificate pinning i also used a modified TikTok apk to bypass certificate pinning. After that I was able to see all of the requests in HTTP Toolkit.
And can you drop me a list ? I am in eu to and i'am looking for the url ๐
@kalempster it would be great if you could share whatever URLs you managed to get. Maybe I can add a list in the Readme with all the possible URLs.
found a list here,
https://gist.github.com/RupGautam/e6953b6e0a68ece63e6721309135190f
for EU, this worked for me:
api22-normal-c-useast2a.tiktokv.com
To find what server you are logged in (without external tools)
- Firefox, login to Tiktok Web
- Press F12 to open debug tools
- Select "Storage"
- Select "Cookies"
- Find your "sessionid" there
- Find your region from value "store-idc"
they removed the cookie "store-idc"? I not found it
they removed the cookie "store-idc"? I not found it
I still see that value in firefox.. (in eu)
I also see the store-idc value removed, there is now a store-country-code, which I get "us" for, before the store-idc gave me "useast5"
@kalempster Does it still work to use http toolkit and the modified apk to intercept requests? I do not have a physical android device so I do not think I'll be able to use the same setup to intercept the request
@amartt I guess it should? Honestly I haven't touched this in a long time so I don't really know. HTTP Toolkit should work with an emulated device as they mention it in their docs. "For many cases, including most browser traffic, emulators, and rooted devices, this works with zero manual setup required."
What about Billy, Doll and any other new voices?
@levi-creator-max Any voice should work, the URLs shouldn't change. Just start sniffing with HTTP Toolkit open the TikTok app, create a new TikTok and add the voice you want, the request should show up and you'll have your URL.