davidteather / TikTokBot

A TikTokBot that downloads trending tiktok videos and compiles them using FFmpeg
Other
347 stars 61 forks source link

No response for getUser #10

Closed agusart closed 4 years ago

agusart commented 4 years ago

I'm tryng to call api.getUser() but tiktok API looks like send no response

here's the log:

https://t.tiktok.com/api/user/detail/?uniqueId=charlidamelio&language=en&verifyFp=verify_kbx867qu_pap7vwms_HJOL_4sS7_9MKk_2jBZEkOKWfuv&_signature=_02B4Z6wo00f01WpljdgAAIBDvimpQwsvBYVqZalAAARw43

Converting response to JSON failed response is below (probably empty)

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/TikTokApi/tiktok.py", line 52, in getData return r.json() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/models.py", line 898, in json return complexjson.loads(self.text, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/init.py", line 348, in loads return _default_decoder.decode(s) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/agus/python/tiktokbot/test.py", line 8, in tiktoks = api.getUser('jharnabhagwani') File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/TikTokApi/tiktok.py", line 336, in getUser return self.getData(api_url, b, proxy=proxy) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/TikTokApi/tiktok.py", line 56, in getData raise Exception('Invalid Response') Exception: Invalid Response

Process finished with exit code 1

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.70. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

agusart commented 4 years ago

i think tiktok change the robot.txt (https://www.tiktok.com/robots.txt)

and i try change browser user agent with the allowed one from robot.txt self.userAgent = "Naverbot"

and things work fine now

tiktoks = api.getUser('jharnabhagwani') print(tiktoks['userInfo']['user']['id'])

output : 5831967

davidteather commented 4 years ago

What’s your TikTokApi version you can find out with pip show TikTokApi

I don’t seem to be having the same problem right now

agusart commented 4 years ago

sorry my bad,

just upgrading from TikTokApi-3.2.3 to TikTokApi-3.3.1 and its works well.

thankyou.

yuvraj108c commented 4 years ago

I am still getting the same error after updating