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

[BUG] Error when running getTiktoksByHashtag #92

Closed
cplasabas opened this issue May 18, 2020 · 3 comments
Closed

[BUG] Error when running getTiktoksByHashtag #92

cplasabas opened this issue May 18, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@cplasabas
Copy link

Getting this error when running getTiktoksByHashtag

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

Traceback (most recent call last):
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\site-packages\TikTokApi\tiktok.py", line 34, in getData
    return r.json()
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\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)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "getTiktoksByHashtag.py", line 7, in <module>
    tiktoks = api.byHashtag('zendeechallenge', count=count)
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\site-packages\TikTokApi\tiktok.py", line 190, in byHashtag
    res = self.getData(api_url, b.signature, b.userAgent)
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\site-packages\TikTokApi\tiktok.py", line 38, in getData
    raise Exception('Invalid Response')
Exception: Invalid Response
@cplasabas cplasabas added the bug Something isn't working label May 18, 2020
@davidteather
Copy link
Owner

This is most likely being caused by a rate limiting on TikTok's server. Issue #88 had a similar problem, not the same but it was similar with the response a server would send.

@justinripple
Copy link

I had the same issue. I read issue #88. I modified the code as follows:
######################
import time

from TikTokApi import TikTokApi
api = TikTokApi()
count = 10
tiktoks = api.byUsername('therock', count=count)

for tiktok in tiktoks:
print(tiktok)
time.sleep(30)**
#######################
However, it doesn't solve the problem. Please help!

@idilkylmz
Copy link

I had the same issue. I read issue #88. I modified the code as follows:
######################
import time

from TikTokApi import TikTokApi
api = TikTokApi()
count = 10
tiktoks = api.byUsername('therock', count=count)

for tiktok in tiktoks:
print(tiktok)
time.sleep(30)**
#######################
However, it doesn't solve the problem. Please help!

Hi justin I am having the same problem did you have a chance to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants