avilash / TikTokAPI-Python

TikTok API Python Wrapper
http://avilashkumar.com/TikTokAPI-Python/
MIT License
443 stars 114 forks source link

Bug, can't get trending videos #16

Closed VivianoRiccardo closed 3 years ago

VivianoRiccardo commented 3 years ago

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/erre4/.local/lib/python3.7/site-packages/TikTokAPI/tiktokapi.py", line 95, in getTrending return self.send_get_request(url, params) File "/home/erre4/.local/lib/python3.7/site-packages/TikTokAPI/tiktokapi.py", line 75, in send_get_request data = get_req_json(url, params=None, headers=self.headers) File "/home/erre4/.local/lib/python3.7/site-packages/TikTokAPI/utils.py", line 28, in get_req_json return json.loads(r.text) File "/usr/lib/python3.7/json/__init__.py", line 348, in loads return _default_decoder.decode(s) File "/usr/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/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)

python3.7

code:

from TikTokAPI import TikTokAPI
api = TikTokAPI()
retval = api.getTrending(count=5)

it worked until last week. Found similar issues on the other unofficial tiktok python API, but no one could solve it at the moment.

avilash commented 3 years ago

Released a new version. Adapted to all changes from Tiktok. Please run

pip install PyTikTokAPI --upgrade

Also please checkout new README to add your cookie parameters