Skip to content

Commit a48a6ab

Browse files
authored
Check a search result has a videoId before adding to the playlist
1 parent ec11b8d commit a48a6ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lambda_function.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ def video_search(query):
277277
).execute()
278278
videos = []
279279
for search_result in search_response.get('items', []):
280-
videos.append(search_result['id']['videoId'])
280+
if 'videoId' in search_result['id']:
281+
videos.append(search_result['id']['videoId'])
281282
return videos
282283

283284
def playlist_search(query, sr):

0 commit comments

Comments
 (0)