elebumm / RedditVideoMakerBot

Create Reddit Videos with just✨ one command ✨
GNU General Public License v3.0
6.5k stars 1.83k forks source link

KeyError: 'data'[Bug]: #1210

Closed Hamurai99 closed 1 year ago

Hamurai99 commented 2 years ago

Describe the bug

When ever I run the code i get KeyError: 'data' after Saving Text to MP3 files...

Reproduction Steps

Do not know how i got the error

Expected behavior

I expected it to run as normal

Screenshots

Error is:

Traceback (most recent call last): File "/Users/JH/Downloads/RedditVideoMakerBot-master/main.py", line 83, in run_many(config["settings"]["times_to_run"]) File "/Users/JH/Downloads/RedditVideoMakerBot-master/main.py", line 62, in run_many main() File "/Users/JH/Downloads/RedditVideoMakerBot-master/main.py", line 48, in main length, number_of_comments = save_text_to_mp3(reddit_object) File "/Users/JH/Downloads/RedditVideoMakerBot-master/video_creation/voices.py", line 50, in save_text_to_mp3 return text_to_mp3.run() File "/Users/JH/Downloads/RedditVideoMakerBot-master/TTS/engine_wrapper.py", line 61, in run self.call_tts("title", process_text(self.reddit_object["thread_title"])) File "/Users/JH/Downloads/RedditVideoMakerBot-master/TTS/engine_wrapper.py", line 117, in call_tts self.tts_module.run(text, filepath=f"{self.path}/{filename}.mp3") File "/Users/JH/Downloads/RedditVideoMakerBot-master/TTS/TikTok.py", line 94, in run vstr = [r.json()["data"]["v_str"]][0] KeyError: 'data'

System Information

Operating System : [e.g. Windows 11] Python version : [e.g. Python 3.6] App version / Branch [e.g. latest, V2.0, master, develop]

Checklist

Additional Context

No response

Auax commented 2 years ago

Your error is probably due to the TikTok API itself, not the code. I use the API in one of my projects, but it now returns {[...], 'message': "Couldn't load speech. Try again.", [...]}. This response doesn't include the audio data, only this error message. My suggestion is that you try using another TTS service.

digiwijs commented 2 years ago

I have the exact same error, and I changed my tts voice like you suggested and it fixed the problem for me.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 7 days with no activity. Remove stale label or comment, or this will be closed in 10 days.