-
-
Notifications
You must be signed in to change notification settings - Fork 927
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
[BUG] - TikTok sent invalid JSON back #392
Comments
TikTok had add verrification in web. You need verrifyFp to get data. |
Hmm, could you give me an example of how to include the verifyFp? Ive been looking through this repo but im still not sure... |
I don't know how to get it in python. But when I decode tiktok in web after confirming, I get an api like this: "https://www.tiktok.com/node/share/user/@your_tiktok_username?verifyFp=verify_khwsg04i_Kjx9V5Ev_u6d2_4UiG_8p2n_LAsK5DB" |
I logged into TikTok on chrome and then got the s_v_web_id value in cookies (on chrome go into settings, see all cookies, and you can find the s_v_web_id value there it just a long string like verify_*********...). I used that in for custom_verifyFp="", but still keep getting the same exact JSON error, my same code worked a few weeks ago so I assume I'm doing something wrong with the way I'm using verifyFp, but idk... |
Same |
Not bad idea, I'll try it |
Yeah the verifyFp you can view as a parameter on API calls or the cookie called s_v_web_id package got changed a few times up until now and may be working more consistently now |
you could instantiate TikTokApi object with the custom_verifyFp='yourcookievalue' |
@viniciusao do you know how to make it work? |
Read Below!!! If this doesn't fix your issue delete these two lines
You may need to install chromedriver for your machine globally. Download it here and add it to your path.
Describe the bug
TikTok sent invalid JSON back.
The buggy code
Please insert the code that is throwing errors or is giving you weird unexpected results.
Expected behavior
A clear and concise description of what you expected to happen.
Error Trace (if any)
Put the error trace below if there's any error thrown.
ERROR:root:TikTok response: illegal request...
ERROR:root:Converting response to JSON failed
ERROR:root:Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "C:\Users\john\anaconda3\envs\tiktok_new\lib\site-packages\TikTokApi\tiktok.py", line 173, in getData
json = r.json()
File "C:\Users\john\anaconda3\envs\tiktok_new\lib\site-packages\requests\models.py", line 900, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\john\anaconda3\envs\tiktok_new\lib\json_init_.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\john\anaconda3\envs\tiktok_new\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\john\anaconda3\envs\tiktok_new\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "temp.py", line 6, in
t = api.byUsername('therock', did=did, custom_verifyFp='your_verify_fp')[0]
File "C:\Users\john\anaconda3\envs\tiktok_new\lib\site-packages\TikTokApi\tiktok.py", line 493, in byUsername
**kwargs,
File "C:\Users\john\anaconda3\envs\tiktok_new\lib\site-packages\TikTokApi\tiktok.py", line 451, in userPosts
res = self.getData(url=api_url, **kwargs)
File "C:\Users\john\anaconda3\envs\tiktok_new\lib\site-packages\TikTokApi\tiktok.py", line 191, in getData
raise JSONDecodeFailure() from e
TikTokApi.exceptions.JSONDecodeFailure: TikTok sent invalid JSON back
Desktop (please complete the following information):
Additional context
Referred to #374 for bugfix.
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: