Fix keywords parsing of Pexels video finding (#258)

Fix to keep bracket squares for Json parsing.
This commit is contained in:
Roy Mu 2024-08-28 21:11:24 +09:00 committed by GitHub
parent d066b70972
commit 6c99d1398a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -209,7 +209,7 @@ def get_search_terms(video_subject: str, amount: int, script: str, ai_model: str
except (json.JSONDecodeError, ValueError):
# Get everything between the first and last square brackets
response = response[response.find("[") + 1:response.rfind("]")]
response = response[response.find("["):response.rfind("]") + 1]
print(colored("[*] GPT returned an unformatted response. Attempting to clean...", "yellow"))