diff --git a/main.py b/main.py index 8e668c1..32ff3d2 100644 --- a/main.py +++ b/main.py @@ -13,7 +13,7 @@ def get_api_key(): print(f"Retreived OpenAI API Key.") return OPENAI_API_KEY except Exception as e: - print(f"Failed to retrieve OpenAI API Key: {e}") + print(f"\033[91mFailed to retrieve OpenAI API Key: {e}\033[0m") return None # Downloads the audio from a YouTube video. @@ -28,7 +28,7 @@ def download(video_url, output_filename='audio.mp4'): print(f"Downloaded audio.") return audio_filename except Exception as e: - print(f"Failed to download audio: {e}") + print(f"\033[91mFailed to download audio: {e}\033[0m") return None # Transcribes the audio file using OpenAI's transcription service. @@ -46,7 +46,7 @@ def transcription(OPENAI_API_KEY, audio_filename): print("Transcripted audio.") return transcript except Exception as e: - print(f"Failed to transcript audio: {e}") + print(f"\033[91mFailed to transcript audio: {e}\033[0m") return None # Generates a summary for a given transcript using GPT-4. @@ -70,7 +70,7 @@ def summary(OPENAI_API_KEY, transcript): print("\nSummarized transcript.") except Exception as e: - print(f"Failed to summarize transcript: {e}") + print(f"\033[91mFailed to summarize transcript: {e}\033[0m") return None # Deletes the specified audio file. @@ -82,7 +82,7 @@ def cleanup(audio_filename): print(f"Deleted audio.") except Exception as e: - print(f"Failed to delete audio: {e}") + print(f"\033[91mFailed to delete audio: {e}\033[0m") return None # Main function to orchestrate the API Key retreival, download, transcription, summarization, and cleanup process. @@ -90,7 +90,7 @@ def main(): try: OPENAI_API_KEY = get_api_key() video_url = str(input("Video url: ")) - + if OPENAI_API_KEY is not None: audio_filename = download(video_url) if audio_filename is not None: @@ -99,7 +99,7 @@ def main(): summary(OPENAI_API_KEY, transcript) cleanup(audio_filename) except Exception as e: - print(e) + print(f"\033[91m{e}\033[0m") finally: input("Press Enter to exit...")