Skip to content

Commit

Permalink
Fix KeyError
Browse files Browse the repository at this point in the history
  • Loading branch information
bswck committed Dec 22, 2023
1 parent 3e4d885 commit ad61a64
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions redesc/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ def get_playlist_items(
.execute()
)
try:
item["snippet"].update(data["items"][0]["snippet"])
data_item = data["items"][0]["snippet"]
except IndexError:
item["snippet"].update(tags=[])
data_item = {"tags": []}
item["snippet"].update(data_item.setdefault("tags", []))
if page_idx == pages_to_fetch:
page_items = page_items[:last_page_limit]
items.extend(page_items)
Expand Down

0 comments on commit ad61a64

Please sign in to comment.