Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status error 1 - unable to find the cause #54

Open
aaa3334 opened this issue Mar 26, 2024 · 4 comments
Open

Status error 1 - unable to find the cause #54

aaa3334 opened this issue Mar 26, 2024 · 4 comments

Comments

@aaa3334
Copy link

aaa3334 commented Mar 26, 2024

Is anyone currently using it? I have been getting status error 1. When looking at the error page it says it could be because the params are wrong.. but they seem to be correct here. Any ideas?

Note this is the request url and this is the response I get

https://api16-normal-useast5.us.tiktokv.com/media/api/text/speech/invoke/?text_speaker=en_us_002&req_text=Testing+text+here&speaker_map_type=0&aid=1233
{'status': 'Couldn’t load speech. Try again.', 'status_code': 1, 'status_msg': 'Couldn’t load speech. Try again.'}

(Have tried both of these base urls here:
API_BASE_URL = f"https://api16-normal-v6.tiktokv.com/media/api/text/speech/invoke/"
API_BASE_URL_2="https://api16-normal-useast5.us.tiktokv.com/media/api/text/speech/invoke/")

Note I did try to find a different base url incase that was the issue, but any I got an error when trying to request them, so I don't think its the base url here thats the issue... any ideas on what could be causing the error?

This is what https://github.com/oscie57/tiktok-voice/wiki/Status-Codes says:
status_code: 1

Status Code 1 is caused by an incorrect aid value in the request parameters. The set value should be 1233.

There is another case with status code 1, where a parameter isn't passed, either text_speaker or req_text is missing.

But as you can see in the url's (?text_speaker=en_us_002&req_text=Testing+text+here&speaker_map_type=0&aid=1233), this does not seem to be the reason...

Note this is the top of my function (just edited slightly to stop status error 1 crashing it)

API_BASE_URL = f"https://api16-normal-v6.tiktokv.com/media/api/text/speech/invoke/"
API_BASE_URL_2="https://api16-normal-useast5.us.tiktokv.com/media/api/text/speech/invoke/"

USER_AGENT = f"com.zhiliaoapp.musically/2022600030 (Linux; U; Android 7.1.2; es_ES; SM-G988N; Build/NRD90M;tt-ok/3.12.13.1)"

def tts(session_id: str, text_speaker: str = "en_us_002", req_text: str = "TikTok Text To Speech", filename: str = 'voice.mp3', play: bool = False):

req_text = req_text.replace("+", "plus")
req_text = req_text.replace(" ", "+")
req_text = req_text.replace("&", "and")
req_text = req_text.replace("ä", "ae")
req_text = req_text.replace("ö", "oe")
req_text = req_text.replace("ü", "ue")
req_text = req_text.replace("ß", "ss")

print(f"{API_BASE_URL}?text_speaker={text_speaker}&req_text={req_text}&speaker_map_type=0&aid=1233")
r = requests.post(
    f"{API_BASE_URL}?text_speaker={text_speaker}&req_text={req_text}&speaker_map_type=0&aid=1233",
    headers={
        'User-Agent': USER_AGENT,
        'Cookie': f'sessionid={session_id}'
    }
)

if r.json()["message"] == "Couldn't load speech. Try again.":
    output_data = {"status": "Session ID is invalid", "status_code": 5}
    print(output_data)
    return output_data

if r.json()["status_code"] == 1:
    output_data = {"status": r.json()["message"], "status_code": 1, "status_msg": r.json()["status_msg"]}
    print(output_data)
    return output_data

#print("The new data here is ", r.json())

vstr = [r.json()["data"]["v_str"]][0]
msg = [r.json()["message"]][0]
scode = [r.json()["status_code"]][0]
log = [r.json()["extra"]["log_id"]][0]

dur = [r.json()["data"]["duration"]][0]
spkr = [r.json()["data"]["speaker"]][0]
@aaa3334
Copy link
Author

aaa3334 commented Mar 29, 2024

Still having the same issue.. wondered if it was the sessionid but doesnt seem to make a difference when I refresh it with a new one.. (also it says here that should be error 5).
Anyone having any difficulties or is it working for you?
Note am based in australia and have tried multiple different possible api links I have found online - some give actual errors but the ones which seem to potentially be valid just send me a status 1 code..

@ipharksai
Copy link

same for me, aid value is wrong

@aaa3334
Copy link
Author

aaa3334 commented Apr 22, 2024

same for me, aid value is wrong

Did you find the right aid value?

@amartt
Copy link

amartt commented Oct 13, 2024

@aaa3334 I got the same error when using

API_BASE_URL = f"https://api16-normal-v6.tiktokv.com/media/api/text/speech/invoke/"

but this url did work for me

API_BASE_URL_2="https://api16-normal-useast5.us.tiktokv.com/media/api/text/speech/invoke/"

I am using
text_speaker = "en_us_002" req_text = "TikTok Text To Speech"

which seems like you are as well. Given that you're based in Australia you may need to be using a different session id which would work with your region, Steve0929/tiktok-tts#17 (comment)

This is how I got my session id and region values, since I'm in useast5 the region didn't need to be changed in the endpoint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants