question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] - ERROR:root:Converting response to JSON failed response is below (probably empty)

See original GitHub issue

So yesterday my code worked fine, saved it and got to it today again. None of my programs using tiktokAPI are working. I am getting the same bug on all of them.

A clear and concise description of what the bug is.

Please insert the code that is throwing errors or is giving you weird unexpected results.

from TikTokApi import TikTokApi
api = TikTokApi.get_instance()

TikTokUserName = "danielhow01"
results = 500


UserLikedVideos = api.userLikedbyUsername(username=TikTokUserName, count=results)


for tiktok in UserLikedVideos:  
    Like_File = open("linksToLikedVideos.json", "a")
    idOfLikedVideo = tiktok['id']
    usernameOfLikedVideo = tiktok['author']['uniqueId']
    Like_File.write("\nhttps://www.tiktok.com/@" + usernameOfLikedVideo + "/video/" + idOfLikedVideo)
    Like_File.close()


print(idOfLikedVideo)
print(usernameOfLikedVideo)

Expected behavior

Well, the ID and username of 500 liked videos from a user are writen to a file. I added “https://www.tiktok.com/@” etc to make it a link.

Error Trace (if any)

Put the error trace below if there’s any error thrown.

ERROR:root:Expecting value: line 1 column 1 (char 0)
ERROR:root:Converting response to JSON failed response is below (probably empty)
Traceback (most recent call last):
  File "C:\Users\Robin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\TikTokApi\tiktok.py", line 162, in getData
    return r.json()
  File "C:\Users\Robin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\Robin\AppData\Local\Programs\Python\Python38-32\lib\json\__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Robin\AppData\Local\Programs\Python\Python38-32\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Robin\AppData\Local\Programs\Python\Python38-32\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 "C:/Users/Robin/Desktop/PyCharmProjects/TikTokV2/Get TikTok by URL.py", line 7, in <module>
    test = api.getTikTokById(id = Id, language='en', proxy=None)        # test is een dict
  File "C:\Users\Robin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\TikTokApi\tiktok.py", line 894, in getTikTokById
    return self.getData(url=api_url, **kwargs)
  File "C:\Users\Robin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\TikTokApi\tiktok.py", line 169, in getData
    raise Exception("Invalid Response")
Exception: Invalid Response

Desktop (please complete the following information):

  • OS: Windows 10
  • TikTokApi Version 3.7.7

Additional context Downloaded it yesterday, excuse me for my bad english and code. I am not a pro.

Is this some sort of TikTok banned me for accessing there info to much to quick?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
issue-label-bot[bot]commented, Nov 13, 2020

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

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

1reaction
hoylemdcommented, Nov 13, 2020

Also seeing this. Here’s hoping @davidteather can get around it. If you need help, I can make some time for it today!

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON Parser Step Error - Flow Designer - ServiceNow
So I am making a Get REST call and saving the JSON response as a .txt attachment in servicenow. I'd like to use...
Read more >
JSON request returns a blank response randomly causing ...
The code loops through the function repeatedly and is successful 99% of the time, but fails every once in a while when a...
Read more >
How to Fix the Invalid JSON Error in WordPress? - Rank Math
In this article, learn how to fix the invalid JSON error - 'Updating failed. The response is not a valid JSON response.' with...
Read more >
Failed to parse json data? | Apple Developer Forums
use JSONDecoder().decode. to parse data. {"aaa": "value", "bbb": 1}. it generated error: Unexpected error: dataCorrupted(Swift.DecodingError.
Read more >
Solved: Re: Empty JSON string when getting target response...
I need to reformat(extract an array element or nodeset) the JSON string in javascript and send that as new response. I am getting...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found