-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
KeyError #12
Comments
same here. got this from chatgpt: The error you're encountering is a KeyError raised at the line x_csrf_token = r.headers["X-Ware-Csrf-Token"].split(',')[1] in the uploadVideo function. This error occurs because the "X-Ware-Csrf-Token" header is not present in the response returned by the TikTok server, and the code is trying to access it. The "X-Ware-Csrf-Token" header is typically used for CSRF (Cross-Site Request Forgery) protection. If the TikTok server has changed its response structure or if there is an issue with the request or authentication, this header might not be included in the response. To fix this issue, you can add a check to ensure that the "X-Ware-Csrf-Token" header is present before accessing it. Modify the line as follows: python After making this change, try running your code again, and see if the issue is resolved. If there are other issues or errors, further debugging might be necessary to identify and address them. |
I think this is not going to work because the header field seems not to be present anymore. Were you successful on reactivating the script? |
Just tested this and sadly it is not working. |
Is there any other fix? |
#x_csrf_token = r.headers["X-Ware-Csrf-Token"].split(',')[1]
params = {
"video_id":video_id,
"visibility_type":"0",
"poster_delay":"0",
"text":text,
"text_extra":json.dumps(text_extra),
"allow_comment":"1",
"allow_duet":"0",
"allow_stitch":"0",
"sound_exemption":"0",
"aid":"1988",
}
if schedule_time:
params["schedule_time"] = schedule_time
#headers = {"X-Secsdk-Csrf-Token": x_csrf_token} You need to remove this line of code |
It works, but when file is uploaded to tiktok, then it doesn't has any audio |
In browser it shows that video is uploaded, but without sound, but from other devices you can't see this video |
I uploaded successfully and it is with sound, I can only log in to tiktok through the browser no other device |
But you didn't add a pull request, here ;( I'm gonna do a retest and then create a pull request. Maybe we get this thing back on track. |
UploadTest.py
VVV
`from TiktokUploader import uploadVideo
session_id = "my session id"
file = "video_output.mp4"
title = "My Video"
tags = ["fyp", "viral"]
uploadVideo(session_id, file, title, tags, verbose=True)`
Error:
File "TiktokUploader.py", line 200, in uploadVideo x_crsf_toke = r.headers["X-Ware-Csrf-Token"].split(',')[1] File ".local/lib/python3.7/site-packages/requests/structures.py", line 52, in __getitem__ return self._store[key.lower()][1] KeyError: 'x-ware'csrf-token'
All other errors I've had have been because of connection timeouts, but I have yet to try to fix those.
The text was updated successfully, but these errors were encountered: