Skip to content

Commit c7d6069

Browse files
committed
chore: added better exception
1 parent 06a1ca9 commit c7d6069

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,9 @@ def getVideoInfo(video_id):
184184
# Set up Google API credentials using API key
185185
api_key = os.environ.get('YOUTUBE_API_KEY')
186186
if api_key is None:
187-
raise Exception("No API key found")
187+
raise Exception(
188+
"No API key found, please set the YOUTUBE_API_KEY environment variable. \n Example: export YOUTUBE_API_KEY=your_api_key"
189+
)
188190
youtube = googleapiclient.discovery.build(
189191
"youtube", "v3", developerKey=api_key)
190192
request = youtube.videos().list(part="id,snippet",

0 commit comments

Comments
 (0)