From 6bbb0a5f2f6482c47424f7c094393a7db0b3aaed Mon Sep 17 00:00:00 2001 From: Scott Walsh Date: Sun, 3 Mar 2024 17:14:39 -0400 Subject: [PATCH] Use exception messages for a better chance at debugging --- helpers/yt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helpers/yt.py b/helpers/yt.py index a473d96..a29e612 100644 --- a/helpers/yt.py +++ b/helpers/yt.py @@ -54,7 +54,7 @@ def main_function(url, options): for item in transcript_list]) transcript_text = transcript_text.replace('\n', ' ') except Exception as e: - transcript_text = "Transcript not available." + transcript_text = f"Transcript not available. ({e})" # Output based on options if options.duration: @@ -70,12 +70,12 @@ def main_function(url, options): # Print JSON object print(json.dumps(output)) except HttpError as e: - print("Error: Failed to access YouTube API. Please check your YOUTUBE_API_KEY and ensure it is valid.") + print(f"Error: Failed to access YouTube API. Please check your YOUTUBE_API_KEY and ensure it is valid: {e}") def main(): parser = argparse.ArgumentParser( - description='vm (video meta) extracts metadata about a video, such as the transcript and the video\'s duration. By Daniel Miessler.') + description='yt (video meta) extracts metadata about a video, such as the transcript and the video\'s duration. By Daniel Miessler.') parser.add_argument('url', nargs='?', help='YouTube video URL') parser.add_argument('--duration', action='store_true', help='Output only the duration')