diff --git a/src/onthespot/api/spotify.py b/src/onthespot/api/spotify.py index fafcf01..d6a2475 100644 --- a/src/onthespot/api/spotify.py +++ b/src/onthespot/api/spotify.py @@ -273,10 +273,9 @@ def spotify_get_playlist_items(token, playlist_id): logger.info(f"Getting items in playlist: '{playlist_id}'") items = [] offset = 0 - limit = 50 + limit = 100 url = f'https://api.spotify.com/v1/playlists/{playlist_id}/tracks?additional_types=track%2Cepisode' - while True: headers = {'Authorization': f'Bearer {token}'} params = { diff --git a/src/onthespot/parse_item.py b/src/onthespot/parse_item.py index 2d3f15e..e8444a2 100755 --- a/src/onthespot/parse_item.py +++ b/src/onthespot/parse_item.py @@ -96,16 +96,19 @@ def parsingworker(): items = spotify_get_playlist_items(token, current_id) playlist_name, playlist_by = spotify_get_playlist_data(token, current_id) for index, item in enumerate(items): - item_id = item['track']['id'] - item_type = item['track']['type'] - pending[item_id] = { - 'item_service': 'spotify', - 'item_type': item_type, - 'item_id': item_id, - 'parent_category': 'playlist', - 'playlist_name': playlist_name, - 'playlist_by': playlist_by - } + try: + item_id = item['track']['id'] + item_type = item['track']['type'] + pending[item_id] = { + 'item_service': 'spotify', + 'item_type': item_type, + 'item_id': item_id, + 'parent_category': 'playlist', + 'playlist_name': playlist_name, + 'playlist_by': playlist_by + } + except TypeError: + logger.error(f'TypeError for {item}') continue elif current_type == "artist":