diff --git a/lab-apis.ipynb b/lab-apis.ipynb index e923554..532f15d 100644 --- a/lab-apis.ipynb +++ b/lab-apis.ipynb @@ -39,8 +39,8 @@ "metadata": {}, "outputs": [], "source": [ - "CLIENT_ID = \"\"\n", - "CLIENT_SECRET = \"\"" + "#CLIENT_ID = \"\"\n", + "#CLIENT_SECRET = \"\"" ] }, { @@ -50,8 +50,18 @@ "metadata": {}, "outputs": [], "source": [ - "CLIENT_ID = \"4109b2d9f5014671863bb2df1d1fbdd3\"\n", - "CLIENT_SECRET = \"5cb719fae80c4191a9c0b288f51bfe50\"" + "#CLIENT_ID = \"4109b2d9f5014671863bb2df1d1fbdd3\"\n", + "#CLIENT_SECRET = \"5cb719fae80c4191a9c0b288f51bfe50\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f1a3ee41", + "metadata": {}, + "outputs": [], + "source": [ + "#pip install python-dotenv" ] }, { @@ -62,7 +72,35 @@ "outputs": [], "source": [ "# If you havent done so, install the spotipy wrapper\n", - "!pip install spotipy" + "#!pip install spotipy" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "1f3a7b82", + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "from dotenv import load_dotenv\n", + "import spotipy\n", + "from spotipy.oauth2 import SpotifyClientCredentials\n", + "from spotipy.oauth2 import SpotifyOAuth" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "513c9243", + "metadata": {}, + "outputs": [], + "source": [ + "load_dotenv()\n", + "\n", + "client_id = os.getenv(\"SPOTIPY_CLIENT_ID\")\n", + "client_secret = os.getenv(\"SPOTIPY_CLIENT_SECRET\")\n", + "redirect_uri = os.getenv(\"SPOTIPY_REDIRECT_URI\")" ] }, { @@ -88,6 +126,21 @@ " client_secret=CLIENT_SECRET))\n" ] }, + { + "cell_type": "code", + "execution_count": 6, + "id": "02f6f458", + "metadata": {}, + "outputs": [], + "source": [ + "sp = spotipy.Spotify(\n", + " auth_manager=SpotifyClientCredentials(\n", + " client_id=client_id,\n", + " client_secret=client_secret\n", + " )\n", + ")" + ] + }, { "cell_type": "markdown", "id": "8fed9628-08d7-4290-a4be-5527696b01c5", @@ -104,6 +157,47 @@ "Now, let's use the search method by introducing a \"query\". For example, let's try searching for \"Lady Gaga\":" ] }, + { + "cell_type": "code", + "execution_count": 8, + "id": "a44722a5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'artists': {'href': 'https://api.spotify.com/v1/search?offset=0&limit=1&query=Adele&type=artist',\n", + " 'limit': 1,\n", + " 'next': 'https://api.spotify.com/v1/search?offset=1&limit=1&query=Adele&type=artist',\n", + " 'offset': 0,\n", + " 'previous': None,\n", + " 'total': 100,\n", + " 'items': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/4dpARuHxo51G3z768sgnrY'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4dpARuHxo51G3z768sgnrY',\n", + " 'id': '4dpARuHxo51G3z768sgnrY',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab6761610000e5eb68f6e5892075d7f22615bd17',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab6761610000517468f6e5892075d7f22615bd17',\n", + " 'height': 320,\n", + " 'width': 320},\n", + " {'url': 'https://i.scdn.co/image/ab6761610000f17868f6e5892075d7f22615bd17',\n", + " 'height': 160,\n", + " 'width': 160}],\n", + " 'name': 'Adele',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4dpARuHxo51G3z768sgnrY'}]}}" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sp.search(q=\"Adele\", limit=1, type=\"artist\")" + ] + }, { "cell_type": "code", "execution_count": null, @@ -111,90 +205,1156 @@ "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "{'tracks': {'href': 'https://api.spotify.com/v1/search?offset=0&limit=10&query=Lady%20Gaga&type=track',\n", + " 'limit': 10,\n", + " 'next': 'https://api.spotify.com/v1/search?offset=10&limit=10&query=Lady%20Gaga&type=track',\n", + " 'offset': 0,\n", + " 'previous': None,\n", + " 'total': 18,\n", + " 'items': [{'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/1qwlxZTNLe1jq3b0iidlue'},\n", + " 'href': 'https://api.spotify.com/v1/albums/1qwlxZTNLe1jq3b0iidlue',\n", + " 'id': '1qwlxZTNLe1jq3b0iidlue',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273e691217483df8798445c82e2'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02e691217483df8798445c82e2'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851e691217483df8798445c82e2'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Fame',\n", + " 'release_date': '2008-01-01',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 15,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:1qwlxZTNLe1jq3b0iidlue'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 237200,\n", + " 'explicit': True,\n", + " 'external_ids': {'isrc': 'USUM70824409'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1QV6tiMFM6fSOKOGLMHYYg'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1QV6tiMFM6fSOKOGLMHYYg',\n", + " 'id': '1QV6tiMFM6fSOKOGLMHYYg',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Poker Face',\n", + " 'track_number': 4,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1QV6tiMFM6fSOKOGLMHYYg'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/4VIvfOurcf0vuLRxLkGnIG'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4VIvfOurcf0vuLRxLkGnIG',\n", + " 'id': '4VIvfOurcf0vuLRxLkGnIG',\n", + " 'name': 'Bradley Cooper',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4VIvfOurcf0vuLRxLkGnIG'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/4sLtOBOzn4s3GDUv3c5oJD'},\n", + " 'href': 'https://api.spotify.com/v1/albums/4sLtOBOzn4s3GDUv3c5oJD',\n", + " 'id': '4sLtOBOzn4s3GDUv3c5oJD',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273e2d156fdc691f57900134342'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02e2d156fdc691f57900134342'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851e2d156fdc691f57900134342'}],\n", + " 'is_playable': True,\n", + " 'name': 'A Star Is Born Soundtrack',\n", + " 'release_date': '2018-10-05',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 34,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:4sLtOBOzn4s3GDUv3c5oJD'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/4VIvfOurcf0vuLRxLkGnIG'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4VIvfOurcf0vuLRxLkGnIG',\n", + " 'id': '4VIvfOurcf0vuLRxLkGnIG',\n", + " 'name': 'Bradley Cooper',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4VIvfOurcf0vuLRxLkGnIG'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 215733,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM71813192'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/2VxeLyX666F8uXCJ0dZF8B'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/2VxeLyX666F8uXCJ0dZF8B',\n", + " 'id': '2VxeLyX666F8uXCJ0dZF8B',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Shallow',\n", + " 'track_number': 12,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:2VxeLyX666F8uXCJ0dZF8B'},\n", + " {'album': {'album_type': 'single',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/0du5cEVh5yTK9QJze8zA0C'},\n", + " 'href': 'https://api.spotify.com/v1/artists/0du5cEVh5yTK9QJze8zA0C',\n", + " 'id': '0du5cEVh5yTK9QJze8zA0C',\n", + " 'name': 'Bruno Mars',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:0du5cEVh5yTK9QJze8zA0C'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/10FLjwfpbxLmW8c25Xyc2N'},\n", + " 'href': 'https://api.spotify.com/v1/albums/10FLjwfpbxLmW8c25Xyc2N',\n", + " 'id': '10FLjwfpbxLmW8c25Xyc2N',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b27382ea2e9e1858aa012c57cd45'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e0282ea2e9e1858aa012c57cd45'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000485182ea2e9e1858aa012c57cd45'}],\n", + " 'is_playable': True,\n", + " 'name': 'Die With A Smile',\n", + " 'release_date': '2024-08-16',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 1,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:10FLjwfpbxLmW8c25Xyc2N'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/0du5cEVh5yTK9QJze8zA0C'},\n", + " 'href': 'https://api.spotify.com/v1/artists/0du5cEVh5yTK9QJze8zA0C',\n", + " 'id': '0du5cEVh5yTK9QJze8zA0C',\n", + " 'name': 'Bruno Mars',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:0du5cEVh5yTK9QJze8zA0C'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 251667,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM72409273'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/2plbrEY59IikOBgBGLjaoe'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/2plbrEY59IikOBgBGLjaoe',\n", + " 'id': '2plbrEY59IikOBgBGLjaoe',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Die With A Smile',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:2plbrEY59IikOBgBGLjaoe'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/4VIvfOurcf0vuLRxLkGnIG'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4VIvfOurcf0vuLRxLkGnIG',\n", + " 'id': '4VIvfOurcf0vuLRxLkGnIG',\n", + " 'name': 'Bradley Cooper',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4VIvfOurcf0vuLRxLkGnIG'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/3edjzMAVB9RYRd4UcZBchx'},\n", + " 'href': 'https://api.spotify.com/v1/albums/3edjzMAVB9RYRd4UcZBchx',\n", + " 'id': '3edjzMAVB9RYRd4UcZBchx',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273b5d4b4ed17ec86c4b3944af2'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02b5d4b4ed17ec86c4b3944af2'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851b5d4b4ed17ec86c4b3944af2'}],\n", + " 'is_playable': True,\n", + " 'name': 'A Star Is Born Soundtrack (Without Dialogue)',\n", + " 'release_date': '2018-10-05',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 19,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:3edjzMAVB9RYRd4UcZBchx'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 210200,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM71813195'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/2rbDhOo9Fh61Bbu23T2qCk'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/2rbDhOo9Fh61Bbu23T2qCk',\n", + " 'id': '2rbDhOo9Fh61Bbu23T2qCk',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Always Remember Us This Way',\n", + " 'track_number': 9,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:2rbDhOo9Fh61Bbu23T2qCk'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/1qwlxZTNLe1jq3b0iidlue'},\n", + " 'href': 'https://api.spotify.com/v1/albums/1qwlxZTNLe1jq3b0iidlue',\n", + " 'id': '1qwlxZTNLe1jq3b0iidlue',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273e691217483df8798445c82e2'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02e691217483df8798445c82e2'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851e691217483df8798445c82e2'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Fame',\n", + " 'release_date': '2008-01-01',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 15,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:1qwlxZTNLe1jq3b0iidlue'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/7fObcBw9VM3x7ntWKCYl0z'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7fObcBw9VM3x7ntWKCYl0z',\n", + " 'id': '7fObcBw9VM3x7ntWKCYl0z',\n", + " 'name': \"Colby O'Donis\",\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7fObcBw9VM3x7ntWKCYl0z'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 241933,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM70807646'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1dzQoRqT5ucxXVaAhTcT0J'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1dzQoRqT5ucxXVaAhTcT0J',\n", + " 'id': '1dzQoRqT5ucxXVaAhTcT0J',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Just Dance',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1dzQoRqT5ucxXVaAhTcT0J'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/6rePArBMb5nLWEaY9aQqL4'},\n", + " 'href': 'https://api.spotify.com/v1/albums/6rePArBMb5nLWEaY9aQqL4',\n", + " 'id': '6rePArBMb5nLWEaY9aQqL4',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b2735c9890c0456a3719eeecd8aa'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e025c9890c0456a3719eeecd8aa'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d000048515c9890c0456a3719eeecd8aa'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Fame Monster (Deluxe Edition)',\n", + " 'release_date': '2009-11-05',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 23,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:6rePArBMb5nLWEaY9aQqL4'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 294573,\n", + " 'explicit': True,\n", + " 'external_ids': {'isrc': 'USUM70918596'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/0SiywuOBRcynK0uKGWdCnn'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/0SiywuOBRcynK0uKGWdCnn',\n", + " 'id': '0SiywuOBRcynK0uKGWdCnn',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Bad Romance',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:0SiywuOBRcynK0uKGWdCnn'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/2MHUaRi9OCyTN02SoyRRBJ'},\n", + " 'href': 'https://api.spotify.com/v1/albums/2MHUaRi9OCyTN02SoyRRBJ',\n", + " 'id': '2MHUaRi9OCyTN02SoyRRBJ',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273b0860cf0a98e09663c82290c'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02b0860cf0a98e09663c82290c'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851b0860cf0a98e09663c82290c'}],\n", + " 'is_playable': True,\n", + " 'name': 'MAYHEM',\n", + " 'release_date': '2025-03-07',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 14,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:2MHUaRi9OCyTN02SoyRRBJ'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 223398,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM72412581'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/2LHNTC9QZxsL3nWpt8iaSR'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/2LHNTC9QZxsL3nWpt8iaSR',\n", + " 'id': '2LHNTC9QZxsL3nWpt8iaSR',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Abracadabra',\n", + " 'track_number': 2,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:2LHNTC9QZxsL3nWpt8iaSR'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/6rePArBMb5nLWEaY9aQqL4'},\n", + " 'href': 'https://api.spotify.com/v1/albums/6rePArBMb5nLWEaY9aQqL4',\n", + " 'id': '6rePArBMb5nLWEaY9aQqL4',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b2735c9890c0456a3719eeecd8aa'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e025c9890c0456a3719eeecd8aa'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d000048515c9890c0456a3719eeecd8aa'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Fame Monster (Deluxe Edition)',\n", + " 'release_date': '2009-11-05',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 23,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:6rePArBMb5nLWEaY9aQqL4'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 274213,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM70905526'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1HHeOs6zRdF8Ck58easiAY'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1HHeOs6zRdF8Ck58easiAY',\n", + " 'id': '1HHeOs6zRdF8Ck58easiAY',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Alejandro',\n", + " 'track_number': 2,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1HHeOs6zRdF8Ck58easiAY'},\n", + " {'album': {'album_type': 'single',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/1KdrtZn2AmuQPHKIr3h4e6'},\n", + " 'href': 'https://api.spotify.com/v1/albums/1KdrtZn2AmuQPHKIr3h4e6',\n", + " 'id': '1KdrtZn2AmuQPHKIr3h4e6',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273d8a389abdf9cb2d03b85ff54'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02d8a389abdf9cb2d03b85ff54'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851d8a389abdf9cb2d03b85ff54'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Dead Dance',\n", + " 'release_date': '2025-09-03',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 1,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:1KdrtZn2AmuQPHKIr3h4e6'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 228518,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM72407034'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/3NFs3XUduzBfvc5Bx1gmzh'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/3NFs3XUduzBfvc5Bx1gmzh',\n", + " 'id': '3NFs3XUduzBfvc5Bx1gmzh',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'The Dead Dance',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:3NFs3XUduzBfvc5Bx1gmzh'},\n", + " {'album': {'album_type': 'single',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/6NQtXhodb5tNerCDXaX3sN'},\n", + " 'href': 'https://api.spotify.com/v1/artists/6NQtXhodb5tNerCDXaX3sN',\n", + " 'id': '6NQtXhodb5tNerCDXaX3sN',\n", + " 'name': 'Stubete Gäng',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:6NQtXhodb5tNerCDXaX3sN'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/5qgjFqo3rO9WM2HIcfX0mg'},\n", + " 'href': 'https://api.spotify.com/v1/albums/5qgjFqo3rO9WM2HIcfX0mg',\n", + " 'id': '5qgjFqo3rO9WM2HIcfX0mg',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273152dea1201467c127f7027fb'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02152dea1201467c127f7027fb'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851152dea1201467c127f7027fb'}],\n", + " 'is_playable': True,\n", + " 'name': 'Richi',\n", + " 'release_date': '2022-05-13',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 5,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:5qgjFqo3rO9WM2HIcfX0mg'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/6NQtXhodb5tNerCDXaX3sN'},\n", + " 'href': 'https://api.spotify.com/v1/artists/6NQtXhodb5tNerCDXaX3sN',\n", + " 'id': '6NQtXhodb5tNerCDXaX3sN',\n", + " 'name': 'Stubete Gäng',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:6NQtXhodb5tNerCDXaX3sN'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 196880,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'CHA142200002'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/49UogtWKIeSutY9yMsAzCT'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/49UogtWKIeSutY9yMsAzCT',\n", + " 'id': '49UogtWKIeSutY9yMsAzCT',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Richi',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:49UogtWKIeSutY9yMsAzCT'}]}}" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "results = sp.search(q='Lady Gaga', limit=50)\n", + "# CODE IS OUTDATED! limit has been lowered to 10 instead of 50\n", + "\n", + "results = sp.search(q='Lady Gaga', limit=10)\n", "results" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "edc14c95-474b-4e2a-aea3-bdfd0a205546", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['tracks'])" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results.keys() # We can see that we only have tracks" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "ad8ef934-1dbb-4008-ac8e-f5c29823fe6a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['href', 'limit', 'next', 'offset', 'previous', 'total', 'items'])" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"].keys() # Let's check the values" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "004b7814-4dd5-408e-b7ba-1da87f9250cb", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'https://api.spotify.com/v1/search?offset=0&limit=10&query=Lady%20Gaga&type=track'" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"href\"] # Query we have searched " ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "7285cedd-fbe1-47cf-98d5-a7fdc3e5c8b8", "metadata": { "scrolled": true, "tags": [] }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[{'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/1qwlxZTNLe1jq3b0iidlue'},\n", + " 'href': 'https://api.spotify.com/v1/albums/1qwlxZTNLe1jq3b0iidlue',\n", + " 'id': '1qwlxZTNLe1jq3b0iidlue',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273e691217483df8798445c82e2'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02e691217483df8798445c82e2'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851e691217483df8798445c82e2'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Fame',\n", + " 'release_date': '2008-01-01',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 15,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:1qwlxZTNLe1jq3b0iidlue'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 237200,\n", + " 'explicit': True,\n", + " 'external_ids': {'isrc': 'USUM70824409'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1QV6tiMFM6fSOKOGLMHYYg'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1QV6tiMFM6fSOKOGLMHYYg',\n", + " 'id': '1QV6tiMFM6fSOKOGLMHYYg',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Poker Face',\n", + " 'track_number': 4,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1QV6tiMFM6fSOKOGLMHYYg'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/4VIvfOurcf0vuLRxLkGnIG'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4VIvfOurcf0vuLRxLkGnIG',\n", + " 'id': '4VIvfOurcf0vuLRxLkGnIG',\n", + " 'name': 'Bradley Cooper',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4VIvfOurcf0vuLRxLkGnIG'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/4sLtOBOzn4s3GDUv3c5oJD'},\n", + " 'href': 'https://api.spotify.com/v1/albums/4sLtOBOzn4s3GDUv3c5oJD',\n", + " 'id': '4sLtOBOzn4s3GDUv3c5oJD',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273e2d156fdc691f57900134342'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02e2d156fdc691f57900134342'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851e2d156fdc691f57900134342'}],\n", + " 'is_playable': True,\n", + " 'name': 'A Star Is Born Soundtrack',\n", + " 'release_date': '2018-10-05',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 34,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:4sLtOBOzn4s3GDUv3c5oJD'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/4VIvfOurcf0vuLRxLkGnIG'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4VIvfOurcf0vuLRxLkGnIG',\n", + " 'id': '4VIvfOurcf0vuLRxLkGnIG',\n", + " 'name': 'Bradley Cooper',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4VIvfOurcf0vuLRxLkGnIG'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 215733,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM71813192'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/2VxeLyX666F8uXCJ0dZF8B'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/2VxeLyX666F8uXCJ0dZF8B',\n", + " 'id': '2VxeLyX666F8uXCJ0dZF8B',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Shallow',\n", + " 'track_number': 12,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:2VxeLyX666F8uXCJ0dZF8B'},\n", + " {'album': {'album_type': 'single',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/0du5cEVh5yTK9QJze8zA0C'},\n", + " 'href': 'https://api.spotify.com/v1/artists/0du5cEVh5yTK9QJze8zA0C',\n", + " 'id': '0du5cEVh5yTK9QJze8zA0C',\n", + " 'name': 'Bruno Mars',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:0du5cEVh5yTK9QJze8zA0C'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/10FLjwfpbxLmW8c25Xyc2N'},\n", + " 'href': 'https://api.spotify.com/v1/albums/10FLjwfpbxLmW8c25Xyc2N',\n", + " 'id': '10FLjwfpbxLmW8c25Xyc2N',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b27382ea2e9e1858aa012c57cd45'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e0282ea2e9e1858aa012c57cd45'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000485182ea2e9e1858aa012c57cd45'}],\n", + " 'is_playable': True,\n", + " 'name': 'Die With A Smile',\n", + " 'release_date': '2024-08-16',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 1,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:10FLjwfpbxLmW8c25Xyc2N'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/0du5cEVh5yTK9QJze8zA0C'},\n", + " 'href': 'https://api.spotify.com/v1/artists/0du5cEVh5yTK9QJze8zA0C',\n", + " 'id': '0du5cEVh5yTK9QJze8zA0C',\n", + " 'name': 'Bruno Mars',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:0du5cEVh5yTK9QJze8zA0C'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 251667,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM72409273'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/2plbrEY59IikOBgBGLjaoe'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/2plbrEY59IikOBgBGLjaoe',\n", + " 'id': '2plbrEY59IikOBgBGLjaoe',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Die With A Smile',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:2plbrEY59IikOBgBGLjaoe'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/4VIvfOurcf0vuLRxLkGnIG'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4VIvfOurcf0vuLRxLkGnIG',\n", + " 'id': '4VIvfOurcf0vuLRxLkGnIG',\n", + " 'name': 'Bradley Cooper',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4VIvfOurcf0vuLRxLkGnIG'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/3edjzMAVB9RYRd4UcZBchx'},\n", + " 'href': 'https://api.spotify.com/v1/albums/3edjzMAVB9RYRd4UcZBchx',\n", + " 'id': '3edjzMAVB9RYRd4UcZBchx',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273b5d4b4ed17ec86c4b3944af2'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02b5d4b4ed17ec86c4b3944af2'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851b5d4b4ed17ec86c4b3944af2'}],\n", + " 'is_playable': True,\n", + " 'name': 'A Star Is Born Soundtrack (Without Dialogue)',\n", + " 'release_date': '2018-10-05',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 19,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:3edjzMAVB9RYRd4UcZBchx'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 210200,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM71813195'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/2rbDhOo9Fh61Bbu23T2qCk'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/2rbDhOo9Fh61Bbu23T2qCk',\n", + " 'id': '2rbDhOo9Fh61Bbu23T2qCk',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Always Remember Us This Way',\n", + " 'track_number': 9,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:2rbDhOo9Fh61Bbu23T2qCk'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/1qwlxZTNLe1jq3b0iidlue'},\n", + " 'href': 'https://api.spotify.com/v1/albums/1qwlxZTNLe1jq3b0iidlue',\n", + " 'id': '1qwlxZTNLe1jq3b0iidlue',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273e691217483df8798445c82e2'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02e691217483df8798445c82e2'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851e691217483df8798445c82e2'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Fame',\n", + " 'release_date': '2008-01-01',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 15,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:1qwlxZTNLe1jq3b0iidlue'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/7fObcBw9VM3x7ntWKCYl0z'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7fObcBw9VM3x7ntWKCYl0z',\n", + " 'id': '7fObcBw9VM3x7ntWKCYl0z',\n", + " 'name': \"Colby O'Donis\",\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7fObcBw9VM3x7ntWKCYl0z'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 241933,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM70807646'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1dzQoRqT5ucxXVaAhTcT0J'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1dzQoRqT5ucxXVaAhTcT0J',\n", + " 'id': '1dzQoRqT5ucxXVaAhTcT0J',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Just Dance',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1dzQoRqT5ucxXVaAhTcT0J'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/6rePArBMb5nLWEaY9aQqL4'},\n", + " 'href': 'https://api.spotify.com/v1/albums/6rePArBMb5nLWEaY9aQqL4',\n", + " 'id': '6rePArBMb5nLWEaY9aQqL4',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b2735c9890c0456a3719eeecd8aa'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e025c9890c0456a3719eeecd8aa'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d000048515c9890c0456a3719eeecd8aa'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Fame Monster (Deluxe Edition)',\n", + " 'release_date': '2009-11-05',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 23,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:6rePArBMb5nLWEaY9aQqL4'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 294573,\n", + " 'explicit': True,\n", + " 'external_ids': {'isrc': 'USUM70918596'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/0SiywuOBRcynK0uKGWdCnn'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/0SiywuOBRcynK0uKGWdCnn',\n", + " 'id': '0SiywuOBRcynK0uKGWdCnn',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Bad Romance',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:0SiywuOBRcynK0uKGWdCnn'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/2MHUaRi9OCyTN02SoyRRBJ'},\n", + " 'href': 'https://api.spotify.com/v1/albums/2MHUaRi9OCyTN02SoyRRBJ',\n", + " 'id': '2MHUaRi9OCyTN02SoyRRBJ',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273b0860cf0a98e09663c82290c'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02b0860cf0a98e09663c82290c'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851b0860cf0a98e09663c82290c'}],\n", + " 'is_playable': True,\n", + " 'name': 'MAYHEM',\n", + " 'release_date': '2025-03-07',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 14,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:2MHUaRi9OCyTN02SoyRRBJ'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 223398,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM72412581'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/2LHNTC9QZxsL3nWpt8iaSR'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/2LHNTC9QZxsL3nWpt8iaSR',\n", + " 'id': '2LHNTC9QZxsL3nWpt8iaSR',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Abracadabra',\n", + " 'track_number': 2,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:2LHNTC9QZxsL3nWpt8iaSR'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/6rePArBMb5nLWEaY9aQqL4'},\n", + " 'href': 'https://api.spotify.com/v1/albums/6rePArBMb5nLWEaY9aQqL4',\n", + " 'id': '6rePArBMb5nLWEaY9aQqL4',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b2735c9890c0456a3719eeecd8aa'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e025c9890c0456a3719eeecd8aa'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d000048515c9890c0456a3719eeecd8aa'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Fame Monster (Deluxe Edition)',\n", + " 'release_date': '2009-11-05',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 23,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:6rePArBMb5nLWEaY9aQqL4'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 274213,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM70905526'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1HHeOs6zRdF8Ck58easiAY'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1HHeOs6zRdF8Ck58easiAY',\n", + " 'id': '1HHeOs6zRdF8Ck58easiAY',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Alejandro',\n", + " 'track_number': 2,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1HHeOs6zRdF8Ck58easiAY'},\n", + " {'album': {'album_type': 'single',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/1KdrtZn2AmuQPHKIr3h4e6'},\n", + " 'href': 'https://api.spotify.com/v1/albums/1KdrtZn2AmuQPHKIr3h4e6',\n", + " 'id': '1KdrtZn2AmuQPHKIr3h4e6',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273d8a389abdf9cb2d03b85ff54'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02d8a389abdf9cb2d03b85ff54'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851d8a389abdf9cb2d03b85ff54'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Dead Dance',\n", + " 'release_date': '2025-09-03',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 1,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:1KdrtZn2AmuQPHKIr3h4e6'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 228518,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM72407034'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/3NFs3XUduzBfvc5Bx1gmzh'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/3NFs3XUduzBfvc5Bx1gmzh',\n", + " 'id': '3NFs3XUduzBfvc5Bx1gmzh',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'The Dead Dance',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:3NFs3XUduzBfvc5Bx1gmzh'},\n", + " {'album': {'album_type': 'single',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/6NQtXhodb5tNerCDXaX3sN'},\n", + " 'href': 'https://api.spotify.com/v1/artists/6NQtXhodb5tNerCDXaX3sN',\n", + " 'id': '6NQtXhodb5tNerCDXaX3sN',\n", + " 'name': 'Stubete Gäng',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:6NQtXhodb5tNerCDXaX3sN'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/5qgjFqo3rO9WM2HIcfX0mg'},\n", + " 'href': 'https://api.spotify.com/v1/albums/5qgjFqo3rO9WM2HIcfX0mg',\n", + " 'id': '5qgjFqo3rO9WM2HIcfX0mg',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273152dea1201467c127f7027fb'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02152dea1201467c127f7027fb'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851152dea1201467c127f7027fb'}],\n", + " 'is_playable': True,\n", + " 'name': 'Richi',\n", + " 'release_date': '2022-05-13',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 5,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:5qgjFqo3rO9WM2HIcfX0mg'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/6NQtXhodb5tNerCDXaX3sN'},\n", + " 'href': 'https://api.spotify.com/v1/artists/6NQtXhodb5tNerCDXaX3sN',\n", + " 'id': '6NQtXhodb5tNerCDXaX3sN',\n", + " 'name': 'Stubete Gäng',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:6NQtXhodb5tNerCDXaX3sN'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 196880,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'CHA142200002'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/49UogtWKIeSutY9yMsAzCT'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/49UogtWKIeSutY9yMsAzCT',\n", + " 'id': '49UogtWKIeSutY9yMsAzCT',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Richi',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:49UogtWKIeSutY9yMsAzCT'}]" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"items\"] #items (actual tracks)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "529fff56-47d3-4d78-8ff5-9530fe290d1d", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "10" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"limit\"]#Limit we have chosen" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "92c64c57-3bd2-4d42-bbd1-84a040f1e02a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'https://api.spotify.com/v1/search?offset=10&limit=10&query=Lady%20Gaga&type=track'" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"next\"] #link to the next page (next 50 tracks)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "f5ccdf79-5d9e-40de-adb9-2cc1e5b7c74a", "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"offset\"] # Actual offset (starting point)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "356730c1-60a2-4ea8-bd2c-e0522bab8a4d", "metadata": {}, "outputs": [], @@ -204,10 +1364,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "id": "7c44c8fd-63ea-45ba-94bd-5c5e8e1458b3", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "18" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"total\"] # Number of matches" ] @@ -222,33 +1393,115 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "id": "6c3541a2-0fd2-41e0-9b27-60a7dc36c4cb", "metadata": { "scrolled": true, "tags": [] }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "{'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/1qwlxZTNLe1jq3b0iidlue'},\n", + " 'href': 'https://api.spotify.com/v1/albums/1qwlxZTNLe1jq3b0iidlue',\n", + " 'id': '1qwlxZTNLe1jq3b0iidlue',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273e691217483df8798445c82e2'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02e691217483df8798445c82e2'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851e691217483df8798445c82e2'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Fame',\n", + " 'release_date': '2008-01-01',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 15,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:1qwlxZTNLe1jq3b0iidlue'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 237200,\n", + " 'explicit': True,\n", + " 'external_ids': {'isrc': 'USUM70824409'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1QV6tiMFM6fSOKOGLMHYYg'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1QV6tiMFM6fSOKOGLMHYYg',\n", + " 'id': '1QV6tiMFM6fSOKOGLMHYYg',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Poker Face',\n", + " 'track_number': 4,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1QV6tiMFM6fSOKOGLMHYYg'}" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"items\"][0] # Explore the first song" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "id": "f2c35eb2-3ea6-4329-9f29-7c062f466638", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['album', 'artists', 'disc_number', 'duration_ms', 'explicit', 'external_ids', 'external_urls', 'href', 'id', 'is_local', 'is_playable', 'name', 'track_number', 'type', 'uri'])" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"items\"][0].keys() # We will focus on album, artists, id, name, popularity, type and uri" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "id": "889ca3c3-b0c8-4037-96fb-6add847f537f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[{'external_urls': {'spotify': 'https://open.spotify.com/artist/1HY2Jd0NmPuamShAr6KMms'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms',\n", + " 'id': '1HY2Jd0NmPuamShAr6KMms',\n", + " 'name': 'Lady Gaga',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1HY2Jd0NmPuamShAr6KMms'}]" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Track artists\n", "results[\"tracks\"][\"items\"][0][\"artists\"] " @@ -256,10 +1509,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "id": "a9c6a0b2-cea7-48ff-8c51-179d15388aa2", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Lady Gaga\n" + ] + } + ], "source": [ "# Track artists names\n", "for artist in results[\"tracks\"][\"items\"][0][\"artists\"]:\n", @@ -268,10 +1529,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "id": "6a826e9c-d2e7-4537-a82c-3dc3a2b80b9f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'1QV6tiMFM6fSOKOGLMHYYg'" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Track ID\n", "results[\"tracks\"][\"items\"][0][\"id\"] " @@ -279,10 +1551,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "id": "a5bd871b-6087-4680-819c-1a1d8ba879bc", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'Poker Face'" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Track name\n", "results[\"tracks\"][\"items\"][0][\"name\"] " @@ -293,12 +1576,54 @@ "execution_count": null, "id": "812661f1-29db-452f-a719-cdfbe95ba9f6", "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "KeyError", + "evalue": "'popularity'", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mKeyError\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[29]\u001b[39m\u001b[32m, line 2\u001b[39m\n\u001b[32m 1\u001b[39m \u001b[38;5;66;03m# Popularity index\u001b[39;00m\n\u001b[32m----> \u001b[39m\u001b[32m2\u001b[39m \u001b[43mresults\u001b[49m\u001b[43m[\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtracks\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m[\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mitems\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m[\u001b[49m\u001b[32;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m[\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mpopularity\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m]\u001b[49m \n", + "\u001b[31mKeyError\u001b[39m: 'popularity'" + ] + } + ], "source": [ + "# ALSO OUTDATED! \n", + "\n", "# Popularity index\n", "results[\"tracks\"][\"items\"][0][\"popularity\"] " ] }, + { + "cell_type": "code", + "execution_count": 31, + "id": "e42baf81", + "metadata": {}, + "outputs": [], + "source": [ + "results[\"tracks\"][\"items\"][0].get(\"popularity\")" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "dbf42acf", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "None\n" + ] + } + ], + "source": [ + "print(results[\"tracks\"][\"items\"][0].get(\"popularity\"))" + ] + }, { "cell_type": "markdown", "id": "0e81c762-e6c5-424e-a4eb-12ab45dffb9f", @@ -315,11 +1640,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "id": "8bcdccfc-dde9-4f4b-8af5-3caa335b89b5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'spotify:track:1QV6tiMFM6fSOKOGLMHYYg'" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ + "\n", "results[\"tracks\"][\"items\"][0][\"uri\"]" ] }, @@ -383,168 +1720,5056 @@ { "cell_type": "code", "execution_count": null, - "id": "29694252-f217-454d-8881-681b2b6eeb1e", + "id": "02fa945a", "metadata": {}, "outputs": [], "source": [ - "# Your answer here" + "# i am switching it up a bit. I am writing code to find my most listend artists." ] }, { "cell_type": "markdown", - "id": "94ad5fdc-22e5-4521-8aa1-c6833eb7e949", + "id": "ce45fed2", "metadata": {}, "source": [ - "## Playlists\n", - "\n", - "The `sp.featured_playlists()` method in `spotipy` fetches a list of Spotify's featured playlists at a given moment. These are curated playlists that Spotify often highlights on the platform's homepage. The method provides a snapshot of the playlists that are being promoted or featured by Spotify at the time of the request.\n", - "\n", - "Once you've fetched the featured playlists, you can extract their IDs (and other details)." + "## 1.1: Fetch Top Tracks\n" ] }, { "cell_type": "code", - "execution_count": null, - "id": "25fb0cf8-c13a-41b0-b8f8-7e0700fd1e41", + "execution_count": 35, + "id": "29694252-f217-454d-8881-681b2b6eeb1e", "metadata": {}, "outputs": [], "source": [ - "sp.featured_playlists() # We get a playlist id of a playlist we like" + "sp_user = spotipy.Spotify(\n", + " auth_manager=SpotifyOAuth(scope=\"user-top-read\")\n", + ")" ] }, { - "cell_type": "markdown", - "id": "90f558f3-c638-4df4-b5a4-e24f7847d52a", + "cell_type": "code", + "execution_count": 36, + "id": "68bb800d", "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'items': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/6gmfGQKmOr9z7GTYK7ecEj'},\n", + " 'href': 'https://api.spotify.com/v1/artists/6gmfGQKmOr9z7GTYK7ecEj',\n", + " 'id': '6gmfGQKmOr9z7GTYK7ecEj',\n", + " 'images': [{'height': 640,\n", + " 'url': 'https://i.scdn.co/image/ab6761610000e5eb0a3a52f40ff854a06a13431b',\n", + " 'width': 640},\n", + " {'height': 320,\n", + " 'url': 'https://i.scdn.co/image/ab676161000051740a3a52f40ff854a06a13431b',\n", + " 'width': 320},\n", + " {'height': 160,\n", + " 'url': 'https://i.scdn.co/image/ab6761610000f1780a3a52f40ff854a06a13431b',\n", + " 'width': 160}],\n", + " 'name': 'Malte Marten',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:6gmfGQKmOr9z7GTYK7ecEj'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'images': [{'height': 640,\n", + " 'url': 'https://i.scdn.co/image/ab6761610000e5eb728ab683976b8c26f85eb3d2',\n", + " 'width': 640},\n", + " {'height': 320,\n", + " 'url': 'https://i.scdn.co/image/ab67616100005174728ab683976b8c26f85eb3d2',\n", + " 'width': 320},\n", + " {'height': 160,\n", + " 'url': 'https://i.scdn.co/image/ab6761610000f178728ab683976b8c26f85eb3d2',\n", + " 'width': 160}],\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/5Y5TRrQiqgUO4S36tzjIRZ'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5Y5TRrQiqgUO4S36tzjIRZ',\n", + " 'id': '5Y5TRrQiqgUO4S36tzjIRZ',\n", + " 'images': [{'height': 640,\n", + " 'url': 'https://i.scdn.co/image/ab6761610000e5ebb713079a55dcf937d241dd2b',\n", + " 'width': 640},\n", + " {'height': 320,\n", + " 'url': 'https://i.scdn.co/image/ab67616100005174b713079a55dcf937d241dd2b',\n", + " 'width': 320},\n", + " {'height': 160,\n", + " 'url': 'https://i.scdn.co/image/ab6761610000f178b713079a55dcf937d241dd2b',\n", + " 'width': 160}],\n", + " 'name': 'Timbaland',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5Y5TRrQiqgUO4S36tzjIRZ'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/7CajNmpbOovFoOoasH2HaY'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7CajNmpbOovFoOoasH2HaY',\n", + " 'id': '7CajNmpbOovFoOoasH2HaY',\n", + " 'images': [{'height': 640,\n", + " 'url': 'https://i.scdn.co/image/ab6761610000e5eb8ebba5e60113b48de8c11f6b',\n", + " 'width': 640},\n", + " {'height': 320,\n", + " 'url': 'https://i.scdn.co/image/ab676161000051748ebba5e60113b48de8c11f6b',\n", + " 'width': 320},\n", + " {'height': 160,\n", + " 'url': 'https://i.scdn.co/image/ab6761610000f1788ebba5e60113b48de8c11f6b',\n", + " 'width': 160}],\n", + " 'name': 'Calvin Harris',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7CajNmpbOovFoOoasH2HaY'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/3TVXtAsR1Inumwj472S9r4'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3TVXtAsR1Inumwj472S9r4',\n", + " 'id': '3TVXtAsR1Inumwj472S9r4',\n", + " 'images': [{'height': 640,\n", + " 'url': 'https://i.scdn.co/image/ab6761610000e5eb4293385d324db8558179afd9',\n", + " 'width': 640},\n", + " {'height': 320,\n", + " 'url': 'https://i.scdn.co/image/ab676161000051744293385d324db8558179afd9',\n", + " 'width': 320},\n", + " {'height': 160,\n", + " 'url': 'https://i.scdn.co/image/ab6761610000f1784293385d324db8558179afd9',\n", + " 'width': 160}],\n", + " 'name': 'Drake',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3TVXtAsR1Inumwj472S9r4'}],\n", + " 'total': 135,\n", + " 'limit': 5,\n", + " 'offset': 0,\n", + " 'href': 'https://api.spotify.com/v1/me/top/artists?offset=0&limit=5&time_range=medium_term',\n", + " 'next': 'https://api.spotify.com/v1/me/top/artists?offset=5&limit=5&time_range=medium_term',\n", + " 'previous': None}" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "### Getting a Playlist's Details\n", - "To fetch details about a specific playlist, you can use the playlist method. You'll need the playlist's Spotify ID." + "sp_user.current_user_top_artists(limit=5)" ] }, { - "cell_type": "markdown", - "id": "0eef529f-617f-4ea3-8156-07472ac8e6d5", + "cell_type": "code", + "execution_count": 37, + "id": "9b3c0b3b", "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Malte Marten', 'Niko B', 'Timbaland', 'Calvin Harris', 'Drake']" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "In this example, we will use the following playlist id: *37i9dQZF1DXd9zR7tdziuQ*" + "[a[\"name\"] for a in sp_user.current_user_top_artists(limit=5)[\"items\"]]" ] }, { "cell_type": "code", "execution_count": null, - "id": "46d35121-9256-4cf4-81f5-118b87f7af32", + "id": "b07422f5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['The Spooks', 'Niko B', 'RÜFÜS DU SOL', 'Clara Lenz', 'Zenaida Tranquilis']" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "playlist_id = \"37i9dQZF1DXd9zR7tdziuQ\"\n", - "playlist = sp.playlist(playlist_id)" + "# top 5 of the last 4 weeks\n", + "[a[\"name\"] for a in sp_user.current_user_top_artists(limit=5, time_range=\"short_term\")[\"items\"]]" ] }, { "cell_type": "code", "execution_count": null, - "id": "5260f67f-6024-4fee-8449-30904f03bf76", + "id": "db873f0e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['Malte Marten', 'Niko B', 'Timbaland', 'Calvin Harris', 'Drake']" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "print(playlist['name']) # Print the playlist's name\n", - "print(playlist['description']) # Print the playlist's description" + "# top 5 of the last 6 months\n", + "[a[\"name\"] for a in sp_user.current_user_top_artists(limit=5, time_range=\"medium_term\")[\"items\"]]" ] }, { - "cell_type": "markdown", - "id": "13bc8631-69f0-4b98-9cc9-5baecbaea9ba", + "cell_type": "code", + "execution_count": null, + "id": "c76f6a92", "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Connor Price', 'Doja Cat', 'T-Bone Walker', 'Kanye West', 'Calvin Harris']" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "### Getting Tracks from a Playlist\n", - "If you want to get the tracks from a specific playlist, you can use the playlist_tracks method." + "# top 5 of the last year (1 year)\n", + "[a[\"name\"] for a in sp_user.current_user_top_artists(limit=5, time_range=\"long_term\")[\"items\"]]" ] }, { "cell_type": "code", - "execution_count": null, - "id": "69c78f8d-7e6a-4d15-bcbb-fc93edb82433", + "execution_count": 42, + "id": "d6182ccf", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['The Spooks', 'Niko B', 'RÜFÜS DU SOL']" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "tracks = sp.playlist_tracks(playlist_id)\n", - "for track in tracks['items']:\n", - " print(track['track']['name']) # Print each track's name" + "# will be using the short term artists\n", + "\n", + "artists = [\"The Spooks\", \"Niko B\", \"RÜFÜS DU SOL\"]\n", + "artists" ] }, { - "cell_type": "markdown", - "id": "2775714d-acc7-4555-96bd-2c541ab0855e", + "cell_type": "code", + "execution_count": 43, + "id": "0400e5bc", "metadata": {}, + "outputs": [], "source": [ - "### Getting Artists from a Playlist\n", - "\n", - "To extract all the artists from the tracks in a playlist, you'd typically follow these steps:\n", - "\n", - "1. Fetch the playlist's tracks.\n", - "2. Iterate through each track.\n", - "3. For each track, extract the associated artists." + "def get_top_tracks(artist_name):\n", + " pass" ] }, { "cell_type": "code", "execution_count": null, - "id": "65c5e5c4-f186-42c6-b136-4ef02b0b01ff", + "id": "84cf652f", "metadata": {}, "outputs": [], "source": [ - "# List to store unique artist names\n", - "artists_list = []\n", - "\n", - "for track_item in tracks['items']:\n", - " track = track_item['track']\n", - " for artist in track['artists']:\n", - " artist_name = artist['name']\n", - " if artist_name not in artists_list: # This ensures each artist is added only once\n", - " artists_list.append(artist_name)\n", - "\n", - "print(artists_list)" + "# OUTDATED, unable to get the top tracks. wil just seach for 5 tracks by the artists." ] }, { - "cell_type": "markdown", - "id": "7b52207e-a4f0-4f90-9f4e-3170d7f0f3fe", + "cell_type": "code", + "execution_count": 60, + "id": "da1e6a81", "metadata": {}, + "outputs": [], "source": [ - "## Exercise 2: Unraveling the World of Playlists\n", - "\n", - "\n", - "1. **Featured Exploration**: \n", - " - Fetch the list of Spotify's current featured playlists. \n", - " - Extract and display the names and IDs of the top 5 featured playlists.\n", - " \n", - "2. **Deep Dive**:\n", - " - Choose any one of the top 5 featured playlists (you can choose the one you personally find most interesting or simply pick one randomly).\n", - " - Fetch and display its name, description, and total track count.\n", - "\n", - "3. **Track-tastic**:\n", - " - Extract and display the names of the first 10 tracks in the chosen playlist.\n", - "\n", - "4. **Artistic Flair**:\n", - " - Create a dictionary where the keys are the names of the first 10 tracks, and the values are lists containing the names of the artists associated with each track.\n", - " - For example: `{\"TrackName1\": [\"Artist1\", \"Artist2\"], \"TrackName2\": [\"Artist3\"]}`\n", - " " + "def get_top_tracks(artist_name):\n", + " results = sp.search(q=f\"artist:{artist_name}\", type=\"track\", limit=10)\n", + " items = results[\"tracks\"][\"items\"]\n", + " \n", + " top_tracks = []\n", + " seen = set()\n", + " \n", + " for track in items:\n", + " if track[\"artists\"][0][\"name\"].lower() == artist_name.lower():\n", + " base_name = track[\"name\"].split(\" - \")[0].lower()\n", + " \n", + " if base_name not in seen:\n", + " seen.add(base_name)\n", + " top_tracks.append(track[\"name\"])\n", + " \n", + " return top_tracks[:5]" ] }, { "cell_type": "code", - "execution_count": null, - "id": "ed92d961-9646-4375-a386-ccc320a958f5", + "execution_count": 61, + "id": "226e5b43", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[\"Things I've Seen\", 'Karma Hotel', 'Sweet Revenge']" + ] + }, + "execution_count": 61, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_top_tracks(\"The Spooks\")" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "id": "79cbbbb8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[]" + ] + }, + "execution_count": 62, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_top_tracks(\"Niko B\")" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "id": "e039dda2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('Bogota', 'Nico Parga'),\n", + " ('Am I Wrong', 'Nico & Vinz'),\n", + " ('Born Again (Babylonia)', 'Sunnery James & Ryan Marciano'),\n", + " ('Body', 'Topic'),\n", + " ('Bach, JS : Well-Tempered Clavier Book 1 : Prelude No.1 in C major BWV846',\n", + " 'Daniel Barenboim')]" + ] + }, + "execution_count": 64, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[(track[\"name\"], track[\"artists\"][0][\"name\"]) for track in sp.search(q=\"artist:Niko B\", type=\"track\", limit=10)[\"tracks\"][\"items\"]]" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "id": "de12ba42", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['You Were Right', 'Innerbloom', 'Sundream', 'On My Knees']" + ] + }, + "execution_count": 63, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_top_tracks(\"RÜFÜS DU SOL\")" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "id": "7458dd6a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'artists': {'href': 'https://api.spotify.com/v1/search?offset=0&limit=5&query=Niko%20B&type=artist',\n", + " 'limit': 5,\n", + " 'next': 'https://api.spotify.com/v1/search?offset=5&limit=5&query=Niko%20B&type=artist',\n", + " 'offset': 0,\n", + " 'previous': None,\n", + " 'total': 11,\n", + " 'items': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab6761610000e5eb728ab683976b8c26f85eb3d2',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616100005174728ab683976b8c26f85eb3d2',\n", + " 'height': 320,\n", + " 'width': 320},\n", + " {'url': 'https://i.scdn.co/image/ab6761610000f178728ab683976b8c26f85eb3d2',\n", + " 'height': 160,\n", + " 'width': 160}],\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/5FDIa7qTDYe2ZWTS33qQr6'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5FDIa7qTDYe2ZWTS33qQr6',\n", + " 'id': '5FDIa7qTDYe2ZWTS33qQr6',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b2739ae77648b83539d120bec771',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e029ae77648b83539d120bec771',\n", + " 'height': 300,\n", + " 'width': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d000048519ae77648b83539d120bec771',\n", + " 'height': 64,\n", + " 'width': 64}],\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5FDIa7qTDYe2ZWTS33qQr6'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/3ECk73S6wLPhgnXcgp2Q1v'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3ECk73S6wLPhgnXcgp2Q1v',\n", + " 'id': '3ECk73S6wLPhgnXcgp2Q1v',\n", + " 'images': [],\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3ECk73S6wLPhgnXcgp2Q1v'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/0wrnukZTYMxB048BvSu2Qd'},\n", + " 'href': 'https://api.spotify.com/v1/artists/0wrnukZTYMxB048BvSu2Qd',\n", + " 'id': '0wrnukZTYMxB048BvSu2Qd',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b273fcb9226ba1cac4b9511aa6e4',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e02fcb9226ba1cac4b9511aa6e4',\n", + " 'height': 300,\n", + " 'width': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00004851fcb9226ba1cac4b9511aa6e4',\n", + " 'height': 64,\n", + " 'width': 64}],\n", + " 'name': 'Niko',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:0wrnukZTYMxB048BvSu2Qd'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/40xbWSB4JPdOkRyuTDy1oP'},\n", + " 'href': 'https://api.spotify.com/v1/artists/40xbWSB4JPdOkRyuTDy1oP',\n", + " 'id': '40xbWSB4JPdOkRyuTDy1oP',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab6761610000e5eb13bcbecd7d8099a9d16403cc',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab6761610000517413bcbecd7d8099a9d16403cc',\n", + " 'height': 320,\n", + " 'width': 320},\n", + " {'url': 'https://i.scdn.co/image/ab6761610000f17813bcbecd7d8099a9d16403cc',\n", + " 'height': 160,\n", + " 'width': 160}],\n", + " 'name': 'Nicole Scherzinger',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:40xbWSB4JPdOkRyuTDy1oP'}]}}" + ] + }, + "execution_count": 65, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sp.search(q=\"Niko B\", type=\"artist\", limit=5)" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "id": "6662a20a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('Niko B', '3GViqleny7XZGug7Ym2Fjk'),\n", + " ('Niko B', '5FDIa7qTDYe2ZWTS33qQr6'),\n", + " ('Niko B', '3ECk73S6wLPhgnXcgp2Q1v'),\n", + " ('Niko', '0wrnukZTYMxB048BvSu2Qd'),\n", + " ('Nicole Scherzinger', '40xbWSB4JPdOkRyuTDy1oP')]" + ] + }, + "execution_count": 66, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[(artist[\"name\"], artist[\"id\"]) for artist in sp.search(q=\"Niko B\", type=\"artist\", limit=5)[\"artists\"][\"items\"]]" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "id": "f8c09ab2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('Niko B', '3GViqleny7XZGug7Ym2Fjk', None),\n", + " ('Niko B', '5FDIa7qTDYe2ZWTS33qQr6', None),\n", + " ('Niko B', '3ECk73S6wLPhgnXcgp2Q1v', None),\n", + " ('Niko', '0wrnukZTYMxB048BvSu2Qd', None),\n", + " ('Nicole Scherzinger', '40xbWSB4JPdOkRyuTDy1oP', None)]" + ] + }, + "execution_count": 68, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[(artist[\"name\"], artist[\"id\"], artist.get(\"followers\", {}).get(\"total\")) \n", + " for artist in sp.search(q=\"Niko B\", type=\"artist\", limit=5)[\"artists\"][\"items\"]]" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "id": "002a2884", "metadata": {}, "outputs": [], "source": [ - "# Your answer here" + "sp_user = spotipy.Spotify(\n", + " auth_manager=SpotifyOAuth(scope=\"user-top-read user-follow-read\")\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "id": "754c70fd", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'artists': {'href': 'https://api.spotify.com/v1/me/following?type=artist&limit=20',\n", + " 'limit': 20,\n", + " 'next': None,\n", + " 'cursors': {'after': None},\n", + " 'total': 5,\n", + " 'items': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab6761610000e5eb728ab683976b8c26f85eb3d2',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616100005174728ab683976b8c26f85eb3d2',\n", + " 'height': 320,\n", + " 'width': 320},\n", + " {'url': 'https://i.scdn.co/image/ab6761610000f178728ab683976b8c26f85eb3d2',\n", + " 'height': 160,\n", + " 'width': 160}],\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/1XwtSHxSZ06XfQ0qah9Rxo'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1XwtSHxSZ06XfQ0qah9Rxo',\n", + " 'id': '1XwtSHxSZ06XfQ0qah9Rxo',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab6761610000e5eb53807605afa98b7fe603f35d',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab6761610000517453807605afa98b7fe603f35d',\n", + " 'height': 320,\n", + " 'width': 320},\n", + " {'url': 'https://i.scdn.co/image/ab6761610000f17853807605afa98b7fe603f35d',\n", + " 'height': 160,\n", + " 'width': 160}],\n", + " 'name': 'KUZKO',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1XwtSHxSZ06XfQ0qah9Rxo'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/2HSmynRDUgRfom3fditkjf'},\n", + " 'href': 'https://api.spotify.com/v1/artists/2HSmynRDUgRfom3fditkjf',\n", + " 'id': '2HSmynRDUgRfom3fditkjf',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab6761610000e5ebed552d9cc50e1420e7ebe6c1',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616100005174ed552d9cc50e1420e7ebe6c1',\n", + " 'height': 320,\n", + " 'width': 320},\n", + " {'url': 'https://i.scdn.co/image/ab6761610000f178ed552d9cc50e1420e7ebe6c1',\n", + " 'height': 160,\n", + " 'width': 160}],\n", + " 'name': 'Bleu Soleil',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:2HSmynRDUgRfom3fditkjf'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/1vIFxAQYAO2gMAJ2rDBWox'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1vIFxAQYAO2gMAJ2rDBWox',\n", + " 'id': '1vIFxAQYAO2gMAJ2rDBWox',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab6761610000e5ebd0abdbac710dea0f120f8f3b',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616100005174d0abdbac710dea0f120f8f3b',\n", + " 'height': 320,\n", + " 'width': 320},\n", + " {'url': 'https://i.scdn.co/image/ab6761610000f178d0abdbac710dea0f120f8f3b',\n", + " 'height': 160,\n", + " 'width': 160}],\n", + " 'name': 'Azuzu',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1vIFxAQYAO2gMAJ2rDBWox'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/2UOx6w3eHpPKc3RBnNV3Rl'},\n", + " 'href': 'https://api.spotify.com/v1/artists/2UOx6w3eHpPKc3RBnNV3Rl',\n", + " 'id': '2UOx6w3eHpPKc3RBnNV3Rl',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab6761610000e5eb9095f6796bf6d78f87d61519',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab676161000051749095f6796bf6d78f87d61519',\n", + " 'height': 320,\n", + " 'width': 320},\n", + " {'url': 'https://i.scdn.co/image/ab6761610000f1789095f6796bf6d78f87d61519',\n", + " 'height': 160,\n", + " 'width': 160}],\n", + " 'name': 'Safri Duo',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:2UOx6w3eHpPKc3RBnNV3Rl'}]}}" + ] + }, + "execution_count": 70, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sp_user.current_user_followed_artists(limit=20)" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "id": "87949b4b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'tracks': {'href': 'https://api.spotify.com/v1/search?offset=0&limit=10&query=artist%3A3GViqleny7XZGug7Ym2Fjk&type=track',\n", + " 'limit': 10,\n", + " 'next': None,\n", + " 'offset': 0,\n", + " 'previous': None,\n", + " 'total': 0,\n", + " 'items': []}}" + ] + }, + "execution_count": 71, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sp.search(q=\"artist:3GViqleny7XZGug7Ym2Fjk\", type=\"track\", limit=10)" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "id": "bd502a36", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk/albums?offset=0&limit=10&include_groups=album,single',\n", + " 'limit': 10,\n", + " 'next': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk/albums?offset=10&limit=10&include_groups=album,single',\n", + " 'offset': 0,\n", + " 'previous': None,\n", + " 'total': 25,\n", + " 'items': [{'album_type': 'album',\n", + " 'total_tracks': 14,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/54YKB5aeBIRCjUe5ssHQzo'},\n", + " 'href': 'https://api.spotify.com/v1/albums/54YKB5aeBIRCjUe5ssHQzo',\n", + " 'id': '54YKB5aeBIRCjUe5ssHQzo',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b273201960bb548107b414d8d6a0',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e02201960bb548107b414d8d6a0',\n", + " 'height': 300,\n", + " 'width': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00004851201960bb548107b414d8d6a0',\n", + " 'height': 64,\n", + " 'width': 64}],\n", + " 'name': 'Cheerleader',\n", + " 'release_date': '2025-10-03',\n", + " 'release_date_precision': 'day',\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:54YKB5aeBIRCjUe5ssHQzo',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}]},\n", + " {'album_type': 'album',\n", + " 'total_tracks': 12,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/1R7Lgw9A3hbcsCVW0yOyuC'},\n", + " 'href': 'https://api.spotify.com/v1/albums/1R7Lgw9A3hbcsCVW0yOyuC',\n", + " 'id': '1R7Lgw9A3hbcsCVW0yOyuC',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b273897eaf086d569c813fed8214',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e02897eaf086d569c813fed8214',\n", + " 'height': 300,\n", + " 'width': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00004851897eaf086d569c813fed8214',\n", + " 'height': 64,\n", + " 'width': 64}],\n", + " 'name': 'dog eat dog food world',\n", + " 'release_date': '2024-05-24',\n", + " 'release_date_precision': 'day',\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:1R7Lgw9A3hbcsCVW0yOyuC',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}]},\n", + " {'album_type': 'single',\n", + " 'total_tracks': 1,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/5863jvz09cXO6f2weVlOGT'},\n", + " 'href': 'https://api.spotify.com/v1/albums/5863jvz09cXO6f2weVlOGT',\n", + " 'id': '5863jvz09cXO6f2weVlOGT',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b27356994109c56fe46b7e36c78e',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e0256994109c56fe46b7e36c78e',\n", + " 'height': 300,\n", + " 'width': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d0000485156994109c56fe46b7e36c78e',\n", + " 'height': 64,\n", + " 'width': 64}],\n", + " 'name': 'Spawn trap',\n", + " 'release_date': '2025-09-25',\n", + " 'release_date_precision': 'day',\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:5863jvz09cXO6f2weVlOGT',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}]},\n", + " {'album_type': 'single',\n", + " 'total_tracks': 1,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/0HawEvinF6MJxXUkJG3363'},\n", + " 'href': 'https://api.spotify.com/v1/albums/0HawEvinF6MJxXUkJG3363',\n", + " 'id': '0HawEvinF6MJxXUkJG3363',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b273ce849e16360d02c3f39f6bc4',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e02ce849e16360d02c3f39f6bc4',\n", + " 'height': 300,\n", + " 'width': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00004851ce849e16360d02c3f39f6bc4',\n", + " 'height': 64,\n", + " 'width': 64}],\n", + " 'name': 'Beginners luck',\n", + " 'release_date': '2025-09-18',\n", + " 'release_date_precision': 'day',\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:0HawEvinF6MJxXUkJG3363',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/4bbAeMRdMbfCLVSlpryAVV'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4bbAeMRdMbfCLVSlpryAVV',\n", + " 'id': '4bbAeMRdMbfCLVSlpryAVV',\n", + " 'name': 'evilgiane',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4bbAeMRdMbfCLVSlpryAVV'}]},\n", + " {'album_type': 'single',\n", + " 'total_tracks': 1,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/6wgCqBacXpplF4Yd73zdWu'},\n", + " 'href': 'https://api.spotify.com/v1/albums/6wgCqBacXpplF4Yd73zdWu',\n", + " 'id': '6wgCqBacXpplF4Yd73zdWu',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b2733c2bffd7860af20a96f7cb7d',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e023c2bffd7860af20a96f7cb7d',\n", + " 'height': 300,\n", + " 'width': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d000048513c2bffd7860af20a96f7cb7d',\n", + " 'height': 64,\n", + " 'width': 64}],\n", + " 'name': 'Mongoose',\n", + " 'release_date': '2025-09-11',\n", + " 'release_date_precision': 'day',\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:6wgCqBacXpplF4Yd73zdWu',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}]},\n", + " {'album_type': 'single',\n", + " 'total_tracks': 3,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/3Vg5gjJi55WgUHbyG1Yp9J'},\n", + " 'href': 'https://api.spotify.com/v1/albums/3Vg5gjJi55WgUHbyG1Yp9J',\n", + " 'id': '3Vg5gjJi55WgUHbyG1Yp9J',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b273ebcf1db1f407341b3f83a9d8',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e02ebcf1db1f407341b3f83a9d8',\n", + " 'height': 300,\n", + " 'width': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00004851ebcf1db1f407341b3f83a9d8',\n", + " 'height': 64,\n", + " 'width': 64}],\n", + " 'name': 'People',\n", + " 'release_date': '2025-06-05',\n", + " 'release_date_precision': 'day',\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:3Vg5gjJi55WgUHbyG1Yp9J',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}]},\n", + " {'album_type': 'single',\n", + " 'total_tracks': 1,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/4YzrFnPfeFs63RrQXOThyx'},\n", + " 'href': 'https://api.spotify.com/v1/albums/4YzrFnPfeFs63RrQXOThyx',\n", + " 'id': '4YzrFnPfeFs63RrQXOThyx',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b2730086f233f5e599b5fbcb3a19',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e020086f233f5e599b5fbcb3a19',\n", + " 'height': 300,\n", + " 'width': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d000048510086f233f5e599b5fbcb3a19',\n", + " 'height': 64,\n", + " 'width': 64}],\n", + " 'name': 'Hairclips',\n", + " 'release_date': '2025-05-22',\n", + " 'release_date_precision': 'day',\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:4YzrFnPfeFs63RrQXOThyx',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}]},\n", + " {'album_type': 'single',\n", + " 'total_tracks': 2,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/2GszWaLbnHGy7LhBBwSfD9'},\n", + " 'href': 'https://api.spotify.com/v1/albums/2GszWaLbnHGy7LhBBwSfD9',\n", + " 'id': '2GszWaLbnHGy7LhBBwSfD9',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b273be1bcfc87b72bb65666c0b91',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e02be1bcfc87b72bb65666c0b91',\n", + " 'height': 300,\n", + " 'width': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00004851be1bcfc87b72bb65666c0b91',\n", + " 'height': 64,\n", + " 'width': 64}],\n", + " 'name': 'just call me',\n", + " 'release_date': '2024-11-21',\n", + " 'release_date_precision': 'day',\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:2GszWaLbnHGy7LhBBwSfD9',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}]},\n", + " {'album_type': 'single',\n", + " 'total_tracks': 1,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/7qQGDOIpEcgmt1VsZ6qkZX'},\n", + " 'href': 'https://api.spotify.com/v1/albums/7qQGDOIpEcgmt1VsZ6qkZX',\n", + " 'id': '7qQGDOIpEcgmt1VsZ6qkZX',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b273a421f20c33dd3f6690d2aa8d',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e02a421f20c33dd3f6690d2aa8d',\n", + " 'height': 300,\n", + " 'width': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00004851a421f20c33dd3f6690d2aa8d',\n", + " 'height': 64,\n", + " 'width': 64}],\n", + " 'name': \"Why's this dealer?\",\n", + " 'release_date': '2024-08-29',\n", + " 'release_date_precision': 'day',\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:7qQGDOIpEcgmt1VsZ6qkZX',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}]},\n", + " {'album_type': 'single',\n", + " 'total_tracks': 3,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/3WgkbnzsD3ykNlCrdvp9mO'},\n", + " 'href': 'https://api.spotify.com/v1/albums/3WgkbnzsD3ykNlCrdvp9mO',\n", + " 'id': '3WgkbnzsD3ykNlCrdvp9mO',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b2736bd398493307642a3019774a',\n", + " 'height': 640,\n", + " 'width': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e026bd398493307642a3019774a',\n", + " 'height': 300,\n", + " 'width': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d000048516bd398493307642a3019774a',\n", + " 'height': 64,\n", + " 'width': 64}],\n", + " 'name': 'boarded the plane',\n", + " 'release_date': '2024-05-02',\n", + " 'release_date_precision': 'day',\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:3WgkbnzsD3ykNlCrdvp9mO',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}]}]}" + ] + }, + "execution_count": 72, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sp.artist_albums(\"3GViqleny7XZGug7Ym2Fjk\", album_type=\"album,single\", limit=10)" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "id": "a03838b7", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('Cheerleader', '54YKB5aeBIRCjUe5ssHQzo'),\n", + " ('dog eat dog food world', '1R7Lgw9A3hbcsCVW0yOyuC'),\n", + " ('Spawn trap', '5863jvz09cXO6f2weVlOGT'),\n", + " ('Beginners luck', '0HawEvinF6MJxXUkJG3363'),\n", + " ('Mongoose', '6wgCqBacXpplF4Yd73zdWu'),\n", + " ('People', '3Vg5gjJi55WgUHbyG1Yp9J'),\n", + " ('Hairclips', '4YzrFnPfeFs63RrQXOThyx'),\n", + " ('just call me', '2GszWaLbnHGy7LhBBwSfD9'),\n", + " (\"Why's this dealer?\", '7qQGDOIpEcgmt1VsZ6qkZX'),\n", + " ('boarded the plane', '3WgkbnzsD3ykNlCrdvp9mO')]" + ] + }, + "execution_count": 73, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[(album[\"name\"], album[\"id\"]) for album in sp.artist_albums(\"3GViqleny7XZGug7Ym2Fjk\", album_type=\"album,single\", limit=10)[\"items\"]]" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "id": "c06f36c8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'href': 'https://api.spotify.com/v1/albums/54YKB5aeBIRCjUe5ssHQzo/tracks?offset=0&limit=50',\n", + " 'items': [{'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/4bbAeMRdMbfCLVSlpryAVV'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4bbAeMRdMbfCLVSlpryAVV',\n", + " 'id': '4bbAeMRdMbfCLVSlpryAVV',\n", + " 'name': 'evilgiane',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4bbAeMRdMbfCLVSlpryAVV'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 96000,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/38Hx96xEHcnPh1HAUuM6Or'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/38Hx96xEHcnPh1HAUuM6Or',\n", + " 'id': '38Hx96xEHcnPh1HAUuM6Or',\n", + " 'name': 'Beginners luck',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:38Hx96xEHcnPh1HAUuM6Or',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 70400,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/0qu3ACa6KmQGY4ceCy3Q3n'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/0qu3ACa6KmQGY4ceCy3Q3n',\n", + " 'id': '0qu3ACa6KmQGY4ceCy3Q3n',\n", + " 'name': 'Mongoose',\n", + " 'track_number': 2,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:0qu3ACa6KmQGY4ceCy3Q3n',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 93333,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/594b0JPsGMkbshF2PVfmbH'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/594b0JPsGMkbshF2PVfmbH',\n", + " 'id': '594b0JPsGMkbshF2PVfmbH',\n", + " 'name': 'Shoebox',\n", + " 'track_number': 3,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:594b0JPsGMkbshF2PVfmbH',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 110000,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/5DM6eipJd3vkbcSDAyrqg3'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/5DM6eipJd3vkbcSDAyrqg3',\n", + " 'id': '5DM6eipJd3vkbcSDAyrqg3',\n", + " 'name': 'Spawn trap',\n", + " 'track_number': 4,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:5DM6eipJd3vkbcSDAyrqg3',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 100000,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/4KUGhfV9KrS6qY94dNt1Fv'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/4KUGhfV9KrS6qY94dNt1Fv',\n", + " 'id': '4KUGhfV9KrS6qY94dNt1Fv',\n", + " 'name': 'X Factor',\n", + " 'track_number': 5,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:4KUGhfV9KrS6qY94dNt1Fv',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/4DnRQspXhzqgCMkJJmOS4T'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4DnRQspXhzqgCMkJJmOS4T',\n", + " 'id': '4DnRQspXhzqgCMkJJmOS4T',\n", + " 'name': 'RealYungPhil',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4DnRQspXhzqgCMkJJmOS4T'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 118581,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/54BQmWZqogEZewQzxYAaLx'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/54BQmWZqogEZewQzxYAaLx',\n", + " 'id': '54BQmWZqogEZewQzxYAaLx',\n", + " 'name': 'Bolbeck',\n", + " 'track_number': 6,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:54BQmWZqogEZewQzxYAaLx',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 98405,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/7sZ9IdFPv0GkiIrvTdzPvs'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/7sZ9IdFPv0GkiIrvTdzPvs',\n", + " 'id': '7sZ9IdFPv0GkiIrvTdzPvs',\n", + " 'name': 'Polka dot',\n", + " 'track_number': 7,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:7sZ9IdFPv0GkiIrvTdzPvs',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 92689,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1nIDeQzUhORAMNRjbS3Ymx'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1nIDeQzUhORAMNRjbS3Ymx',\n", + " 'id': '1nIDeQzUhORAMNRjbS3Ymx',\n", + " 'name': 'Sellit!',\n", + " 'track_number': 8,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1nIDeQzUhORAMNRjbS3Ymx',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 75009,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/7zYftpJxjErQqJF8LyWf6H'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/7zYftpJxjErQqJF8LyWf6H',\n", + " 'id': '7zYftpJxjErQqJF8LyWf6H',\n", + " 'name': 'Ringing a bell?',\n", + " 'track_number': 9,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:7zYftpJxjErQqJF8LyWf6H',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 85500,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/0sRivswLhrqO13mhHYfFz1'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/0sRivswLhrqO13mhHYfFz1',\n", + " 'id': '0sRivswLhrqO13mhHYfFz1',\n", + " 'name': 'Stunt jump',\n", + " 'track_number': 10,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:0sRivswLhrqO13mhHYfFz1',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/1ydrXEREujBSvcKzQt1SNS'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1ydrXEREujBSvcKzQt1SNS',\n", + " 'id': '1ydrXEREujBSvcKzQt1SNS',\n", + " 'name': 'S5',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1ydrXEREujBSvcKzQt1SNS'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 137142,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/3MdWCisjj4ylfkBQjMzLpz'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/3MdWCisjj4ylfkBQjMzLpz',\n", + " 'id': '3MdWCisjj4ylfkBQjMzLpz',\n", + " 'name': 'Take five',\n", + " 'track_number': 11,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:3MdWCisjj4ylfkBQjMzLpz',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/2G3moO7hc1jXWYKkW5ZYw4'},\n", + " 'href': 'https://api.spotify.com/v1/artists/2G3moO7hc1jXWYKkW5ZYw4',\n", + " 'id': '2G3moO7hc1jXWYKkW5ZYw4',\n", + " 'name': 'Dimzy',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:2G3moO7hc1jXWYKkW5ZYw4'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 127741,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1s26dpRZ5kto4SjFnTUZfW'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1s26dpRZ5kto4SjFnTUZfW',\n", + " 'id': '1s26dpRZ5kto4SjFnTUZfW',\n", + " 'name': 'Pop world',\n", + " 'track_number': 12,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1s26dpRZ5kto4SjFnTUZfW',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 66976,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/7FrOVzjJgr7qRHUNLK6Wye'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/7FrOVzjJgr7qRHUNLK6Wye',\n", + " 'id': '7FrOVzjJgr7qRHUNLK6Wye',\n", + " 'name': 'Hermes stock',\n", + " 'track_number': 13,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:7FrOVzjJgr7qRHUNLK6Wye',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 107000,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1DxpZfrlMm8V9kFq6pKgAd'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1DxpZfrlMm8V9kFq6pKgAd',\n", + " 'id': '1DxpZfrlMm8V9kFq6pKgAd',\n", + " 'name': 'They could fly',\n", + " 'track_number': 14,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1DxpZfrlMm8V9kFq6pKgAd',\n", + " 'is_local': False}],\n", + " 'limit': 50,\n", + " 'next': None,\n", + " 'offset': 0,\n", + " 'previous': None,\n", + " 'total': 14}" + ] + }, + "execution_count": 74, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sp.album_tracks(\"54YKB5aeBIRCjUe5ssHQzo\")" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "id": "4f5b9e13", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('Beginners luck', '38Hx96xEHcnPh1HAUuM6Or'),\n", + " ('Mongoose', '0qu3ACa6KmQGY4ceCy3Q3n'),\n", + " ('Shoebox', '594b0JPsGMkbshF2PVfmbH'),\n", + " ('Spawn trap', '5DM6eipJd3vkbcSDAyrqg3'),\n", + " ('X Factor', '4KUGhfV9KrS6qY94dNt1Fv'),\n", + " ('Bolbeck', '54BQmWZqogEZewQzxYAaLx'),\n", + " ('Polka dot', '7sZ9IdFPv0GkiIrvTdzPvs'),\n", + " ('Sellit!', '1nIDeQzUhORAMNRjbS3Ymx'),\n", + " ('Ringing a bell?', '7zYftpJxjErQqJF8LyWf6H'),\n", + " ('Stunt jump', '0sRivswLhrqO13mhHYfFz1'),\n", + " ('Take five', '3MdWCisjj4ylfkBQjMzLpz'),\n", + " ('Pop world', '1s26dpRZ5kto4SjFnTUZfW'),\n", + " ('Hermes stock', '7FrOVzjJgr7qRHUNLK6Wye'),\n", + " ('They could fly', '1DxpZfrlMm8V9kFq6pKgAd')]" + ] + }, + "execution_count": 75, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[(track[\"name\"], track[\"id\"]) for track in sp.album_tracks(\"54YKB5aeBIRCjUe5ssHQzo\")[\"items\"]]" ] + }, + { + "cell_type": "code", + "execution_count": 55, + "id": "95137645", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[(\"Things I've Seen\", 'The Spooks'),\n", + " (\"Things I've Seen - Radio Edit\", 'The Spooks'),\n", + " ('Karma Hotel', 'The Spooks'),\n", + " ('After All This Time', 'The Beautiful Girls'),\n", + " (\"Surfin' Spooks\", 'The Ghastly Ones')]" + ] + }, + "execution_count": 55, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[(track[\"name\"], track[\"artists\"][0][\"name\"]) for track in get_top_tracks(\"The Spooks\")[\"tracks\"][\"items\"]]" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "id": "1070f8c6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('trespass coat', '1Eh9UAAcmnp1FkHVKd5YiZ'),\n", + " (\"i've smoked weed 9 times and have had one good experience\",\n", + " '2ASmnL98h6LZR1yegIBUR4'),\n", + " ('ur a bundle of joy !', '3XHo6fOc3QA2t6MHrpcG5w'),\n", + " ('boarded the plane', '5aRE1vaOYKpVg31uzMncox'),\n", + " ('tom did', '2lO39qQBWboFE5ob4Hr57t'),\n", + " ('miniclip', '4fXTZEhh5aQGrehhmqNmrw'),\n", + " (\"it's not litter if you bin it\", '6CO5jaNwuiZJ0rlwMBeVSm'),\n", + " (\"i'm just a pretty face\", '7tSdrqC7wA2lQRCAzBxoGm'),\n", + " ('dagenham to barking', '2Piyg3sAInIFan45ZxrBOz'),\n", + " ('what counts as fine?', '4CzKooL9wpNfjYOCpTYBJN'),\n", + " ('forteen days', '55CDgftjyLxEth0jef6Soe'),\n", + " (\"who's in designer\", '77e1seHNK7HwyjQy7tNf5i')]" + ] + }, + "execution_count": 76, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[(track[\"name\"], track[\"id\"]) for track in sp.album_tracks(\"1R7Lgw9A3hbcsCVW0yOyuC\")[\"items\"]]" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "id": "76c11a4f", + "metadata": {}, + "outputs": [], + "source": [ + "album_ids = [album[\"id\"] for album in sp.artist_albums(\"3GViqleny7XZGug7Ym2Fjk\", album_type=\"album,single\", limit=10)[\"items\"]]" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "id": "aac87f30", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['54YKB5aeBIRCjUe5ssHQzo',\n", + " '1R7Lgw9A3hbcsCVW0yOyuC',\n", + " '5863jvz09cXO6f2weVlOGT',\n", + " '0HawEvinF6MJxXUkJG3363',\n", + " '6wgCqBacXpplF4Yd73zdWu',\n", + " '3Vg5gjJi55WgUHbyG1Yp9J',\n", + " '4YzrFnPfeFs63RrQXOThyx',\n", + " '2GszWaLbnHGy7LhBBwSfD9',\n", + " '7qQGDOIpEcgmt1VsZ6qkZX',\n", + " '3WgkbnzsD3ykNlCrdvp9mO']" + ] + }, + "execution_count": 78, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "album_ids" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "id": "b5a0896f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'href': 'https://api.spotify.com/v1/albums/54YKB5aeBIRCjUe5ssHQzo/tracks?offset=0&limit=50',\n", + " 'items': [{'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/4bbAeMRdMbfCLVSlpryAVV'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4bbAeMRdMbfCLVSlpryAVV',\n", + " 'id': '4bbAeMRdMbfCLVSlpryAVV',\n", + " 'name': 'evilgiane',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4bbAeMRdMbfCLVSlpryAVV'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 96000,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/38Hx96xEHcnPh1HAUuM6Or'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/38Hx96xEHcnPh1HAUuM6Or',\n", + " 'id': '38Hx96xEHcnPh1HAUuM6Or',\n", + " 'name': 'Beginners luck',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:38Hx96xEHcnPh1HAUuM6Or',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 70400,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/0qu3ACa6KmQGY4ceCy3Q3n'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/0qu3ACa6KmQGY4ceCy3Q3n',\n", + " 'id': '0qu3ACa6KmQGY4ceCy3Q3n',\n", + " 'name': 'Mongoose',\n", + " 'track_number': 2,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:0qu3ACa6KmQGY4ceCy3Q3n',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 93333,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/594b0JPsGMkbshF2PVfmbH'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/594b0JPsGMkbshF2PVfmbH',\n", + " 'id': '594b0JPsGMkbshF2PVfmbH',\n", + " 'name': 'Shoebox',\n", + " 'track_number': 3,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:594b0JPsGMkbshF2PVfmbH',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 110000,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/5DM6eipJd3vkbcSDAyrqg3'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/5DM6eipJd3vkbcSDAyrqg3',\n", + " 'id': '5DM6eipJd3vkbcSDAyrqg3',\n", + " 'name': 'Spawn trap',\n", + " 'track_number': 4,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:5DM6eipJd3vkbcSDAyrqg3',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 100000,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/4KUGhfV9KrS6qY94dNt1Fv'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/4KUGhfV9KrS6qY94dNt1Fv',\n", + " 'id': '4KUGhfV9KrS6qY94dNt1Fv',\n", + " 'name': 'X Factor',\n", + " 'track_number': 5,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:4KUGhfV9KrS6qY94dNt1Fv',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/4DnRQspXhzqgCMkJJmOS4T'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4DnRQspXhzqgCMkJJmOS4T',\n", + " 'id': '4DnRQspXhzqgCMkJJmOS4T',\n", + " 'name': 'RealYungPhil',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4DnRQspXhzqgCMkJJmOS4T'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 118581,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/54BQmWZqogEZewQzxYAaLx'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/54BQmWZqogEZewQzxYAaLx',\n", + " 'id': '54BQmWZqogEZewQzxYAaLx',\n", + " 'name': 'Bolbeck',\n", + " 'track_number': 6,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:54BQmWZqogEZewQzxYAaLx',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 98405,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/7sZ9IdFPv0GkiIrvTdzPvs'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/7sZ9IdFPv0GkiIrvTdzPvs',\n", + " 'id': '7sZ9IdFPv0GkiIrvTdzPvs',\n", + " 'name': 'Polka dot',\n", + " 'track_number': 7,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:7sZ9IdFPv0GkiIrvTdzPvs',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 92689,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1nIDeQzUhORAMNRjbS3Ymx'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1nIDeQzUhORAMNRjbS3Ymx',\n", + " 'id': '1nIDeQzUhORAMNRjbS3Ymx',\n", + " 'name': 'Sellit!',\n", + " 'track_number': 8,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1nIDeQzUhORAMNRjbS3Ymx',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 75009,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/7zYftpJxjErQqJF8LyWf6H'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/7zYftpJxjErQqJF8LyWf6H',\n", + " 'id': '7zYftpJxjErQqJF8LyWf6H',\n", + " 'name': 'Ringing a bell?',\n", + " 'track_number': 9,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:7zYftpJxjErQqJF8LyWf6H',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 85500,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/0sRivswLhrqO13mhHYfFz1'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/0sRivswLhrqO13mhHYfFz1',\n", + " 'id': '0sRivswLhrqO13mhHYfFz1',\n", + " 'name': 'Stunt jump',\n", + " 'track_number': 10,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:0sRivswLhrqO13mhHYfFz1',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/1ydrXEREujBSvcKzQt1SNS'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1ydrXEREujBSvcKzQt1SNS',\n", + " 'id': '1ydrXEREujBSvcKzQt1SNS',\n", + " 'name': 'S5',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1ydrXEREujBSvcKzQt1SNS'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 137142,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/3MdWCisjj4ylfkBQjMzLpz'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/3MdWCisjj4ylfkBQjMzLpz',\n", + " 'id': '3MdWCisjj4ylfkBQjMzLpz',\n", + " 'name': 'Take five',\n", + " 'track_number': 11,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:3MdWCisjj4ylfkBQjMzLpz',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/2G3moO7hc1jXWYKkW5ZYw4'},\n", + " 'href': 'https://api.spotify.com/v1/artists/2G3moO7hc1jXWYKkW5ZYw4',\n", + " 'id': '2G3moO7hc1jXWYKkW5ZYw4',\n", + " 'name': 'Dimzy',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:2G3moO7hc1jXWYKkW5ZYw4'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 127741,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1s26dpRZ5kto4SjFnTUZfW'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1s26dpRZ5kto4SjFnTUZfW',\n", + " 'id': '1s26dpRZ5kto4SjFnTUZfW',\n", + " 'name': 'Pop world',\n", + " 'track_number': 12,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1s26dpRZ5kto4SjFnTUZfW',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 66976,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/7FrOVzjJgr7qRHUNLK6Wye'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/7FrOVzjJgr7qRHUNLK6Wye',\n", + " 'id': '7FrOVzjJgr7qRHUNLK6Wye',\n", + " 'name': 'Hermes stock',\n", + " 'track_number': 13,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:7FrOVzjJgr7qRHUNLK6Wye',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 107000,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1DxpZfrlMm8V9kFq6pKgAd'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1DxpZfrlMm8V9kFq6pKgAd',\n", + " 'id': '1DxpZfrlMm8V9kFq6pKgAd',\n", + " 'name': 'They could fly',\n", + " 'track_number': 14,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1DxpZfrlMm8V9kFq6pKgAd',\n", + " 'is_local': False}],\n", + " 'limit': 50,\n", + " 'next': None,\n", + " 'offset': 0,\n", + " 'previous': None,\n", + " 'total': 14}" + ] + }, + "execution_count": 79, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sp.album_tracks(album_ids[0])" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "id": "311c17ce", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'href': 'https://api.spotify.com/v1/albums/54YKB5aeBIRCjUe5ssHQzo/tracks?offset=0&limit=50',\n", + " 'items': [{'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/4bbAeMRdMbfCLVSlpryAVV'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4bbAeMRdMbfCLVSlpryAVV',\n", + " 'id': '4bbAeMRdMbfCLVSlpryAVV',\n", + " 'name': 'evilgiane',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4bbAeMRdMbfCLVSlpryAVV'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 96000,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/38Hx96xEHcnPh1HAUuM6Or'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/38Hx96xEHcnPh1HAUuM6Or',\n", + " 'id': '38Hx96xEHcnPh1HAUuM6Or',\n", + " 'name': 'Beginners luck',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:38Hx96xEHcnPh1HAUuM6Or',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 70400,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/0qu3ACa6KmQGY4ceCy3Q3n'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/0qu3ACa6KmQGY4ceCy3Q3n',\n", + " 'id': '0qu3ACa6KmQGY4ceCy3Q3n',\n", + " 'name': 'Mongoose',\n", + " 'track_number': 2,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:0qu3ACa6KmQGY4ceCy3Q3n',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 93333,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/594b0JPsGMkbshF2PVfmbH'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/594b0JPsGMkbshF2PVfmbH',\n", + " 'id': '594b0JPsGMkbshF2PVfmbH',\n", + " 'name': 'Shoebox',\n", + " 'track_number': 3,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:594b0JPsGMkbshF2PVfmbH',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 110000,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/5DM6eipJd3vkbcSDAyrqg3'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/5DM6eipJd3vkbcSDAyrqg3',\n", + " 'id': '5DM6eipJd3vkbcSDAyrqg3',\n", + " 'name': 'Spawn trap',\n", + " 'track_number': 4,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:5DM6eipJd3vkbcSDAyrqg3',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 100000,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/4KUGhfV9KrS6qY94dNt1Fv'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/4KUGhfV9KrS6qY94dNt1Fv',\n", + " 'id': '4KUGhfV9KrS6qY94dNt1Fv',\n", + " 'name': 'X Factor',\n", + " 'track_number': 5,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:4KUGhfV9KrS6qY94dNt1Fv',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/4DnRQspXhzqgCMkJJmOS4T'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4DnRQspXhzqgCMkJJmOS4T',\n", + " 'id': '4DnRQspXhzqgCMkJJmOS4T',\n", + " 'name': 'RealYungPhil',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4DnRQspXhzqgCMkJJmOS4T'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 118581,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/54BQmWZqogEZewQzxYAaLx'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/54BQmWZqogEZewQzxYAaLx',\n", + " 'id': '54BQmWZqogEZewQzxYAaLx',\n", + " 'name': 'Bolbeck',\n", + " 'track_number': 6,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:54BQmWZqogEZewQzxYAaLx',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 98405,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/7sZ9IdFPv0GkiIrvTdzPvs'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/7sZ9IdFPv0GkiIrvTdzPvs',\n", + " 'id': '7sZ9IdFPv0GkiIrvTdzPvs',\n", + " 'name': 'Polka dot',\n", + " 'track_number': 7,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:7sZ9IdFPv0GkiIrvTdzPvs',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 92689,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1nIDeQzUhORAMNRjbS3Ymx'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1nIDeQzUhORAMNRjbS3Ymx',\n", + " 'id': '1nIDeQzUhORAMNRjbS3Ymx',\n", + " 'name': 'Sellit!',\n", + " 'track_number': 8,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1nIDeQzUhORAMNRjbS3Ymx',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 75009,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/7zYftpJxjErQqJF8LyWf6H'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/7zYftpJxjErQqJF8LyWf6H',\n", + " 'id': '7zYftpJxjErQqJF8LyWf6H',\n", + " 'name': 'Ringing a bell?',\n", + " 'track_number': 9,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:7zYftpJxjErQqJF8LyWf6H',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 85500,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/0sRivswLhrqO13mhHYfFz1'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/0sRivswLhrqO13mhHYfFz1',\n", + " 'id': '0sRivswLhrqO13mhHYfFz1',\n", + " 'name': 'Stunt jump',\n", + " 'track_number': 10,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:0sRivswLhrqO13mhHYfFz1',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/1ydrXEREujBSvcKzQt1SNS'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1ydrXEREujBSvcKzQt1SNS',\n", + " 'id': '1ydrXEREujBSvcKzQt1SNS',\n", + " 'name': 'S5',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1ydrXEREujBSvcKzQt1SNS'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 137142,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/3MdWCisjj4ylfkBQjMzLpz'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/3MdWCisjj4ylfkBQjMzLpz',\n", + " 'id': '3MdWCisjj4ylfkBQjMzLpz',\n", + " 'name': 'Take five',\n", + " 'track_number': 11,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:3MdWCisjj4ylfkBQjMzLpz',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/2G3moO7hc1jXWYKkW5ZYw4'},\n", + " 'href': 'https://api.spotify.com/v1/artists/2G3moO7hc1jXWYKkW5ZYw4',\n", + " 'id': '2G3moO7hc1jXWYKkW5ZYw4',\n", + " 'name': 'Dimzy',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:2G3moO7hc1jXWYKkW5ZYw4'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 127741,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1s26dpRZ5kto4SjFnTUZfW'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1s26dpRZ5kto4SjFnTUZfW',\n", + " 'id': '1s26dpRZ5kto4SjFnTUZfW',\n", + " 'name': 'Pop world',\n", + " 'track_number': 12,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1s26dpRZ5kto4SjFnTUZfW',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 66976,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/7FrOVzjJgr7qRHUNLK6Wye'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/7FrOVzjJgr7qRHUNLK6Wye',\n", + " 'id': '7FrOVzjJgr7qRHUNLK6Wye',\n", + " 'name': 'Hermes stock',\n", + " 'track_number': 13,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:7FrOVzjJgr7qRHUNLK6Wye',\n", + " 'is_local': False},\n", + " {'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3GViqleny7XZGug7Ym2Fjk'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk',\n", + " 'id': '3GViqleny7XZGug7Ym2Fjk',\n", + " 'name': 'Niko B',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3GViqleny7XZGug7Ym2Fjk'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 107000,\n", + " 'explicit': False,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1DxpZfrlMm8V9kFq6pKgAd'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1DxpZfrlMm8V9kFq6pKgAd',\n", + " 'id': '1DxpZfrlMm8V9kFq6pKgAd',\n", + " 'name': 'They could fly',\n", + " 'track_number': 14,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1DxpZfrlMm8V9kFq6pKgAd',\n", + " 'is_local': False}],\n", + " 'limit': 50,\n", + " 'next': None,\n", + " 'offset': 0,\n", + " 'previous': None,\n", + " 'total': 14}" + ] + }, + "execution_count": 80, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sp.album_tracks(album_ids[0])" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "id": "b20fc1bb", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Beginners luck',\n", + " 'Mongoose',\n", + " 'Shoebox',\n", + " 'Spawn trap',\n", + " 'X Factor',\n", + " 'Bolbeck',\n", + " 'Polka dot',\n", + " 'Sellit!',\n", + " 'Ringing a bell?',\n", + " 'Stunt jump',\n", + " 'Take five',\n", + " 'Pop world',\n", + " 'Hermes stock',\n", + " 'They could fly']" + ] + }, + "execution_count": 81, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[track[\"name\"] for track in sp.album_tracks(album_ids[0])[\"items\"]]" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "id": "3572bbbc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Beginners luck',\n", + " 'Mongoose',\n", + " 'Shoebox',\n", + " 'Spawn trap',\n", + " 'X Factor',\n", + " 'Bolbeck',\n", + " 'Polka dot',\n", + " 'Sellit!',\n", + " 'Ringing a bell?',\n", + " 'Stunt jump',\n", + " 'Take five',\n", + " 'Pop world',\n", + " 'Hermes stock',\n", + " 'They could fly',\n", + " 'trespass coat',\n", + " \"i've smoked weed 9 times and have had one good experience\",\n", + " 'ur a bundle of joy !',\n", + " 'boarded the plane',\n", + " 'tom did',\n", + " 'miniclip',\n", + " \"it's not litter if you bin it\",\n", + " \"i'm just a pretty face\",\n", + " 'dagenham to barking',\n", + " 'what counts as fine?',\n", + " 'forteen days',\n", + " \"who's in designer\"]" + ] + }, + "execution_count": 82, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "all_tracks = []\n", + "\n", + "for album_id in album_ids[:2]:\n", + " tracks = sp.album_tracks(album_id)[\"items\"]\n", + " for track in tracks:\n", + " all_tracks.append(track[\"name\"])\n", + "\n", + "all_tracks" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "id": "e4ff2155", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Beginners luck',\n", + " 'Mongoose',\n", + " 'Shoebox',\n", + " 'Spawn trap',\n", + " 'X Factor',\n", + " 'Bolbeck',\n", + " 'Polka dot',\n", + " 'Sellit!',\n", + " 'Ringing a bell?',\n", + " 'Stunt jump',\n", + " 'Take five',\n", + " 'Pop world',\n", + " 'Hermes stock',\n", + " 'They could fly',\n", + " 'trespass coat',\n", + " \"i've smoked weed 9 times and have had one good experience\",\n", + " 'ur a bundle of joy !',\n", + " 'boarded the plane',\n", + " 'tom did',\n", + " 'miniclip',\n", + " \"it's not litter if you bin it\",\n", + " \"i'm just a pretty face\",\n", + " 'dagenham to barking',\n", + " 'what counts as fine?',\n", + " 'forteen days',\n", + " \"who's in designer\"]" + ] + }, + "execution_count": 83, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "unique_tracks = list(dict.fromkeys(all_tracks))\n", + "unique_tracks" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "id": "1dac70d7", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Beginners luck', 'Mongoose', 'Shoebox', 'Spawn trap', 'X Factor']" + ] + }, + "execution_count": 84, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "unique_tracks[:5]" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "id": "a14506e1", + "metadata": {}, + "outputs": [], + "source": [ + "def get_top_tracks_from_artist_id(artist_id):\n", + " album_ids = [album[\"id\"] for album in sp.artist_albums(artist_id, album_type=\"album,single\", limit=10)[\"items\"]]\n", + " \n", + " all_tracks = []\n", + " \n", + " for album_id in album_ids[:2]:\n", + " tracks = sp.album_tracks(album_id)[\"items\"]\n", + " for track in tracks:\n", + " all_tracks.append(track[\"name\"])\n", + " \n", + " unique_tracks = list(dict.fromkeys(all_tracks))\n", + " return unique_tracks[:5]" + ] + }, + { + "cell_type": "code", + "execution_count": 86, + "id": "5671a3eb", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Beginners luck', 'Mongoose', 'Shoebox', 'Spawn trap', 'X Factor']" + ] + }, + "execution_count": 86, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_top_tracks_from_artist_id(\"3GViqleny7XZGug7Ym2Fjk\")" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "id": "9c76e445", + "metadata": {}, + "outputs": [], + "source": [ + "def get_artist_id(artist_name):\n", + " results = sp.search(q=artist_name, type=\"artist\", limit=1)\n", + " return results[\"artists\"][\"items\"][0][\"id\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "id": "acd2a871", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'5UEdalZXwxU3mzNl1xWr5y'" + ] + }, + "execution_count": 88, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_artist_id(\"The Spooks\")" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "id": "8d0f02f5", + "metadata": {}, + "outputs": [], + "source": [ + "def get_top_tracks(artist_name):\n", + " artist_id = get_artist_id(artist_name)\n", + " return get_top_tracks_from_artist_id(artist_id)" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "id": "784bdcf8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Other Script',\n", + " 'The Mission',\n", + " \"Things I've Seen\",\n", + " \"They Don't Know\",\n", + " 'I Got U']" + ] + }, + "execution_count": 90, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_top_tracks(\"The Spooks\")" + ] + }, + { + "cell_type": "code", + "execution_count": 92, + "id": "fc3383b7", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Beginners luck', 'Mongoose', 'Shoebox', 'Spawn trap', 'X Factor']" + ] + }, + "execution_count": 92, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_top_tracks(\"Niko B\")" + ] + }, + { + "cell_type": "code", + "execution_count": 93, + "id": "ad142f4c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Part Of You', 'Shallow Water', 'Afters', 'Sunshine', 'Ain’t Losing You']" + ] + }, + "execution_count": 93, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_top_tracks(\"RÜFÜS DU SOL\")" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "id": "385bab3c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[['Other Script',\n", + " 'The Mission',\n", + " \"Things I've Seen\",\n", + " \"They Don't Know\",\n", + " 'I Got U'],\n", + " ['Beginners luck', 'Mongoose', 'Shoebox', 'Spawn trap', 'X Factor'],\n", + " ['Part Of You', 'Shallow Water', 'Afters', 'Sunshine', 'Ain’t Losing You']]" + ] + }, + "execution_count": 94, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "top_tracks_list = [get_top_tracks(artist) for artist in artists]\n", + "top_tracks_list" + ] + }, + { + "cell_type": "markdown", + "id": "f747c89f", + "metadata": {}, + "source": [ + "## 1.2: Discover Related Artists" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0aa4cf74", + "metadata": {}, + "outputs": [], + "source": [ + "# OUTDATED; unable to get related artists" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "id": "96ce18d8", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "HTTP Error for GET to https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk/related-artists with Params: {} returned 403 due to Forbidden\n" + ] + }, + { + "ename": "SpotifyException", + "evalue": "http status: 403, code: -1 - https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk/related-artists:\n Forbidden, reason: None", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mHTTPError\u001b[39m Traceback (most recent call last)", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:271\u001b[39m, in \u001b[36mSpotify._internal_call\u001b[39m\u001b[34m(self, method, url, payload, params)\u001b[39m\n\u001b[32m 266\u001b[39m response = \u001b[38;5;28mself\u001b[39m._session.request(\n\u001b[32m 267\u001b[39m method, url, headers=headers, proxies=\u001b[38;5;28mself\u001b[39m.proxies,\n\u001b[32m 268\u001b[39m timeout=\u001b[38;5;28mself\u001b[39m.requests_timeout, **args\n\u001b[32m 269\u001b[39m )\n\u001b[32m--> \u001b[39m\u001b[32m271\u001b[39m \u001b[43mresponse\u001b[49m\u001b[43m.\u001b[49m\u001b[43mraise_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 272\u001b[39m results = response.json()\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/requests/models.py:1026\u001b[39m, in \u001b[36mResponse.raise_for_status\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 1025\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m http_error_msg:\n\u001b[32m-> \u001b[39m\u001b[32m1026\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m HTTPError(http_error_msg, response=\u001b[38;5;28mself\u001b[39m)\n", + "\u001b[31mHTTPError\u001b[39m: 403 Client Error: Forbidden for url: https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk/related-artists", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[31mSpotifyException\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[95]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[43msp\u001b[49m\u001b[43m.\u001b[49m\u001b[43martist_related_artists\u001b[49m\u001b[43m(\u001b[49m\u001b[43mget_artist_id\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mNiko B\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:473\u001b[39m, in \u001b[36mSpotify.artist_related_artists\u001b[39m\u001b[34m(self, artist_id)\u001b[39m\n\u001b[32m 467\u001b[39m warnings.warn(\n\u001b[32m 468\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mYou\u001b[39m\u001b[33m'\u001b[39m\u001b[33mre using `artist_related_artists(...)`, \u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 469\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mwhich is marked as deprecated by Spotify.\u001b[39m\u001b[33m\"\u001b[39m,\n\u001b[32m 470\u001b[39m \u001b[38;5;167;01mDeprecationWarning\u001b[39;00m\n\u001b[32m 471\u001b[39m )\n\u001b[32m 472\u001b[39m trid = \u001b[38;5;28mself\u001b[39m._get_id(\u001b[33m\"\u001b[39m\u001b[33martist\u001b[39m\u001b[33m\"\u001b[39m, artist_id)\n\u001b[32m--> \u001b[39m\u001b[32m473\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_get\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43martists/\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m \u001b[49m\u001b[43m+\u001b[49m\u001b[43m \u001b[49m\u001b[43mtrid\u001b[49m\u001b[43m \u001b[49m\u001b[43m+\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43m/related-artists\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:321\u001b[39m, in \u001b[36mSpotify._get\u001b[39m\u001b[34m(self, url, args, payload, **kwargs)\u001b[39m\n\u001b[32m 318\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m args:\n\u001b[32m 319\u001b[39m kwargs.update(args)\n\u001b[32m--> \u001b[39m\u001b[32m321\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_internal_call\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mGET\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpayload\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:291\u001b[39m, in \u001b[36mSpotify._internal_call\u001b[39m\u001b[34m(self, method, url, payload, params)\u001b[39m\n\u001b[32m 286\u001b[39m reason = \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 288\u001b[39m logger.error(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mHTTP Error for \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmethod\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m to \u001b[39m\u001b[38;5;132;01m{\u001b[39;00murl\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m with Params: \u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 289\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00margs.get(\u001b[33m'\u001b[39m\u001b[33mparams\u001b[39m\u001b[33m'\u001b[39m)\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m returned \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse.status_code\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m due to \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmsg\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m)\n\u001b[32m--> \u001b[39m\u001b[32m291\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m SpotifyException(\n\u001b[32m 292\u001b[39m response.status_code,\n\u001b[32m 293\u001b[39m -\u001b[32m1\u001b[39m,\n\u001b[32m 294\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse.url\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33m \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmsg\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m,\n\u001b[32m 295\u001b[39m reason=reason,\n\u001b[32m 296\u001b[39m headers=response.headers,\n\u001b[32m 297\u001b[39m )\n\u001b[32m 298\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m requests.exceptions.RetryError \u001b[38;5;28;01mas\u001b[39;00m retry_error:\n\u001b[32m 299\u001b[39m request = retry_error.request\n", + "\u001b[31mSpotifyException\u001b[39m: http status: 403, code: -1 - https://api.spotify.com/v1/artists/3GViqleny7XZGug7Ym2Fjk/related-artists:\n Forbidden, reason: None" + ] + } + ], + "source": [ + "sp.artist_related_artists(get_artist_id(\"Niko B\"))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "28eb9e22", + "metadata": {}, + "outputs": [], + "source": [ + "# replacing related artists with: “give me recommended tracks based on this artist”" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "id": "6baca1de", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "HTTP Error for GET to https://api.spotify.com/v1/recommendations with Params: {'limit': 10, 'seed_artists': '3GViqleny7XZGug7Ym2Fjk'} returned 404 due to None\n" + ] + }, + { + "ename": "SpotifyException", + "evalue": "http status: 404, code: -1 - https://api.spotify.com/v1/recommendations?limit=10&seed_artists=3GViqleny7XZGug7Ym2Fjk:\n None, reason: None", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mHTTPError\u001b[39m Traceback (most recent call last)", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:271\u001b[39m, in \u001b[36mSpotify._internal_call\u001b[39m\u001b[34m(self, method, url, payload, params)\u001b[39m\n\u001b[32m 266\u001b[39m response = \u001b[38;5;28mself\u001b[39m._session.request(\n\u001b[32m 267\u001b[39m method, url, headers=headers, proxies=\u001b[38;5;28mself\u001b[39m.proxies,\n\u001b[32m 268\u001b[39m timeout=\u001b[38;5;28mself\u001b[39m.requests_timeout, **args\n\u001b[32m 269\u001b[39m )\n\u001b[32m--> \u001b[39m\u001b[32m271\u001b[39m \u001b[43mresponse\u001b[49m\u001b[43m.\u001b[49m\u001b[43mraise_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 272\u001b[39m results = response.json()\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/requests/models.py:1026\u001b[39m, in \u001b[36mResponse.raise_for_status\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 1025\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m http_error_msg:\n\u001b[32m-> \u001b[39m\u001b[32m1026\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m HTTPError(http_error_msg, response=\u001b[38;5;28mself\u001b[39m)\n", + "\u001b[31mHTTPError\u001b[39m: 404 Client Error: Not Found for url: https://api.spotify.com/v1/recommendations?limit=10&seed_artists=3GViqleny7XZGug7Ym2Fjk", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[31mSpotifyException\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[96]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[43msp\u001b[49m\u001b[43m.\u001b[49m\u001b[43mrecommendations\u001b[49m\u001b[43m(\u001b[49m\u001b[43mseed_artists\u001b[49m\u001b[43m=\u001b[49m\u001b[43m[\u001b[49m\u001b[43mget_artist_id\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mNiko B\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlimit\u001b[49m\u001b[43m=\u001b[49m\u001b[32;43m10\u001b[39;49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:1908\u001b[39m, in \u001b[36mSpotify.recommendations\u001b[39m\u001b[34m(self, seed_artists, seed_genres, seed_tracks, limit, country, **kwargs)\u001b[39m\n\u001b[32m 1906\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m param \u001b[38;5;129;01min\u001b[39;00m kwargs:\n\u001b[32m 1907\u001b[39m params[param] = kwargs[param]\n\u001b[32m-> \u001b[39m\u001b[32m1908\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_get\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mrecommendations\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mparams\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:321\u001b[39m, in \u001b[36mSpotify._get\u001b[39m\u001b[34m(self, url, args, payload, **kwargs)\u001b[39m\n\u001b[32m 318\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m args:\n\u001b[32m 319\u001b[39m kwargs.update(args)\n\u001b[32m--> \u001b[39m\u001b[32m321\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_internal_call\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mGET\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpayload\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:291\u001b[39m, in \u001b[36mSpotify._internal_call\u001b[39m\u001b[34m(self, method, url, payload, params)\u001b[39m\n\u001b[32m 286\u001b[39m reason = \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 288\u001b[39m logger.error(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mHTTP Error for \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmethod\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m to \u001b[39m\u001b[38;5;132;01m{\u001b[39;00murl\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m with Params: \u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 289\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00margs.get(\u001b[33m'\u001b[39m\u001b[33mparams\u001b[39m\u001b[33m'\u001b[39m)\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m returned \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse.status_code\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m due to \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmsg\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m)\n\u001b[32m--> \u001b[39m\u001b[32m291\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m SpotifyException(\n\u001b[32m 292\u001b[39m response.status_code,\n\u001b[32m 293\u001b[39m -\u001b[32m1\u001b[39m,\n\u001b[32m 294\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse.url\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33m \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmsg\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m,\n\u001b[32m 295\u001b[39m reason=reason,\n\u001b[32m 296\u001b[39m headers=response.headers,\n\u001b[32m 297\u001b[39m )\n\u001b[32m 298\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m requests.exceptions.RetryError \u001b[38;5;28;01mas\u001b[39;00m retry_error:\n\u001b[32m 299\u001b[39m request = retry_error.request\n", + "\u001b[31mSpotifyException\u001b[39m: http status: 404, code: -1 - https://api.spotify.com/v1/recommendations?limit=10&seed_artists=3GViqleny7XZGug7Ym2Fjk:\n None, reason: None" + ] + } + ], + "source": [ + "sp.recommendations(seed_artists=[get_artist_id(\"Niko B\")], limit=10)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c9c5ba0b", + "metadata": {}, + "outputs": [], + "source": [ + "# Too outdated still. ChatGPT recommanded working with followed artist instead, just to be able to do something" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "id": "efa287a5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['bbno$',\n", + " 'Nic D',\n", + " 'Connor Price',\n", + " 'RÜFÜS DU SOL',\n", + " 'Eminem',\n", + " 'AURORA',\n", + " 'Collect 200',\n", + " 'Sabrina Carpenter',\n", + " 'Bleu Soleil',\n", + " 'Charles Aznavour',\n", + " 'Olivia Dean',\n", + " 'frytz',\n", + " 'ZHU',\n", + " 'Arcane',\n", + " 'Niko B',\n", + " 'KUZKO',\n", + " 'Azuzu',\n", + " 'Safri Duo']" + ] + }, + "execution_count": 98, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "followed_artists = [\n", + " artist[\"name\"]\n", + " for artist in sp_user.current_user_followed_artists(limit=20)[\"artists\"][\"items\"]\n", + "]\n", + "\n", + "followed_artists" + ] + }, + { + "cell_type": "code", + "execution_count": 99, + "id": "12c9ad8c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['bbno$',\n", + " 'Nic D',\n", + " 'Connor Price',\n", + " 'Eminem',\n", + " 'AURORA',\n", + " 'Collect 200',\n", + " 'Sabrina Carpenter',\n", + " 'Bleu Soleil',\n", + " 'Charles Aznavour',\n", + " 'Olivia Dean',\n", + " 'frytz',\n", + " 'ZHU',\n", + " 'Arcane',\n", + " 'KUZKO',\n", + " 'Azuzu',\n", + " 'Safri Duo']" + ] + }, + "execution_count": 99, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "related_artists_list = [artist for artist in followed_artists if artist not in artists]\n", + "related_artists_list" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "id": "16701645", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['bbno$', 'Nic D', 'Connor Price', 'Eminem', 'AURORA']" + ] + }, + "execution_count": 100, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "related_artists_list = related_artists_list[:5]\n", + "related_artists_list\n" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "id": "eb2c5968", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[['bag TF up', 'bing bong', 'gigolo', 'eat slay love', 'it boy'],\n", + " ['Too Easy', 'Good News', 'Caveman', 'Dabble', 'Ambidextrous'],\n", + " ['About Time', 'Boats', 'Push', 'Dialed In', 'Hand Sanitize'],\n", + " ['N..GA NI..A (feat. Lil Boosie)',\n", + " 'Too Rich For The B*tch',\n", + " 'Body Bag',\n", + " 'Tryna F**k Me (feat. Post Malone)',\n", + " \"I'm The Man (feat. Sonny Digital)\"],\n", + " ['Echo Of My Shadow',\n", + " 'To Be Alright',\n", + " 'Your Blood',\n", + " 'The Conflict Of The Mind',\n", + " 'Some Type Of Skin']]" + ] + }, + "execution_count": 101, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "related_top_tracks_list = [get_top_tracks(artist) for artist in related_artists_list]\n", + "related_top_tracks_list" + ] + }, + { + "cell_type": "code", + "execution_count": 102, + "id": "306a4c89", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Other Script',\n", + " 'The Mission',\n", + " \"Things I've Seen\",\n", + " \"They Don't Know\",\n", + " 'I Got U',\n", + " 'Beginners luck',\n", + " 'Mongoose',\n", + " 'Shoebox',\n", + " 'Spawn trap',\n", + " 'X Factor',\n", + " 'Part Of You',\n", + " 'Shallow Water',\n", + " 'Afters',\n", + " 'Sunshine',\n", + " 'Ain’t Losing You',\n", + " 'bag TF up',\n", + " 'bing bong',\n", + " 'gigolo',\n", + " 'eat slay love',\n", + " 'it boy',\n", + " 'Too Easy',\n", + " 'Good News',\n", + " 'Caveman',\n", + " 'Dabble',\n", + " 'Ambidextrous',\n", + " 'About Time',\n", + " 'Boats',\n", + " 'Push',\n", + " 'Dialed In',\n", + " 'Hand Sanitize',\n", + " 'N..GA NI..A (feat. Lil Boosie)',\n", + " 'Too Rich For The B*tch',\n", + " 'Body Bag',\n", + " 'Tryna F**k Me (feat. Post Malone)',\n", + " \"I'm The Man (feat. Sonny Digital)\",\n", + " 'Echo Of My Shadow',\n", + " 'To Be Alright',\n", + " 'Your Blood',\n", + " 'The Conflict Of The Mind',\n", + " 'Some Type Of Skin']" + ] + }, + "execution_count": 102, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "playlist_tracks = []\n", + "\n", + "for track_list in top_tracks_list:\n", + " playlist_tracks.extend(track_list)\n", + "\n", + "for track_list in related_top_tracks_list:\n", + " playlist_tracks.extend(track_list)\n", + "\n", + "playlist_tracks\n" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "id": "1ecee8ab", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "40" + ] + }, + "execution_count": 103, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(playlist_tracks)" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "id": "79058058", + "metadata": {}, + "outputs": [], + "source": [ + "sp_playlist = spotipy.Spotify(\n", + " auth_manager=SpotifyOAuth(\n", + " scope=\"user-top-read user-follow-read playlist-modify-private\"\n", + " )\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 105, + "id": "b86bf893", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'display_name': 'Sana Aarsman',\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'},\n", + " 'followers': {'href': None, 'total': 47},\n", + " 'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'images': [{'height': 300,\n", + " 'url': 'https://scontent-mrs2-1.xx.fbcdn.net/v/t39.30808-1/472709554_8953024361457079_3824036111575966021_n.jpg?stp=dst-jpg_s320x320_tt6&_nc_cat=103&ccb=1-7&_nc_sid=08baa4&_nc_ohc=QrXN2eaoAWYQ7kNvwGqNRgt&_nc_oc=AdocZomeI1S2qpLIg-c_f2ZayGYmwg2E4q2xcYPnQGm718f_fqwy4Uhv4vDJ6k8uz1FNDdLxPRSmCjyo96NFeFai&_nc_zt=24&_nc_ht=scontent-mrs2-1.xx&edm=AP4hL3IEAAAA&_nc_gid=6_WoN_JyIFGHkmWpLK72VQ&_nc_tpa=Q5bMBQHckUBQxWwFKWCpFstlOr7Q5D0im7zSQ3aX2Ew8hpdYuX3t80VaJVI7Ca5xpGP7qFcvmg1g&oh=00_AfzvQo7xKclNRiAuP6RpcNGcyIPu-fbLPt_HyZEnf1yd-Q&oe=69C93A6C',\n", + " 'width': 300},\n", + " {'height': 64,\n", + " 'url': 'https://scontent-mrs2-1.xx.fbcdn.net/v/t39.30808-1/472709554_8953024361457079_3824036111575966021_n.jpg?stp=cp0_dst-jpg_s50x50_tt6&_nc_cat=103&ccb=1-7&_nc_sid=28885b&_nc_ohc=QrXN2eaoAWYQ7kNvwGqNRgt&_nc_oc=AdocZomeI1S2qpLIg-c_f2ZayGYmwg2E4q2xcYPnQGm718f_fqwy4Uhv4vDJ6k8uz1FNDdLxPRSmCjyo96NFeFai&_nc_zt=24&_nc_ht=scontent-mrs2-1.xx&edm=AP4hL3IEAAAA&_nc_gid=6_WoN_JyIFGHkmWpLK72VQ&_nc_tpa=Q5bMBQFP1T_TqQEc4ZpsVGlRZ2fqs1mTYJsLlNbaYhIv1XoMewaIpEZ4gXf616ze-N6xHUvrvMZu&oh=00_Afw0GUjDUALT0HFLX9-Sf2G8e_e1yp4U58axcMwUPMzLJw&oe=69C93A6C',\n", + " 'width': 64}],\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665'}" + ] + }, + "execution_count": 105, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sp_playlist.current_user()" + ] + }, + { + "cell_type": "code", + "execution_count": 106, + "id": "86889e32", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'1124867665'" + ] + }, + "execution_count": 106, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "user_id = sp_playlist.current_user()[\"id\"]\n", + "user_id" + ] + }, + { + "cell_type": "code", + "execution_count": 108, + "id": "783f38f6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'collaborative': False,\n", + " 'description': 'Created in the Ironhack APIs lab from short-term top artists and followed artists',\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/playlist/30mkYFXs4WtlWXS01O38sg'},\n", + " 'followers': {'href': None, 'total': 0},\n", + " 'href': 'https://api.spotify.com/v1/playlists/30mkYFXs4WtlWXS01O38sg',\n", + " 'id': '30mkYFXs4WtlWXS01O38sg',\n", + " 'images': [],\n", + " 'primary_color': None,\n", + " 'name': 'Sana’s Short-Term Followed Artist Discovery',\n", + " 'type': 'playlist',\n", + " 'uri': 'spotify:playlist:30mkYFXs4WtlWXS01O38sg',\n", + " 'owner': {'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665',\n", + " 'display_name': None,\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'}},\n", + " 'public': False,\n", + " 'snapshot_id': 'AAAFY1zkEcusiNRQrVk4bzM5Cj1mzF6d',\n", + " 'tracks': {'limit': 100,\n", + " 'next': None,\n", + " 'offset': 0,\n", + " 'previous': None,\n", + " 'href': 'https://api.spotify.com/v1/playlists/30mkYFXs4WtlWXS01O38sg/tracks',\n", + " 'total': 0,\n", + " 'items': []},\n", + " 'items': {'limit': 100,\n", + " 'next': None,\n", + " 'offset': 0,\n", + " 'previous': None,\n", + " 'href': 'https://api.spotify.com/v1/playlists/30mkYFXs4WtlWXS01O38sg/items',\n", + " 'total': 0,\n", + " 'items': []}}" + ] + }, + "execution_count": 108, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "playlist = sp_playlist.user_playlist_create(\n", + " user=user_id,\n", + " name=\"Sana’s Short-Term Followed Artist Discovery\",\n", + " public=False,\n", + " description=\"Created in the Ironhack APIs lab from short-term top artists and followed artists\"\n", + ")\n", + "\n", + "playlist" + ] + }, + { + "cell_type": "code", + "execution_count": 109, + "id": "d52eb157", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'30mkYFXs4WtlWXS01O38sg'" + ] + }, + "execution_count": 109, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "playlist_id = playlist[\"id\"]\n", + "playlist_id" + ] + }, + { + "cell_type": "code", + "execution_count": 110, + "id": "249ea041", + "metadata": {}, + "outputs": [], + "source": [ + "def get_track_uri(track_name):\n", + " results = sp.search(q=track_name, type=\"track\", limit=1)\n", + " return results[\"tracks\"][\"items\"][0][\"uri\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 111, + "id": "ed650f15", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'spotify:track:1mXuFDSK7eSdwPLM2bwict'" + ] + }, + "execution_count": 111, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_track_uri(\"Mongoose\")" + ] + }, + { + "cell_type": "code", + "execution_count": 112, + "id": "5682ed3f", + "metadata": {}, + "outputs": [], + "source": [ + "def get_track_uri(track_name, artist_name):\n", + " results = sp.search(\n", + " q=f'track:\"{track_name}\" artist:\"{artist_name}\"',\n", + " type=\"track\",\n", + " limit=1\n", + " )\n", + " return results[\"tracks\"][\"items\"][0][\"uri\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 113, + "id": "5f2f0edf", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'spotify:track:0qu3ACa6KmQGY4ceCy3Q3n'" + ] + }, + "execution_count": 113, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_track_uri(\"Mongoose\", \"Niko B\")" + ] + }, + { + "cell_type": "code", + "execution_count": 116, + "id": "b911fc2a", + "metadata": {}, + "outputs": [], + "source": [ + "def get_track_uri(track_name, artist_name):\n", + " results = sp.search(\n", + " q=f'track:\"{track_name}\" artist:\"{artist_name}\"',\n", + " type=\"track\",\n", + " limit=1\n", + " )\n", + " \n", + " items = results[\"tracks\"][\"items\"]\n", + " \n", + " if len(items) == 0:\n", + " return None\n", + " \n", + " return items[0][\"uri\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 117, + "id": "3022138d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('Other Script', 'The Spooks', 'spotify:track:3jtl4DQuaeph9IPLqH5ijs'),\n", + " ('The Mission', 'The Spooks', 'spotify:track:6GJunzyv2l6nB7MtDGqOQS'),\n", + " (\"Things I've Seen\", 'The Spooks', 'spotify:track:673OnqT7JuOTkxyfa0BT0t'),\n", + " (\"They Don't Know\", 'The Spooks', 'spotify:track:0CVooIKfS2xdPiWgoVwMNF'),\n", + " ('I Got U', 'The Spooks', 'spotify:track:0JQGi0eYyhmBZeACmzfupQ'),\n", + " ('Beginners luck', 'Niko B', 'spotify:track:38Hx96xEHcnPh1HAUuM6Or'),\n", + " ('Mongoose', 'Niko B', 'spotify:track:0qu3ACa6KmQGY4ceCy3Q3n'),\n", + " ('Shoebox', 'Niko B', 'spotify:track:594b0JPsGMkbshF2PVfmbH'),\n", + " ('Spawn trap', 'Niko B', 'spotify:track:5DM6eipJd3vkbcSDAyrqg3'),\n", + " ('X Factor', 'Niko B', 'spotify:track:4KUGhfV9KrS6qY94dNt1Fv'),\n", + " ('Part Of You', 'RÜFÜS DU SOL', None),\n", + " ('Shallow Water', 'RÜFÜS DU SOL', None),\n", + " ('Afters', 'RÜFÜS DU SOL', None),\n", + " ('Sunshine', 'RÜFÜS DU SOL', None),\n", + " ('Ain’t Losing You', 'RÜFÜS DU SOL', None),\n", + " ('bag TF up', 'bbno$', 'spotify:track:5moS96HyivwASueSMzhSBh'),\n", + " ('bing bong', 'bbno$', 'spotify:track:0nwygFtUBQiDA9iFIrZGR9'),\n", + " ('gigolo', 'bbno$', 'spotify:track:0zZXEuRkmE44e78mniF5MU'),\n", + " ('eat slay love', 'bbno$', 'spotify:track:1hd9TQqZdoW3oZfwGFTNK2'),\n", + " ('it boy', 'bbno$', 'spotify:track:05lUNz9yIOg4CdeA3mAutQ'),\n", + " ('Too Easy', 'Nic D', 'spotify:track:7EQjPEL70tzjlTgCgU0QrV'),\n", + " ('Good News', 'Nic D', 'spotify:track:1rcpl29wXMZoaAt2s13l5W'),\n", + " ('Caveman', 'Nic D', 'spotify:track:0EqCNwOxQcKvb09auddfyA'),\n", + " ('Dabble', 'Nic D', 'spotify:track:2Sp9H1DOeQYCfHdFxo1aju'),\n", + " ('Ambidextrous', 'Nic D', 'spotify:track:4PIauPnOXDXSdo9j5fnxdv'),\n", + " ('About Time', 'Connor Price', 'spotify:track:0Lr7BBucVPjeCRblJW3L4d'),\n", + " ('Boats', 'Connor Price', 'spotify:track:1kfJz3qaKbmgNDYqBdbZ4i'),\n", + " ('Push', 'Connor Price', 'spotify:track:2sgqJwVGBSjT741fB1i7UZ'),\n", + " ('Dialed In', 'Connor Price', 'spotify:track:47ZwP9rqinYqwjse81Kc58'),\n", + " ('Hand Sanitize', 'Connor Price', 'spotify:track:6dS0YqBj00n1nJCkxpnaPu'),\n", + " ('N..GA NI..A (feat. Lil Boosie)', 'Eminem', None),\n", + " ('Too Rich For The B*tch', 'Eminem', None),\n", + " ('Body Bag', 'Eminem', None),\n", + " ('Tryna F**k Me (feat. Post Malone)', 'Eminem', None),\n", + " (\"I'm The Man (feat. Sonny Digital)\", 'Eminem', None),\n", + " ('Echo Of My Shadow', 'AURORA', 'spotify:track:5nCri6FA8HM1cZHv5n9LYH'),\n", + " ('To Be Alright', 'AURORA', 'spotify:track:0x2NRovyh089CVeHYnJyQR'),\n", + " ('Your Blood', 'AURORA', 'spotify:track:0hiI7iW0oUDp209pyLDmil'),\n", + " ('The Conflict Of The Mind',\n", + " 'AURORA',\n", + " 'spotify:track:0qQvmU1UyPMQ7p1ZxmoCzS'),\n", + " ('Some Type Of Skin', 'AURORA', 'spotify:track:6bEM4AwDfNxe9oT6pa3DaH')]" + ] + }, + "execution_count": 117, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "uri_pairs = [(track, artist, get_track_uri(track, artist)) for track, artist in playlist_pairs]\n", + "uri_pairs" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "94e1efae", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['spotify:track:3jtl4DQuaeph9IPLqH5ijs',\n", + " 'spotify:track:6GJunzyv2l6nB7MtDGqOQS',\n", + " 'spotify:track:673OnqT7JuOTkxyfa0BT0t',\n", + " 'spotify:track:0CVooIKfS2xdPiWgoVwMNF',\n", + " 'spotify:track:0JQGi0eYyhmBZeACmzfupQ',\n", + " 'spotify:track:38Hx96xEHcnPh1HAUuM6Or',\n", + " 'spotify:track:0qu3ACa6KmQGY4ceCy3Q3n',\n", + " 'spotify:track:594b0JPsGMkbshF2PVfmbH',\n", + " 'spotify:track:5DM6eipJd3vkbcSDAyrqg3',\n", + " 'spotify:track:4KUGhfV9KrS6qY94dNt1Fv',\n", + " 'spotify:track:5moS96HyivwASueSMzhSBh',\n", + " 'spotify:track:0nwygFtUBQiDA9iFIrZGR9',\n", + " 'spotify:track:0zZXEuRkmE44e78mniF5MU',\n", + " 'spotify:track:1hd9TQqZdoW3oZfwGFTNK2',\n", + " 'spotify:track:05lUNz9yIOg4CdeA3mAutQ',\n", + " 'spotify:track:7EQjPEL70tzjlTgCgU0QrV',\n", + " 'spotify:track:1rcpl29wXMZoaAt2s13l5W',\n", + " 'spotify:track:0EqCNwOxQcKvb09auddfyA',\n", + " 'spotify:track:2Sp9H1DOeQYCfHdFxo1aju',\n", + " 'spotify:track:4PIauPnOXDXSdo9j5fnxdv',\n", + " 'spotify:track:0Lr7BBucVPjeCRblJW3L4d',\n", + " 'spotify:track:1kfJz3qaKbmgNDYqBdbZ4i',\n", + " 'spotify:track:2sgqJwVGBSjT741fB1i7UZ',\n", + " 'spotify:track:47ZwP9rqinYqwjse81Kc58',\n", + " 'spotify:track:6dS0YqBj00n1nJCkxpnaPu',\n", + " 'spotify:track:5nCri6FA8HM1cZHv5n9LYH',\n", + " 'spotify:track:0x2NRovyh089CVeHYnJyQR',\n", + " 'spotify:track:0hiI7iW0oUDp209pyLDmil',\n", + " 'spotify:track:0qQvmU1UyPMQ7p1ZxmoCzS',\n", + " 'spotify:track:6bEM4AwDfNxe9oT6pa3DaH']" + ] + }, + "execution_count": 120, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# 10 tracks failed. i will continue with the 30 that do work\n", + "\n", + "valid_track_uris = [uri for _, _, uri in uri_pairs if uri is not None]\n", + "valid_track_uris" + ] + }, + { + "cell_type": "code", + "execution_count": 119, + "id": "c4549289", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "30" + ] + }, + "execution_count": 119, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(valid_track_uris)" + ] + }, + { + "cell_type": "code", + "execution_count": 121, + "id": "95b4a799", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'snapshot_id': 'AAAAAsAXEeVRNFOTGTTnfzxXCnrHG8tC'}" + ] + }, + "execution_count": 121, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sp_playlist.playlist_add_items(playlist_id, valid_track_uris)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 122, + "id": "5238d7b0", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'https://open.spotify.com/playlist/30mkYFXs4WtlWXS01O38sg'" + ] + }, + "execution_count": 122, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "playlist[\"external_urls\"][\"spotify\"]\n" + ] + }, + { + "cell_type": "code", + "execution_count": 123, + "id": "37184157", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'tracks': {'href': 'https://api.spotify.com/v1/search?offset=0&limit=5&query=track%3A%22Part%20Of%20You%22%20artist%3A%22RUFUS%20DU%20SOL%22&type=track',\n", + " 'limit': 5,\n", + " 'next': None,\n", + " 'offset': 0,\n", + " 'previous': None,\n", + " 'total': 0,\n", + " 'items': []}}" + ] + }, + "execution_count": 123, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sp.search(q='track:\"Part Of You\" artist:\"RUFUS DU SOL\"', type=\"track\", limit=5)" + ] + }, + { + "cell_type": "code", + "execution_count": 124, + "id": "732103f3", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[]" + ] + }, + "execution_count": 124, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[(item[\"name\"], item[\"artists\"][0][\"name\"], item[\"uri\"]) for item in sp.search(q='track:\"Part Of You\" artist:\"RUFUS DU SOL\"', type=\"track\", limit=5)[\"tracks\"][\"items\"]]" + ] + }, + { + "cell_type": "code", + "execution_count": 125, + "id": "9e363c4d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'tracks': {'href': 'https://api.spotify.com/v1/search?offset=0&limit=10&query=artist%3A%22R%C3%9CF%C3%9CS%20DU%20SOL%22&type=track',\n", + " 'limit': 10,\n", + " 'next': None,\n", + " 'offset': 0,\n", + " 'previous': None,\n", + " 'total': 5,\n", + " 'items': [{'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/5Pb27ujIyYb33zBqVysBkj'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5Pb27ujIyYb33zBqVysBkj',\n", + " 'id': '5Pb27ujIyYb33zBqVysBkj',\n", + " 'name': 'RÜFÜS DU SOL',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5Pb27ujIyYb33zBqVysBkj'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/4EAehCii5lZgeewct1LA5p'},\n", + " 'href': 'https://api.spotify.com/v1/albums/4EAehCii5lZgeewct1LA5p',\n", + " 'id': '4EAehCii5lZgeewct1LA5p',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b27360e5059dcab339142d7642bb'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e0260e5059dcab339142d7642bb'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000485160e5059dcab339142d7642bb'}],\n", + " 'is_playable': True,\n", + " 'name': 'Bloom',\n", + " 'release_date': '2016-01-22',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 11,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:4EAehCii5lZgeewct1LA5p'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/5Pb27ujIyYb33zBqVysBkj'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5Pb27ujIyYb33zBqVysBkj',\n", + " 'id': '5Pb27ujIyYb33zBqVysBkj',\n", + " 'name': 'RÜFÜS DU SOL',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5Pb27ujIyYb33zBqVysBkj'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 239417,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'AUDCB1500501'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/5HGxLtYxTriF7mMiriSpaz'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/5HGxLtYxTriF7mMiriSpaz',\n", + " 'id': '5HGxLtYxTriF7mMiriSpaz',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'You Were Right',\n", + " 'track_number': 4,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:5HGxLtYxTriF7mMiriSpaz'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/5Pb27ujIyYb33zBqVysBkj'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5Pb27ujIyYb33zBqVysBkj',\n", + " 'id': '5Pb27ujIyYb33zBqVysBkj',\n", + " 'name': 'RÜFÜS DU SOL',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5Pb27ujIyYb33zBqVysBkj'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/4EAehCii5lZgeewct1LA5p'},\n", + " 'href': 'https://api.spotify.com/v1/albums/4EAehCii5lZgeewct1LA5p',\n", + " 'id': '4EAehCii5lZgeewct1LA5p',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b27360e5059dcab339142d7642bb'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e0260e5059dcab339142d7642bb'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000485160e5059dcab339142d7642bb'}],\n", + " 'is_playable': True,\n", + " 'name': 'Bloom',\n", + " 'release_date': '2016-01-22',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 11,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:4EAehCii5lZgeewct1LA5p'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/5Pb27ujIyYb33zBqVysBkj'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5Pb27ujIyYb33zBqVysBkj',\n", + " 'id': '5Pb27ujIyYb33zBqVysBkj',\n", + " 'name': 'RÜFÜS DU SOL',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5Pb27ujIyYb33zBqVysBkj'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 578040,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'AUDCB1500639'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/6CGMZijOAZvTXG21T8t6R0'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/6CGMZijOAZvTXG21T8t6R0',\n", + " 'id': '6CGMZijOAZvTXG21T8t6R0',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Innerbloom',\n", + " 'track_number': 11,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:6CGMZijOAZvTXG21T8t6R0'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/5Pb27ujIyYb33zBqVysBkj'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5Pb27ujIyYb33zBqVysBkj',\n", + " 'id': '5Pb27ujIyYb33zBqVysBkj',\n", + " 'name': 'RÜFÜS DU SOL',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5Pb27ujIyYb33zBqVysBkj'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/1AD72FZKFKPeamhZzcuW9l'},\n", + " 'href': 'https://api.spotify.com/v1/albums/1AD72FZKFKPeamhZzcuW9l',\n", + " 'id': '1AD72FZKFKPeamhZzcuW9l',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273c951a766fbb2032ef90533dd'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02c951a766fbb2032ef90533dd'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851c951a766fbb2032ef90533dd'}],\n", + " 'is_playable': True,\n", + " 'name': 'Atlas',\n", + " 'release_date': '2014-05-07',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 11,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:1AD72FZKFKPeamhZzcuW9l'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/5Pb27ujIyYb33zBqVysBkj'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5Pb27ujIyYb33zBqVysBkj',\n", + " 'id': '5Pb27ujIyYb33zBqVysBkj',\n", + " 'name': 'RÜFÜS DU SOL',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5Pb27ujIyYb33zBqVysBkj'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 275500,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'AUDCB1300081'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/7vLdHqkzAl5BDVxphZ7vaO'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/7vLdHqkzAl5BDVxphZ7vaO',\n", + " 'id': '7vLdHqkzAl5BDVxphZ7vaO',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Sundream',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:7vLdHqkzAl5BDVxphZ7vaO'},\n", + " {'album': {'album_type': 'single',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/5Pb27ujIyYb33zBqVysBkj'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5Pb27ujIyYb33zBqVysBkj',\n", + " 'id': '5Pb27ujIyYb33zBqVysBkj',\n", + " 'name': 'RÜFÜS DU SOL',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5Pb27ujIyYb33zBqVysBkj'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/3ZiNbboiLplvAjEwrRPLWj'},\n", + " 'href': 'https://api.spotify.com/v1/albums/3ZiNbboiLplvAjEwrRPLWj',\n", + " 'id': '3ZiNbboiLplvAjEwrRPLWj',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b27375d5d9084ef075899f0285a6'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e0275d5d9084ef075899f0285a6'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000485175d5d9084ef075899f0285a6'}],\n", + " 'is_playable': True,\n", + " 'name': 'Innerbloom (Radio Edit)',\n", + " 'release_date': '2016-09-30',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 1,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:3ZiNbboiLplvAjEwrRPLWj'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/5Pb27ujIyYb33zBqVysBkj'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5Pb27ujIyYb33zBqVysBkj',\n", + " 'id': '5Pb27ujIyYb33zBqVysBkj',\n", + " 'name': 'RÜFÜS DU SOL',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5Pb27ujIyYb33zBqVysBkj'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 238067,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'AUDCB1600905'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/233AL29SR6QWnD7hu7ylbf'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/233AL29SR6QWnD7hu7ylbf',\n", + " 'id': '233AL29SR6QWnD7hu7ylbf',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Innerbloom - Radio Edit',\n", + " 'track_number': 1,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:233AL29SR6QWnD7hu7ylbf'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/5Pb27ujIyYb33zBqVysBkj'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5Pb27ujIyYb33zBqVysBkj',\n", + " 'id': '5Pb27ujIyYb33zBqVysBkj',\n", + " 'name': 'RÜFÜS DU SOL',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5Pb27ujIyYb33zBqVysBkj'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/3SB9ntsoNwC4oUP6xM9DIN'},\n", + " 'href': 'https://api.spotify.com/v1/albums/3SB9ntsoNwC4oUP6xM9DIN',\n", + " 'id': '3SB9ntsoNwC4oUP6xM9DIN',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b27318e117782b755e3087e11390'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e0218e117782b755e3087e11390'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000485118e117782b755e3087e11390'}],\n", + " 'is_playable': True,\n", + " 'name': 'Surrender',\n", + " 'release_date': '2021-10-21',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 11,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:3SB9ntsoNwC4oUP6xM9DIN'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/5Pb27ujIyYb33zBqVysBkj'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5Pb27ujIyYb33zBqVysBkj',\n", + " 'id': '5Pb27ujIyYb33zBqVysBkj',\n", + " 'name': 'RÜFÜS DU SOL',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5Pb27ujIyYb33zBqVysBkj'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 261001,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USRE12100620'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/2ouFrmMwYik8nQX2n9SeZu'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/2ouFrmMwYik8nQX2n9SeZu',\n", + " 'id': '2ouFrmMwYik8nQX2n9SeZu',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'On My Knees',\n", + " 'track_number': 7,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:2ouFrmMwYik8nQX2n9SeZu'}]}}" + ] + }, + "execution_count": 125, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sp.search(q='artist:\"RÜFÜS DU SOL\"', type=\"track\", limit=10)" + ] + }, + { + "cell_type": "code", + "execution_count": 126, + "id": "d5fbf8b4", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('You Were Right', 'RÜFÜS DU SOL', 'spotify:track:5HGxLtYxTriF7mMiriSpaz'),\n", + " ('Innerbloom', 'RÜFÜS DU SOL', 'spotify:track:6CGMZijOAZvTXG21T8t6R0'),\n", + " ('Sundream', 'RÜFÜS DU SOL', 'spotify:track:7vLdHqkzAl5BDVxphZ7vaO'),\n", + " ('Innerbloom - Radio Edit',\n", + " 'RÜFÜS DU SOL',\n", + " 'spotify:track:233AL29SR6QWnD7hu7ylbf'),\n", + " ('On My Knees', 'RÜFÜS DU SOL', 'spotify:track:2ouFrmMwYik8nQX2n9SeZu')]" + ] + }, + "execution_count": 126, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[(item[\"name\"], item[\"artists\"][0][\"name\"], item[\"uri\"]) \n", + " for item in sp.search(q='artist:\"RÜFÜS DU SOL\"', type=\"track\", limit=10)[\"tracks\"][\"items\"]]" + ] + }, + { + "cell_type": "code", + "execution_count": 127, + "id": "f76e3dca", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['spotify:track:5HGxLtYxTriF7mMiriSpaz',\n", + " 'spotify:track:6CGMZijOAZvTXG21T8t6R0',\n", + " 'spotify:track:2ouFrmMwYik8nQX2n9SeZu']" + ] + }, + "execution_count": 127, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rufus_tracks = [\n", + " item[\"uri\"]\n", + " for item in sp.search(q='artist:\"RÜFÜS DU SOL\"', type=\"track\", limit=5)[\"tracks\"][\"items\"]\n", + "]\n", + "\n", + "rufus_tracks" + ] + }, + { + "cell_type": "code", + "execution_count": 128, + "id": "b6349eb8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('You Were Right', 'RÜFÜS DU SOL', 'spotify:track:5HGxLtYxTriF7mMiriSpaz'),\n", + " ('Innerbloom', 'RÜFÜS DU SOL', 'spotify:track:6CGMZijOAZvTXG21T8t6R0'),\n", + " ('On My Knees', 'RÜFÜS DU SOL', 'spotify:track:2ouFrmMwYik8nQX2n9SeZu')]" + ] + }, + "execution_count": 128, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rufus_results = sp.search(q='artist:\"RÜFÜS DU SOL\"', type=\"track\", limit=5)\n", + "[(item[\"name\"], item[\"artists\"][0][\"name\"], item[\"uri\"]) for item in rufus_results[\"tracks\"][\"items\"]]\n" + ] + }, + { + "cell_type": "code", + "execution_count": 129, + "id": "a4ef00cf", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'tracks': {'href': 'https://api.spotify.com/v1/search?offset=0&limit=10&query=artist%3A%22Eminem%22&type=track',\n", + " 'limit': 10,\n", + " 'next': None,\n", + " 'offset': 0,\n", + " 'previous': None,\n", + " 'total': 5,\n", + " 'items': [{'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7dGJo4pcD2V6oG8kP0tJRR'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'id': '7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'name': 'Eminem',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7dGJo4pcD2V6oG8kP0tJRR'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/2cWBwpqMsDJC1ZUwz813lo'},\n", + " 'href': 'https://api.spotify.com/v1/albums/2cWBwpqMsDJC1ZUwz813lo',\n", + " 'id': '2cWBwpqMsDJC1ZUwz813lo',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b2736ca5c90113b30c3c43ffb8f4'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e026ca5c90113b30c3c43ffb8f4'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d000048516ca5c90113b30c3c43ffb8f4'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Eminem Show',\n", + " 'release_date': '2002-05-26',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 20,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:2cWBwpqMsDJC1ZUwz813lo'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7dGJo4pcD2V6oG8kP0tJRR'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'id': '7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'name': 'Eminem',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7dGJo4pcD2V6oG8kP0tJRR'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 290320,\n", + " 'explicit': True,\n", + " 'external_ids': {'isrc': 'USIR10211038'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/7lQ8MOhq6IN2w8EYcFNSUk'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/7lQ8MOhq6IN2w8EYcFNSUk',\n", + " 'id': '7lQ8MOhq6IN2w8EYcFNSUk',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Without Me',\n", + " 'track_number': 10,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:7lQ8MOhq6IN2w8EYcFNSUk'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7dGJo4pcD2V6oG8kP0tJRR'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'id': '7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'name': 'Eminem',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7dGJo4pcD2V6oG8kP0tJRR'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/3vOgbDjgsZBAPwV2M3bNOj'},\n", + " 'href': 'https://api.spotify.com/v1/albums/3vOgbDjgsZBAPwV2M3bNOj',\n", + " 'id': '3vOgbDjgsZBAPwV2M3bNOj',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b2733c65085a58aae2cccd892cbe'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e023c65085a58aae2cccd892cbe'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d000048513c65085a58aae2cccd892cbe'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Marshall Mathers LP2',\n", + " 'release_date': '2013-11-05',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 16,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:3vOgbDjgsZBAPwV2M3bNOj'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7dGJo4pcD2V6oG8kP0tJRR'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'id': '7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'name': 'Eminem',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7dGJo4pcD2V6oG8kP0tJRR'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/5pKCCKE2ajJHZ9KAiaK11H'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5pKCCKE2ajJHZ9KAiaK11H',\n", + " 'id': '5pKCCKE2ajJHZ9KAiaK11H',\n", + " 'name': 'Rihanna',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5pKCCKE2ajJHZ9KAiaK11H'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 250188,\n", + " 'explicit': True,\n", + " 'external_ids': {'isrc': 'USUM71314082'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/48RrDBpOSSl1aLVCalGl5C'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/48RrDBpOSSl1aLVCalGl5C',\n", + " 'id': '48RrDBpOSSl1aLVCalGl5C',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'The Monster',\n", + " 'track_number': 12,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:48RrDBpOSSl1aLVCalGl5C'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7dGJo4pcD2V6oG8kP0tJRR'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'id': '7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'name': 'Eminem',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7dGJo4pcD2V6oG8kP0tJRR'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/6t7956yu5zYf5A829XRiHC'},\n", + " 'href': 'https://api.spotify.com/v1/albums/6t7956yu5zYf5A829XRiHC',\n", + " 'id': '6t7956yu5zYf5A829XRiHC',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273dbb3dd82da45b7d7f31b1b42'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02dbb3dd82da45b7d7f31b1b42'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851dbb3dd82da45b7d7f31b1b42'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Marshall Mathers LP',\n", + " 'release_date': '2000-05-23',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 18,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:6t7956yu5zYf5A829XRiHC'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7dGJo4pcD2V6oG8kP0tJRR'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'id': '7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'name': 'Eminem',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7dGJo4pcD2V6oG8kP0tJRR'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 284200,\n", + " 'explicit': True,\n", + " 'external_ids': {'isrc': 'USIR10000448'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/3yfqSUWxFvZELEM4PmlwIR'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/3yfqSUWxFvZELEM4PmlwIR',\n", + " 'id': '3yfqSUWxFvZELEM4PmlwIR',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'The Real Slim Shady',\n", + " 'track_number': 8,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:3yfqSUWxFvZELEM4PmlwIR'},\n", + " {'album': {'album_type': 'album',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/0z4gvV4rjIZ9wHck67ucSV'},\n", + " 'href': 'https://api.spotify.com/v1/artists/0z4gvV4rjIZ9wHck67ucSV',\n", + " 'id': '0z4gvV4rjIZ9wHck67ucSV',\n", + " 'name': 'Akon',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:0z4gvV4rjIZ9wHck67ucSV'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/6kzoWb4UzvKYgbDfAwgaFq'},\n", + " 'href': 'https://api.spotify.com/v1/albums/6kzoWb4UzvKYgbDfAwgaFq',\n", + " 'id': '6kzoWb4UzvKYgbDfAwgaFq',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273d9bcf5565005950b353bc9cf'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02d9bcf5565005950b353bc9cf'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851d9bcf5565005950b353bc9cf'}],\n", + " 'is_playable': True,\n", + " 'name': 'Konvicted',\n", + " 'release_date': '2006-01-01',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 12,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:6kzoWb4UzvKYgbDfAwgaFq'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/0z4gvV4rjIZ9wHck67ucSV'},\n", + " 'href': 'https://api.spotify.com/v1/artists/0z4gvV4rjIZ9wHck67ucSV',\n", + " 'id': '0z4gvV4rjIZ9wHck67ucSV',\n", + " 'name': 'Akon',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:0z4gvV4rjIZ9wHck67ucSV'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/7dGJo4pcD2V6oG8kP0tJRR'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'id': '7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'name': 'Eminem',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7dGJo4pcD2V6oG8kP0tJRR'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 212360,\n", + " 'explicit': True,\n", + " 'external_ids': {'isrc': 'USUM70609036'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/2kQuhkFX7uSVepCD3h29g5'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/2kQuhkFX7uSVepCD3h29g5',\n", + " 'id': '2kQuhkFX7uSVepCD3h29g5',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Smack That',\n", + " 'track_number': 3,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:2kQuhkFX7uSVepCD3h29g5'},\n", + " {'album': {'album_type': 'single',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7dGJo4pcD2V6oG8kP0tJRR'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'id': '7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'name': 'Eminem',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7dGJo4pcD2V6oG8kP0tJRR'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/1rfORa9iYmocEsnnZGMVC4'},\n", + " 'href': 'https://api.spotify.com/v1/albums/1rfORa9iYmocEsnnZGMVC4',\n", + " 'id': '1rfORa9iYmocEsnnZGMVC4',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273b6ef2ebd34efb08cb76f6eec'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02b6ef2ebd34efb08cb76f6eec'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851b6ef2ebd34efb08cb76f6eec'}],\n", + " 'is_playable': True,\n", + " 'name': 'Just Lose It',\n", + " 'release_date': '2004-01-01',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 2,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:1rfORa9iYmocEsnnZGMVC4'},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7dGJo4pcD2V6oG8kP0tJRR'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'id': '7dGJo4pcD2V6oG8kP0tJRR',\n", + " 'name': 'Eminem',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7dGJo4pcD2V6oG8kP0tJRR'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 322226,\n", + " 'explicit': True,\n", + " 'external_ids': {'isrc': 'USIR10211559'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1v7L65Lzy0j0vdpRjJewt1'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1v7L65Lzy0j0vdpRjJewt1',\n", + " 'id': '1v7L65Lzy0j0vdpRjJewt1',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Lose Yourself',\n", + " 'track_number': 2,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:1v7L65Lzy0j0vdpRjJewt1'}]}}" + ] + }, + "execution_count": 129, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sp.search(q='artist:\"Eminem\"', type=\"track\", limit=10)" + ] + }, + { + "cell_type": "code", + "execution_count": 130, + "id": "9ad27136", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('Without Me', 'Eminem', 'spotify:track:7lQ8MOhq6IN2w8EYcFNSUk'),\n", + " ('The Monster', 'Eminem', 'spotify:track:48RrDBpOSSl1aLVCalGl5C'),\n", + " ('The Real Slim Shady', 'Eminem', 'spotify:track:3yfqSUWxFvZELEM4PmlwIR'),\n", + " ('Smack That', 'Akon', 'spotify:track:2kQuhkFX7uSVepCD3h29g5'),\n", + " ('Lose Yourself', 'Eminem', 'spotify:track:1v7L65Lzy0j0vdpRjJewt1')]" + ] + }, + "execution_count": 130, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[(item[\"name\"], item[\"artists\"][0][\"name\"], item[\"uri\"]) \n", + " for item in sp.search(q='artist:\"Eminem\"', type=\"track\", limit=10)[\"tracks\"][\"items\"]]" + ] + }, + { + "cell_type": "code", + "execution_count": 131, + "id": "ab6a101b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['spotify:track:7lQ8MOhq6IN2w8EYcFNSUk',\n", + " 'spotify:track:48RrDBpOSSl1aLVCalGl5C',\n", + " 'spotify:track:3yfqSUWxFvZELEM4PmlwIR',\n", + " 'spotify:track:1v7L65Lzy0j0vdpRjJewt1']" + ] + }, + "execution_count": 131, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "eminem_results = sp.search(q='artist:\"Eminem\"', type=\"track\", limit=10)\n", + "\n", + "eminem_tracks = [\n", + " item[\"uri\"]\n", + " for item in eminem_results[\"tracks\"][\"items\"]\n", + " if item[\"artists\"][0][\"name\"] == \"Eminem\"\n", + "][:5]\n", + "\n", + "eminem_tracks" + ] + }, + { + "cell_type": "code", + "execution_count": 132, + "id": "747f8fa3", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['spotify:track:5HGxLtYxTriF7mMiriSpaz',\n", + " 'spotify:track:6CGMZijOAZvTXG21T8t6R0',\n", + " 'spotify:track:2ouFrmMwYik8nQX2n9SeZu',\n", + " 'spotify:track:7lQ8MOhq6IN2w8EYcFNSUk',\n", + " 'spotify:track:48RrDBpOSSl1aLVCalGl5C',\n", + " 'spotify:track:3yfqSUWxFvZELEM4PmlwIR',\n", + " 'spotify:track:1v7L65Lzy0j0vdpRjJewt1']" + ] + }, + "execution_count": 132, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "extra_track_uris = rufus_tracks + eminem_tracks\n", + "extra_track_uris" + ] + }, + { + "cell_type": "code", + "execution_count": 133, + "id": "7066fac3", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'snapshot_id': 'AAAAAxQ42K/xnfsL16kK310Ap2g3UKbJ'}" + ] + }, + "execution_count": 133, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sp_playlist.playlist_add_items(playlist_id, extra_track_uris)" + ] + }, + { + "cell_type": "markdown", + "id": "94ad5fdc-22e5-4521-8aa1-c6833eb7e949", + "metadata": {}, + "source": [ + "## Playlists\n", + "\n", + "The `sp.featured_playlists()` method in `spotipy` fetches a list of Spotify's featured playlists at a given moment. These are curated playlists that Spotify often highlights on the platform's homepage. The method provides a snapshot of the playlists that are being promoted or featured by Spotify at the time of the request.\n", + "\n", + "Once you've fetched the featured playlists, you can extract their IDs (and other details)." + ] + }, + { + "cell_type": "code", + "execution_count": 134, + "id": "25fb0cf8-c13a-41b0-b8f8-7e0700fd1e41", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "HTTP Error for GET to https://api.spotify.com/v1/browse/featured-playlists with Params: {'locale': None, 'country': None, 'timestamp': None, 'limit': 20, 'offset': 0} returned 403 due to Forbidden\n" + ] + }, + { + "ename": "SpotifyException", + "evalue": "http status: 403, code: -1 - https://api.spotify.com/v1/browse/featured-playlists?limit=20&offset=0:\n Forbidden, reason: None", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mHTTPError\u001b[39m Traceback (most recent call last)", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:271\u001b[39m, in \u001b[36mSpotify._internal_call\u001b[39m\u001b[34m(self, method, url, payload, params)\u001b[39m\n\u001b[32m 266\u001b[39m response = \u001b[38;5;28mself\u001b[39m._session.request(\n\u001b[32m 267\u001b[39m method, url, headers=headers, proxies=\u001b[38;5;28mself\u001b[39m.proxies,\n\u001b[32m 268\u001b[39m timeout=\u001b[38;5;28mself\u001b[39m.requests_timeout, **args\n\u001b[32m 269\u001b[39m )\n\u001b[32m--> \u001b[39m\u001b[32m271\u001b[39m \u001b[43mresponse\u001b[49m\u001b[43m.\u001b[49m\u001b[43mraise_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 272\u001b[39m results = response.json()\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/requests/models.py:1026\u001b[39m, in \u001b[36mResponse.raise_for_status\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 1025\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m http_error_msg:\n\u001b[32m-> \u001b[39m\u001b[32m1026\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m HTTPError(http_error_msg, response=\u001b[38;5;28mself\u001b[39m)\n", + "\u001b[31mHTTPError\u001b[39m: 403 Client Error: Forbidden for url: https://api.spotify.com/v1/browse/featured-playlists?limit=20&offset=0", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[31mSpotifyException\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[134]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[43msp\u001b[49m\u001b[43m.\u001b[49m\u001b[43mfeatured_playlists\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;66;03m# We get a playlist id of a playlist we like\u001b[39;00m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:1721\u001b[39m, in \u001b[36mSpotify.featured_playlists\u001b[39m\u001b[34m(self, locale, country, timestamp, limit, offset)\u001b[39m\n\u001b[32m 1692\u001b[39m \u001b[38;5;250m\u001b[39m\u001b[33;03m\"\"\" Get a list of Spotify featured playlists\u001b[39;00m\n\u001b[32m 1693\u001b[39m \n\u001b[32m 1694\u001b[39m \u001b[33;03m .. deprecated::\u001b[39;00m\n\u001b[32m (...)\u001b[39m\u001b[32m 1714\u001b[39m \u001b[33;03m items.\u001b[39;00m\n\u001b[32m 1715\u001b[39m \u001b[33;03m\"\"\"\u001b[39;00m\n\u001b[32m 1716\u001b[39m warnings.warn(\n\u001b[32m 1717\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mYou\u001b[39m\u001b[33m'\u001b[39m\u001b[33mre using `featured_playlists(...)`, \u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 1718\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mwhich is marked as deprecated by Spotify.\u001b[39m\u001b[33m\"\u001b[39m,\n\u001b[32m 1719\u001b[39m \u001b[38;5;167;01mDeprecationWarning\u001b[39;00m,\n\u001b[32m 1720\u001b[39m )\n\u001b[32m-> \u001b[39m\u001b[32m1721\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_get\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 1722\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mbrowse/featured-playlists\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[32m 1723\u001b[39m \u001b[43m \u001b[49m\u001b[43mlocale\u001b[49m\u001b[43m=\u001b[49m\u001b[43mlocale\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1724\u001b[39m \u001b[43m \u001b[49m\u001b[43mcountry\u001b[49m\u001b[43m=\u001b[49m\u001b[43mcountry\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1725\u001b[39m \u001b[43m \u001b[49m\u001b[43mtimestamp\u001b[49m\u001b[43m=\u001b[49m\u001b[43mtimestamp\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1726\u001b[39m \u001b[43m \u001b[49m\u001b[43mlimit\u001b[49m\u001b[43m=\u001b[49m\u001b[43mlimit\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1727\u001b[39m \u001b[43m \u001b[49m\u001b[43moffset\u001b[49m\u001b[43m=\u001b[49m\u001b[43moffset\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1728\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:321\u001b[39m, in \u001b[36mSpotify._get\u001b[39m\u001b[34m(self, url, args, payload, **kwargs)\u001b[39m\n\u001b[32m 318\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m args:\n\u001b[32m 319\u001b[39m kwargs.update(args)\n\u001b[32m--> \u001b[39m\u001b[32m321\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_internal_call\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mGET\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpayload\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:291\u001b[39m, in \u001b[36mSpotify._internal_call\u001b[39m\u001b[34m(self, method, url, payload, params)\u001b[39m\n\u001b[32m 286\u001b[39m reason = \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 288\u001b[39m logger.error(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mHTTP Error for \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmethod\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m to \u001b[39m\u001b[38;5;132;01m{\u001b[39;00murl\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m with Params: \u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 289\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00margs.get(\u001b[33m'\u001b[39m\u001b[33mparams\u001b[39m\u001b[33m'\u001b[39m)\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m returned \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse.status_code\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m due to \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmsg\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m)\n\u001b[32m--> \u001b[39m\u001b[32m291\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m SpotifyException(\n\u001b[32m 292\u001b[39m response.status_code,\n\u001b[32m 293\u001b[39m -\u001b[32m1\u001b[39m,\n\u001b[32m 294\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse.url\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33m \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmsg\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m,\n\u001b[32m 295\u001b[39m reason=reason,\n\u001b[32m 296\u001b[39m headers=response.headers,\n\u001b[32m 297\u001b[39m )\n\u001b[32m 298\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m requests.exceptions.RetryError \u001b[38;5;28;01mas\u001b[39;00m retry_error:\n\u001b[32m 299\u001b[39m request = retry_error.request\n", + "\u001b[31mSpotifyException\u001b[39m: http status: 403, code: -1 - https://api.spotify.com/v1/browse/featured-playlists?limit=20&offset=0:\n Forbidden, reason: None" + ] + } + ], + "source": [ + "sp.featured_playlists() # We get a playlist id of a playlist we like" + ] + }, + { + "cell_type": "code", + "execution_count": 137, + "id": "908b019a", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "HTTP Error for GET to https://api.spotify.com/v1/me/playlists with Params: {'limit': 10, 'offset': 0} returned 403 due to Insufficient client scope\n" + ] + }, + { + "ename": "SpotifyException", + "evalue": "http status: 403, code: -1 - https://api.spotify.com/v1/me/playlists?limit=10&offset=0:\n Insufficient client scope, reason: None", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mHTTPError\u001b[39m Traceback (most recent call last)", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:271\u001b[39m, in \u001b[36mSpotify._internal_call\u001b[39m\u001b[34m(self, method, url, payload, params)\u001b[39m\n\u001b[32m 266\u001b[39m response = \u001b[38;5;28mself\u001b[39m._session.request(\n\u001b[32m 267\u001b[39m method, url, headers=headers, proxies=\u001b[38;5;28mself\u001b[39m.proxies,\n\u001b[32m 268\u001b[39m timeout=\u001b[38;5;28mself\u001b[39m.requests_timeout, **args\n\u001b[32m 269\u001b[39m )\n\u001b[32m--> \u001b[39m\u001b[32m271\u001b[39m \u001b[43mresponse\u001b[49m\u001b[43m.\u001b[49m\u001b[43mraise_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 272\u001b[39m results = response.json()\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/requests/models.py:1026\u001b[39m, in \u001b[36mResponse.raise_for_status\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 1025\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m http_error_msg:\n\u001b[32m-> \u001b[39m\u001b[32m1026\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m HTTPError(http_error_msg, response=\u001b[38;5;28mself\u001b[39m)\n", + "\u001b[31mHTTPError\u001b[39m: 403 Client Error: Forbidden for url: https://api.spotify.com/v1/me/playlists?limit=10&offset=0", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[31mSpotifyException\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[137]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[43msp_playlist\u001b[49m\u001b[43m.\u001b[49m\u001b[43mcurrent_user_playlists\u001b[49m\u001b[43m(\u001b[49m\u001b[43mlimit\u001b[49m\u001b[43m=\u001b[49m\u001b[32;43m10\u001b[39;49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:668\u001b[39m, in \u001b[36mSpotify.current_user_playlists\u001b[39m\u001b[34m(self, limit, offset)\u001b[39m\n\u001b[32m 662\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mcurrent_user_playlists\u001b[39m(\u001b[38;5;28mself\u001b[39m, limit=\u001b[32m50\u001b[39m, offset=\u001b[32m0\u001b[39m):\n\u001b[32m 663\u001b[39m \u001b[38;5;250m \u001b[39m\u001b[33;03m\"\"\" Get current user playlists without required getting his profile\u001b[39;00m\n\u001b[32m 664\u001b[39m \u001b[33;03m Parameters:\u001b[39;00m\n\u001b[32m 665\u001b[39m \u001b[33;03m - limit - the number of items to return\u001b[39;00m\n\u001b[32m 666\u001b[39m \u001b[33;03m - offset - the index of the first item to return\u001b[39;00m\n\u001b[32m 667\u001b[39m \u001b[33;03m \"\"\"\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m668\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_get\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mme/playlists\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlimit\u001b[49m\u001b[43m=\u001b[49m\u001b[43mlimit\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moffset\u001b[49m\u001b[43m=\u001b[49m\u001b[43moffset\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:321\u001b[39m, in \u001b[36mSpotify._get\u001b[39m\u001b[34m(self, url, args, payload, **kwargs)\u001b[39m\n\u001b[32m 318\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m args:\n\u001b[32m 319\u001b[39m kwargs.update(args)\n\u001b[32m--> \u001b[39m\u001b[32m321\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_internal_call\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mGET\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpayload\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:291\u001b[39m, in \u001b[36mSpotify._internal_call\u001b[39m\u001b[34m(self, method, url, payload, params)\u001b[39m\n\u001b[32m 286\u001b[39m reason = \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 288\u001b[39m logger.error(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mHTTP Error for \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmethod\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m to \u001b[39m\u001b[38;5;132;01m{\u001b[39;00murl\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m with Params: \u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 289\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00margs.get(\u001b[33m'\u001b[39m\u001b[33mparams\u001b[39m\u001b[33m'\u001b[39m)\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m returned \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse.status_code\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m due to \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmsg\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m)\n\u001b[32m--> \u001b[39m\u001b[32m291\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m SpotifyException(\n\u001b[32m 292\u001b[39m response.status_code,\n\u001b[32m 293\u001b[39m -\u001b[32m1\u001b[39m,\n\u001b[32m 294\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse.url\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33m \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmsg\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m,\n\u001b[32m 295\u001b[39m reason=reason,\n\u001b[32m 296\u001b[39m headers=response.headers,\n\u001b[32m 297\u001b[39m )\n\u001b[32m 298\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m requests.exceptions.RetryError \u001b[38;5;28;01mas\u001b[39;00m retry_error:\n\u001b[32m 299\u001b[39m request = retry_error.request\n", + "\u001b[31mSpotifyException\u001b[39m: http status: 403, code: -1 - https://api.spotify.com/v1/me/playlists?limit=10&offset=0:\n Insufficient client scope, reason: None" + ] + } + ], + "source": [ + "sp_playlist.current_user_playlists(limit=10)" + ] + }, + { + "cell_type": "markdown", + "id": "dd3d27ea", + "metadata": {}, + "source": [ + "# Skipping the explenation and going traight to the excersize, since all the explenation cells don't work/are outdated" + ] + }, + { + "cell_type": "markdown", + "id": "90f558f3-c638-4df4-b5a4-e24f7847d52a", + "metadata": {}, + "source": [ + "### Getting a Playlist's Details\n", + "To fetch details about a specific playlist, you can use the playlist method. You'll need the playlist's Spotify ID." + ] + }, + { + "cell_type": "markdown", + "id": "0eef529f-617f-4ea3-8156-07472ac8e6d5", + "metadata": {}, + "source": [ + "In this example, we will use the following playlist id: *37i9dQZF1DXd9zR7tdziuQ*" + ] + }, + { + "cell_type": "code", + "execution_count": 135, + "id": "46d35121-9256-4cf4-81f5-118b87f7af32", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "HTTP Error for GET to https://api.spotify.com/v1/playlists/37i9dQZF1DXd9zR7tdziuQ with Params: {'fields': None, 'market': None, 'additional_types': 'track'} returned 404 due to Resource not found\n" + ] + }, + { + "ename": "SpotifyException", + "evalue": "http status: 404, code: -1 - https://api.spotify.com/v1/playlists/37i9dQZF1DXd9zR7tdziuQ?additional_types=track:\n Resource not found, reason: None", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mHTTPError\u001b[39m Traceback (most recent call last)", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:271\u001b[39m, in \u001b[36mSpotify._internal_call\u001b[39m\u001b[34m(self, method, url, payload, params)\u001b[39m\n\u001b[32m 266\u001b[39m response = \u001b[38;5;28mself\u001b[39m._session.request(\n\u001b[32m 267\u001b[39m method, url, headers=headers, proxies=\u001b[38;5;28mself\u001b[39m.proxies,\n\u001b[32m 268\u001b[39m timeout=\u001b[38;5;28mself\u001b[39m.requests_timeout, **args\n\u001b[32m 269\u001b[39m )\n\u001b[32m--> \u001b[39m\u001b[32m271\u001b[39m \u001b[43mresponse\u001b[49m\u001b[43m.\u001b[49m\u001b[43mraise_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 272\u001b[39m results = response.json()\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/requests/models.py:1026\u001b[39m, in \u001b[36mResponse.raise_for_status\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 1025\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m http_error_msg:\n\u001b[32m-> \u001b[39m\u001b[32m1026\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m HTTPError(http_error_msg, response=\u001b[38;5;28mself\u001b[39m)\n", + "\u001b[31mHTTPError\u001b[39m: 404 Client Error: Not Found for url: https://api.spotify.com/v1/playlists/37i9dQZF1DXd9zR7tdziuQ?additional_types=track", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[31mSpotifyException\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[135]\u001b[39m\u001b[32m, line 2\u001b[39m\n\u001b[32m 1\u001b[39m playlist_id = \u001b[33m\"\u001b[39m\u001b[33m37i9dQZF1DXd9zR7tdziuQ\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m2\u001b[39m playlist = \u001b[43msp\u001b[49m\u001b[43m.\u001b[49m\u001b[43mplaylist\u001b[49m\u001b[43m(\u001b[49m\u001b[43mplaylist_id\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:682\u001b[39m, in \u001b[36mSpotify.playlist\u001b[39m\u001b[34m(self, playlist_id, fields, market, additional_types)\u001b[39m\n\u001b[32m 671\u001b[39m \u001b[38;5;250m\u001b[39m\u001b[33;03m\"\"\" Gets playlist by id.\u001b[39;00m\n\u001b[32m 672\u001b[39m \n\u001b[32m 673\u001b[39m \u001b[33;03m Parameters:\u001b[39;00m\n\u001b[32m (...)\u001b[39m\u001b[32m 679\u001b[39m \u001b[33;03m valid types are: track and episode\u001b[39;00m\n\u001b[32m 680\u001b[39m \u001b[33;03m\"\"\"\u001b[39;00m\n\u001b[32m 681\u001b[39m plid = \u001b[38;5;28mself\u001b[39m._get_id(\u001b[33m\"\u001b[39m\u001b[33mplaylist\u001b[39m\u001b[33m\"\u001b[39m, playlist_id)\n\u001b[32m--> \u001b[39m\u001b[32m682\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_get\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 683\u001b[39m \u001b[43m \u001b[49m\u001b[33;43mf\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mplaylists/\u001b[39;49m\u001b[38;5;132;43;01m{\u001b[39;49;00m\u001b[43mplid\u001b[49m\u001b[38;5;132;43;01m}\u001b[39;49;00m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[32m 684\u001b[39m \u001b[43m \u001b[49m\u001b[43mfields\u001b[49m\u001b[43m=\u001b[49m\u001b[43mfields\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 685\u001b[39m \u001b[43m \u001b[49m\u001b[43mmarket\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmarket\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 686\u001b[39m \u001b[43m \u001b[49m\u001b[43madditional_types\u001b[49m\u001b[43m=\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43m,\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mjoin\u001b[49m\u001b[43m(\u001b[49m\u001b[43madditional_types\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 687\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:321\u001b[39m, in \u001b[36mSpotify._get\u001b[39m\u001b[34m(self, url, args, payload, **kwargs)\u001b[39m\n\u001b[32m 318\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m args:\n\u001b[32m 319\u001b[39m kwargs.update(args)\n\u001b[32m--> \u001b[39m\u001b[32m321\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_internal_call\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mGET\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpayload\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/dev/ironhack/course/.venv/lib/python3.12/site-packages/spotipy/client.py:291\u001b[39m, in \u001b[36mSpotify._internal_call\u001b[39m\u001b[34m(self, method, url, payload, params)\u001b[39m\n\u001b[32m 286\u001b[39m reason = \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 288\u001b[39m logger.error(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mHTTP Error for \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmethod\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m to \u001b[39m\u001b[38;5;132;01m{\u001b[39;00murl\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m with Params: \u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 289\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00margs.get(\u001b[33m'\u001b[39m\u001b[33mparams\u001b[39m\u001b[33m'\u001b[39m)\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m returned \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse.status_code\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m due to \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmsg\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m)\n\u001b[32m--> \u001b[39m\u001b[32m291\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m SpotifyException(\n\u001b[32m 292\u001b[39m response.status_code,\n\u001b[32m 293\u001b[39m -\u001b[32m1\u001b[39m,\n\u001b[32m 294\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse.url\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33m \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmsg\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m,\n\u001b[32m 295\u001b[39m reason=reason,\n\u001b[32m 296\u001b[39m headers=response.headers,\n\u001b[32m 297\u001b[39m )\n\u001b[32m 298\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m requests.exceptions.RetryError \u001b[38;5;28;01mas\u001b[39;00m retry_error:\n\u001b[32m 299\u001b[39m request = retry_error.request\n", + "\u001b[31mSpotifyException\u001b[39m: http status: 404, code: -1 - https://api.spotify.com/v1/playlists/37i9dQZF1DXd9zR7tdziuQ?additional_types=track:\n Resource not found, reason: None" + ] + } + ], + "source": [ + "playlist_id = \"37i9dQZF1DXd9zR7tdziuQ\"\n", + "playlist = sp.playlist(playlist_id)" + ] + }, + { + "cell_type": "code", + "execution_count": 136, + "id": "5260f67f-6024-4fee-8449-30904f03bf76", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Sana’s Short-Term Followed Artist Discovery\n", + "Created in the Ironhack APIs lab from short-term top artists and followed artists\n" + ] + } + ], + "source": [ + "print(playlist['name']) # Print the playlist's name\n", + "print(playlist['description']) # Print the playlist's description" + ] + }, + { + "cell_type": "markdown", + "id": "13bc8631-69f0-4b98-9cc9-5baecbaea9ba", + "metadata": {}, + "source": [ + "### Getting Tracks from a Playlist\n", + "If you want to get the tracks from a specific playlist, you can use the playlist_tracks method." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "69c78f8d-7e6a-4d15-bcbb-fc93edb82433", + "metadata": {}, + "outputs": [], + "source": [ + "tracks = sp.playlist_tracks(playlist_id)\n", + "for track in tracks['items']:\n", + " print(track['track']['name']) # Print each track's name" + ] + }, + { + "cell_type": "markdown", + "id": "2775714d-acc7-4555-96bd-2c541ab0855e", + "metadata": {}, + "source": [ + "### Getting Artists from a Playlist\n", + "\n", + "To extract all the artists from the tracks in a playlist, you'd typically follow these steps:\n", + "\n", + "1. Fetch the playlist's tracks.\n", + "2. Iterate through each track.\n", + "3. For each track, extract the associated artists." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "65c5e5c4-f186-42c6-b136-4ef02b0b01ff", + "metadata": {}, + "outputs": [], + "source": [ + "# List to store unique artist names\n", + "artists_list = []\n", + "\n", + "for track_item in tracks['items']:\n", + " track = track_item['track']\n", + " for artist in track['artists']:\n", + " artist_name = artist['name']\n", + " if artist_name not in artists_list: # This ensures each artist is added only once\n", + " artists_list.append(artist_name)\n", + "\n", + "print(artists_list)" + ] + }, + { + "cell_type": "markdown", + "id": "7b52207e-a4f0-4f90-9f4e-3170d7f0f3fe", + "metadata": {}, + "source": [ + "## Exercise 2: Unraveling the World of Playlists\n", + "\n", + "\n", + "1. **Featured Exploration**: \n", + " - Fetch the list of Spotify's current featured playlists. \n", + " - Extract and display the names and IDs of the top 5 featured playlists.\n", + " \n", + "2. **Deep Dive**:\n", + " - Choose any one of the top 5 featured playlists (you can choose the one you personally find most interesting or simply pick one randomly).\n", + " - Fetch and display its name, description, and total track count.\n", + "\n", + "3. **Track-tastic**:\n", + " - Extract and display the names of the first 10 tracks in the chosen playlist.\n", + "\n", + "4. **Artistic Flair**:\n", + " - Create a dictionary where the keys are the names of the first 10 tracks, and the values are lists containing the names of the artists associated with each track.\n", + " - For example: `{\"TrackName1\": [\"Artist1\", \"Artist2\"], \"TrackName2\": [\"Artist3\"]}`\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 140, + "id": "ed92d961-9646-4375-a386-ccc320a958f5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('Sana’s Short-Term Followed Artist Discovery', '30mkYFXs4WtlWXS01O38sg'),\n", + " ('03 March 2026', '6DLduYM0nS1x0XuvEAEHTK'),\n", + " ('UK Dealer ', '13ILuGFvQt4bpGUwdS8v1f'),\n", + " ('🇬🇧 Might as well chill while waiting for that dealer to show up in his Vauxhall when he’s done gaming ',\n", + " '0YG70U2QpW9eMBv9l8SdY0'),\n", + " ('🇬🇧 UK mellow rap', '6UN1DXfFIVdG6JL6L3JBJ5')]" + ] + }, + "execution_count": 140, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "playlists_data = sp_playlist.current_user_playlists(limit=10)\n", + "[(item[\"name\"], item[\"id\"]) for item in playlists_data[\"items\"][:5]]" + ] + }, + { + "cell_type": "code", + "execution_count": 141, + "id": "b0f7100d", + "metadata": {}, + "outputs": [], + "source": [ + "playlist_id = \"6DLduYM0nS1x0XuvEAEHTK\"" + ] + }, + { + "cell_type": "code", + "execution_count": 142, + "id": "ddd8b507", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "03 March 2026\n", + "\n" + ] + }, + { + "ename": "KeyError", + "evalue": "'tracks'", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mKeyError\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[142]\u001b[39m\u001b[32m, line 5\u001b[39m\n\u001b[32m 3\u001b[39m \u001b[38;5;28mprint\u001b[39m(playlist[\u001b[33m\"\u001b[39m\u001b[33mname\u001b[39m\u001b[33m\"\u001b[39m])\n\u001b[32m 4\u001b[39m \u001b[38;5;28mprint\u001b[39m(playlist[\u001b[33m\"\u001b[39m\u001b[33mdescription\u001b[39m\u001b[33m\"\u001b[39m])\n\u001b[32m----> \u001b[39m\u001b[32m5\u001b[39m \u001b[38;5;28mprint\u001b[39m(\u001b[43mplaylist\u001b[49m\u001b[43m[\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtracks\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m]\u001b[49m[\u001b[33m\"\u001b[39m\u001b[33mtotal\u001b[39m\u001b[33m\"\u001b[39m])\n", + "\u001b[31mKeyError\u001b[39m: 'tracks'" + ] + } + ], + "source": [ + "playlist = sp_playlist.playlist(playlist_id)\n", + "\n", + "print(playlist[\"name\"])\n", + "print(playlist[\"description\"])\n", + "print(playlist[\"tracks\"][\"total\"])" + ] + }, + { + "cell_type": "code", + "execution_count": 143, + "id": "8e6c0d98", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['collaborative', 'description', 'external_urls', 'followers', 'href', 'id', 'images', 'name', 'owner', 'primary_color', 'public', 'snapshot_id', 'items', 'type', 'uri'])" + ] + }, + "execution_count": 143, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "playlist.keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 144, + "id": "dc32b74b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'collaborative': False,\n", + " 'description': '',\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/playlist/6DLduYM0nS1x0XuvEAEHTK'},\n", + " 'followers': {'href': None, 'total': 0},\n", + " 'href': 'https://api.spotify.com/v1/playlists/6DLduYM0nS1x0XuvEAEHTK?additional_types=track',\n", + " 'id': '6DLduYM0nS1x0XuvEAEHTK',\n", + " 'images': [{'height': 640,\n", + " 'url': 'https://mosaic.scdn.co/640/ab67616d00001e02236f39ad1278417e20240e02ab67616d00001e02297fe500cf4445f6b06186dfab67616d00001e024dcb6c5df15cf74596ab25a4ab67616d00001e02faf441738fded13d0abe56a3',\n", + " 'width': 640},\n", + " {'height': 300,\n", + " 'url': 'https://mosaic.scdn.co/300/ab67616d00001e02236f39ad1278417e20240e02ab67616d00001e02297fe500cf4445f6b06186dfab67616d00001e024dcb6c5df15cf74596ab25a4ab67616d00001e02faf441738fded13d0abe56a3',\n", + " 'width': 300},\n", + " {'height': 60,\n", + " 'url': 'https://mosaic.scdn.co/60/ab67616d00001e02236f39ad1278417e20240e02ab67616d00001e02297fe500cf4445f6b06186dfab67616d00001e024dcb6c5df15cf74596ab25a4ab67616d00001e02faf441738fded13d0abe56a3',\n", + " 'width': 60}],\n", + " 'name': '03 March 2026',\n", + " 'owner': {'display_name': 'Sana Aarsman',\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'},\n", + " 'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665'},\n", + " 'primary_color': None,\n", + " 'public': True,\n", + " 'snapshot_id': 'AAAADRW3z3tiZ9StOX4bn11E5C+oCWoV',\n", + " 'items': {'href': 'https://api.spotify.com/v1/playlists/6DLduYM0nS1x0XuvEAEHTK/items?offset=0&limit=100&additional_types=track',\n", + " 'items': [{'added_at': '2026-03-12T10:59:57Z',\n", + " 'added_by': {'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'},\n", + " 'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665'},\n", + " 'is_local': False,\n", + " 'primary_color': None,\n", + " 'item': {'is_playable': True,\n", + " 'explicit': False,\n", + " 'type': 'track',\n", + " 'episode': False,\n", + " 'track': True,\n", + " 'album': {'is_playable': True,\n", + " 'type': 'album',\n", + " 'album_type': 'album',\n", + " 'href': 'https://api.spotify.com/v1/albums/14JkAa6IiFaOh5s0nMyMU9',\n", + " 'id': '14JkAa6IiFaOh5s0nMyMU9',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b2734dcb6c5df15cf74596ab25a4',\n", + " 'width': 640,\n", + " 'height': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e024dcb6c5df15cf74596ab25a4',\n", + " 'width': 300,\n", + " 'height': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d000048514dcb6c5df15cf74596ab25a4',\n", + " 'width': 64,\n", + " 'height': 64}],\n", + " 'name': 'KPop Demon Hunters (Soundtrack from the Netflix Film)',\n", + " 'release_date': '2025-06-20',\n", + " 'release_date_precision': 'day',\n", + " 'uri': 'spotify:album:14JkAa6IiFaOh5s0nMyMU9',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7mW7Tv7NvywKKXqafZo0Lc'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7mW7Tv7NvywKKXqafZo0Lc',\n", + " 'id': '7mW7Tv7NvywKKXqafZo0Lc',\n", + " 'name': 'KPop Demon Hunters Cast',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7mW7Tv7NvywKKXqafZo0Lc'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/2yNNYQBChuox9A5Ka93BIn'},\n", + " 'href': 'https://api.spotify.com/v1/artists/2yNNYQBChuox9A5Ka93BIn',\n", + " 'id': '2yNNYQBChuox9A5Ka93BIn',\n", + " 'name': 'HUNTR/X',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:2yNNYQBChuox9A5Ka93BIn'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/0BJ2EjOqcfgFvlZXNKrNbE'},\n", + " 'href': 'https://api.spotify.com/v1/artists/0BJ2EjOqcfgFvlZXNKrNbE',\n", + " 'id': '0BJ2EjOqcfgFvlZXNKrNbE',\n", + " 'name': 'Saja Boys',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:0BJ2EjOqcfgFvlZXNKrNbE'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/14JkAa6IiFaOh5s0nMyMU9'},\n", + " 'total_tracks': 12},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/2yNNYQBChuox9A5Ka93BIn'},\n", + " 'href': 'https://api.spotify.com/v1/artists/2yNNYQBChuox9A5Ka93BIn',\n", + " 'id': '2yNNYQBChuox9A5Ka93BIn',\n", + " 'name': 'HUNTR/X',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:2yNNYQBChuox9A5Ka93BIn'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/0RMJOzHDhAKY1o2j0W0vxY'},\n", + " 'href': 'https://api.spotify.com/v1/artists/0RMJOzHDhAKY1o2j0W0vxY',\n", + " 'id': '0RMJOzHDhAKY1o2j0W0vxY',\n", + " 'name': 'EJAE',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:0RMJOzHDhAKY1o2j0W0vxY'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/0Wwji82sLA0Hcvtuak3omb'},\n", + " 'href': 'https://api.spotify.com/v1/artists/0Wwji82sLA0Hcvtuak3omb',\n", + " 'id': '0Wwji82sLA0Hcvtuak3omb',\n", + " 'name': 'AUDREY NUNA',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:0Wwji82sLA0Hcvtuak3omb'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/6U1dV7aL68N7Gb0Naq34V5'},\n", + " 'href': 'https://api.spotify.com/v1/artists/6U1dV7aL68N7Gb0Naq34V5',\n", + " 'id': '6U1dV7aL68N7Gb0Naq34V5',\n", + " 'name': 'REI AMI',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:6U1dV7aL68N7Gb0Naq34V5'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/7mW7Tv7NvywKKXqafZo0Lc'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7mW7Tv7NvywKKXqafZo0Lc',\n", + " 'id': '7mW7Tv7NvywKKXqafZo0Lc',\n", + " 'name': 'KPop Demon Hunters Cast',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7mW7Tv7NvywKKXqafZo0Lc'}],\n", + " 'disc_number': 1,\n", + " 'track_number': 4,\n", + " 'duration_ms': 194607,\n", + " 'external_ids': {'isrc': 'QZ8BZ2513510'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1CPZ5BxNNd0n0nF4Orb9JS'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1CPZ5BxNNd0n0nF4Orb9JS',\n", + " 'id': '1CPZ5BxNNd0n0nF4Orb9JS',\n", + " 'name': 'Golden',\n", + " 'uri': 'spotify:track:1CPZ5BxNNd0n0nF4Orb9JS',\n", + " 'is_local': False},\n", + " 'video_thumbnail': {'url': None}},\n", + " {'added_at': '2026-03-20T09:57:09Z',\n", + " 'added_by': {'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'},\n", + " 'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665'},\n", + " 'is_local': False,\n", + " 'primary_color': None,\n", + " 'item': {'is_playable': True,\n", + " 'explicit': False,\n", + " 'type': 'track',\n", + " 'episode': False,\n", + " 'track': True,\n", + " 'album': {'is_playable': True,\n", + " 'type': 'album',\n", + " 'album_type': 'single',\n", + " 'href': 'https://api.spotify.com/v1/albums/4lyqy8FNZ895vlYbOmxV6X',\n", + " 'id': '4lyqy8FNZ895vlYbOmxV6X',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b273faf441738fded13d0abe56a3',\n", + " 'width': 640,\n", + " 'height': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e02faf441738fded13d0abe56a3',\n", + " 'width': 300,\n", + " 'height': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00004851faf441738fded13d0abe56a3',\n", + " 'width': 64,\n", + " 'height': 64}],\n", + " 'name': 'I Just Wanna Sleep',\n", + " 'release_date': '2020-02-21',\n", + " 'release_date_precision': 'day',\n", + " 'uri': 'spotify:album:4lyqy8FNZ895vlYbOmxV6X',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/5k5eiijuHxrGwXp2Pz37GZ'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5k5eiijuHxrGwXp2Pz37GZ',\n", + " 'id': '5k5eiijuHxrGwXp2Pz37GZ',\n", + " 'name': 'Justin Jay',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5k5eiijuHxrGwXp2Pz37GZ'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/7DvbKCrqZ3vbOJZ4dP8Siw'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7DvbKCrqZ3vbOJZ4dP8Siw',\n", + " 'id': '7DvbKCrqZ3vbOJZ4dP8Siw',\n", + " 'name': 'Josh Taylor',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7DvbKCrqZ3vbOJZ4dP8Siw'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/4lyqy8FNZ895vlYbOmxV6X'},\n", + " 'total_tracks': 1},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/5k5eiijuHxrGwXp2Pz37GZ'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5k5eiijuHxrGwXp2Pz37GZ',\n", + " 'id': '5k5eiijuHxrGwXp2Pz37GZ',\n", + " 'name': 'Justin Jay',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5k5eiijuHxrGwXp2Pz37GZ'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/7DvbKCrqZ3vbOJZ4dP8Siw'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7DvbKCrqZ3vbOJZ4dP8Siw',\n", + " 'id': '7DvbKCrqZ3vbOJZ4dP8Siw',\n", + " 'name': 'Josh Taylor',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7DvbKCrqZ3vbOJZ4dP8Siw'}],\n", + " 'disc_number': 1,\n", + " 'track_number': 1,\n", + " 'duration_ms': 193491,\n", + " 'external_ids': {'isrc': 'QM24S2000727'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/4ELCvcgXcbpXStO35iy9uJ'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/4ELCvcgXcbpXStO35iy9uJ',\n", + " 'id': '4ELCvcgXcbpXStO35iy9uJ',\n", + " 'name': 'I Just Wanna Sleep',\n", + " 'uri': 'spotify:track:4ELCvcgXcbpXStO35iy9uJ',\n", + " 'is_local': False},\n", + " 'video_thumbnail': {'url': None}},\n", + " {'added_at': '2026-03-20T10:06:03Z',\n", + " 'added_by': {'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'},\n", + " 'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665'},\n", + " 'is_local': False,\n", + " 'primary_color': None,\n", + " 'item': {'is_playable': True,\n", + " 'explicit': False,\n", + " 'type': 'track',\n", + " 'episode': False,\n", + " 'track': True,\n", + " 'album': {'is_playable': True,\n", + " 'type': 'album',\n", + " 'album_type': 'single',\n", + " 'href': 'https://api.spotify.com/v1/albums/7JVfxJqbr3nhVTN3LoIoQP',\n", + " 'id': '7JVfxJqbr3nhVTN3LoIoQP',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b273236f39ad1278417e20240e02',\n", + " 'width': 640,\n", + " 'height': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e02236f39ad1278417e20240e02',\n", + " 'width': 300,\n", + " 'height': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00004851236f39ad1278417e20240e02',\n", + " 'width': 64,\n", + " 'height': 64}],\n", + " 'name': 'Scared Of Growing Old Alone',\n", + " 'release_date': '2026-02-20',\n", + " 'release_date_precision': 'day',\n", + " 'uri': 'spotify:album:7JVfxJqbr3nhVTN3LoIoQP',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/4KvdzrzAv4feGFhFMulhuX'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4KvdzrzAv4feGFhFMulhuX',\n", + " 'id': '4KvdzrzAv4feGFhFMulhuX',\n", + " 'name': 'Selah Stone',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4KvdzrzAv4feGFhFMulhuX'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/7JVfxJqbr3nhVTN3LoIoQP'},\n", + " 'total_tracks': 3},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/4KvdzrzAv4feGFhFMulhuX'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4KvdzrzAv4feGFhFMulhuX',\n", + " 'id': '4KvdzrzAv4feGFhFMulhuX',\n", + " 'name': 'Selah Stone',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4KvdzrzAv4feGFhFMulhuX'}],\n", + " 'disc_number': 1,\n", + " 'track_number': 2,\n", + " 'duration_ms': 180000,\n", + " 'external_ids': {'isrc': 'QZHNC2621438'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/6H7XwDQRJk7TzO3pkcGwQC'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/6H7XwDQRJk7TzO3pkcGwQC',\n", + " 'id': '6H7XwDQRJk7TzO3pkcGwQC',\n", + " 'name': 'I Gotta Go',\n", + " 'uri': 'spotify:track:6H7XwDQRJk7TzO3pkcGwQC',\n", + " 'is_local': False},\n", + " 'video_thumbnail': {'url': None}},\n", + " {'added_at': '2026-03-20T15:13:49Z',\n", + " 'added_by': {'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'},\n", + " 'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665'},\n", + " 'is_local': False,\n", + " 'primary_color': None,\n", + " 'item': {'is_playable': True,\n", + " 'explicit': False,\n", + " 'type': 'track',\n", + " 'episode': False,\n", + " 'track': True,\n", + " 'album': {'is_playable': True,\n", + " 'type': 'album',\n", + " 'album_type': 'album',\n", + " 'href': 'https://api.spotify.com/v1/albums/1gOrHrLpZFhoWxhCJEiNiL',\n", + " 'id': '1gOrHrLpZFhoWxhCJEiNiL',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b273297fe500cf4445f6b06186df',\n", + " 'width': 640,\n", + " 'height': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e02297fe500cf4445f6b06186df',\n", + " 'width': 300,\n", + " 'height': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00004851297fe500cf4445f6b06186df',\n", + " 'width': 64,\n", + " 'height': 64}],\n", + " 'name': 'TTRRUUCES',\n", + " 'release_date': '2020-06-26',\n", + " 'release_date_precision': 'day',\n", + " 'uri': 'spotify:album:1gOrHrLpZFhoWxhCJEiNiL',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/4fFSyYQa0jRwFSunVahGw8'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4fFSyYQa0jRwFSunVahGw8',\n", + " 'id': '4fFSyYQa0jRwFSunVahGw8',\n", + " 'name': 'TTRRUUCES',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4fFSyYQa0jRwFSunVahGw8'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/1gOrHrLpZFhoWxhCJEiNiL'},\n", + " 'total_tracks': 11},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/4fFSyYQa0jRwFSunVahGw8'},\n", + " 'href': 'https://api.spotify.com/v1/artists/4fFSyYQa0jRwFSunVahGw8',\n", + " 'id': '4fFSyYQa0jRwFSunVahGw8',\n", + " 'name': 'TTRRUUCES',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:4fFSyYQa0jRwFSunVahGw8'}],\n", + " 'disc_number': 1,\n", + " 'track_number': 9,\n", + " 'duration_ms': 229226,\n", + " 'external_ids': {'isrc': 'GB45A1901822'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/34JLYubgqhv4Kxc3TZAkon'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/34JLYubgqhv4Kxc3TZAkon',\n", + " 'id': '34JLYubgqhv4Kxc3TZAkon',\n", + " 'name': \"I'm Alive\",\n", + " 'uri': 'spotify:track:34JLYubgqhv4Kxc3TZAkon',\n", + " 'is_local': False},\n", + " 'video_thumbnail': {'url': None}},\n", + " {'added_at': '2026-03-20T15:38:04Z',\n", + " 'added_by': {'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'},\n", + " 'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665'},\n", + " 'is_local': False,\n", + " 'primary_color': None,\n", + " 'item': {'is_playable': True,\n", + " 'explicit': False,\n", + " 'type': 'track',\n", + " 'episode': False,\n", + " 'track': True,\n", + " 'album': {'is_playable': True,\n", + " 'type': 'album',\n", + " 'album_type': 'album',\n", + " 'href': 'https://api.spotify.com/v1/albums/256wq8yyJVmbIxQNa4dy3Y',\n", + " 'id': '256wq8yyJVmbIxQNa4dy3Y',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b273853df70af8c7105ba55a26ac',\n", + " 'width': 640,\n", + " 'height': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e02853df70af8c7105ba55a26ac',\n", + " 'width': 300,\n", + " 'height': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00004851853df70af8c7105ba55a26ac',\n", + " 'width': 64,\n", + " 'height': 64}],\n", + " 'name': 'When All Else Fails?',\n", + " 'release_date': '2025-08-27',\n", + " 'release_date_precision': 'day',\n", + " 'uri': 'spotify:album:256wq8yyJVmbIxQNa4dy3Y',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/0UMMEX2H03BK9oleRvjHos'},\n", + " 'href': 'https://api.spotify.com/v1/artists/0UMMEX2H03BK9oleRvjHos',\n", + " 'id': '0UMMEX2H03BK9oleRvjHos',\n", + " 'name': 'House of EL',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:0UMMEX2H03BK9oleRvjHos'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/256wq8yyJVmbIxQNa4dy3Y'},\n", + " 'total_tracks': 7},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/0UMMEX2H03BK9oleRvjHos'},\n", + " 'href': 'https://api.spotify.com/v1/artists/0UMMEX2H03BK9oleRvjHos',\n", + " 'id': '0UMMEX2H03BK9oleRvjHos',\n", + " 'name': 'House of EL',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:0UMMEX2H03BK9oleRvjHos'}],\n", + " 'disc_number': 1,\n", + " 'track_number': 3,\n", + " 'duration_ms': 151626,\n", + " 'external_ids': {'isrc': 'QZLBC2506373'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/5bZR33per3NktRxOk5jahP'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/5bZR33per3NktRxOk5jahP',\n", + " 'id': '5bZR33per3NktRxOk5jahP',\n", + " 'name': 'Egyptian Cotton',\n", + " 'uri': 'spotify:track:5bZR33per3NktRxOk5jahP',\n", + " 'is_local': False},\n", + " 'video_thumbnail': {'url': None}},\n", + " {'added_at': '2026-03-20T16:01:05Z',\n", + " 'added_by': {'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'},\n", + " 'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665'},\n", + " 'is_local': False,\n", + " 'primary_color': None,\n", + " 'item': {'is_playable': True,\n", + " 'explicit': False,\n", + " 'type': 'track',\n", + " 'episode': False,\n", + " 'track': True,\n", + " 'album': {'is_playable': True,\n", + " 'type': 'album',\n", + " 'album_type': 'single',\n", + " 'href': 'https://api.spotify.com/v1/albums/6pccPKuOYX6kdQwk7KA9rR',\n", + " 'id': '6pccPKuOYX6kdQwk7KA9rR',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b2739d68e8ef78281da74f7f8b4a',\n", + " 'width': 640,\n", + " 'height': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e029d68e8ef78281da74f7f8b4a',\n", + " 'width': 300,\n", + " 'height': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d000048519d68e8ef78281da74f7f8b4a',\n", + " 'width': 64,\n", + " 'height': 64}],\n", + " 'name': 'Pull Up',\n", + " 'release_date': '2026-03-10',\n", + " 'release_date_precision': 'day',\n", + " 'uri': 'spotify:album:6pccPKuOYX6kdQwk7KA9rR',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3MFpHeyqVwW0n7mZbJPNyE'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3MFpHeyqVwW0n7mZbJPNyE',\n", + " 'id': '3MFpHeyqVwW0n7mZbJPNyE',\n", + " 'name': 'Collect 200',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3MFpHeyqVwW0n7mZbJPNyE'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/6pccPKuOYX6kdQwk7KA9rR'},\n", + " 'total_tracks': 1},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3MFpHeyqVwW0n7mZbJPNyE'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3MFpHeyqVwW0n7mZbJPNyE',\n", + " 'id': '3MFpHeyqVwW0n7mZbJPNyE',\n", + " 'name': 'Collect 200',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3MFpHeyqVwW0n7mZbJPNyE'}],\n", + " 'disc_number': 1,\n", + " 'track_number': 1,\n", + " 'duration_ms': 155538,\n", + " 'external_ids': {'isrc': 'CBEFB2501946'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/2Zk7GbM6pfouSACjW1gtcE'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/2Zk7GbM6pfouSACjW1gtcE',\n", + " 'id': '2Zk7GbM6pfouSACjW1gtcE',\n", + " 'name': 'Pull Up',\n", + " 'uri': 'spotify:track:2Zk7GbM6pfouSACjW1gtcE',\n", + " 'is_local': False},\n", + " 'video_thumbnail': {'url': None}},\n", + " {'added_at': '2026-03-24T19:43:29Z',\n", + " 'added_by': {'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'},\n", + " 'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665'},\n", + " 'is_local': False,\n", + " 'primary_color': None,\n", + " 'item': {'is_playable': True,\n", + " 'explicit': True,\n", + " 'type': 'track',\n", + " 'episode': False,\n", + " 'track': True,\n", + " 'album': {'is_playable': True,\n", + " 'type': 'album',\n", + " 'album_type': 'album',\n", + " 'href': 'https://api.spotify.com/v1/albums/6MP9Ve00hzh3oIeMiecE9R',\n", + " 'id': '6MP9Ve00hzh3oIeMiecE9R',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b273cd12caf7cfa9b3d4e94187c6',\n", + " 'width': 640,\n", + " 'height': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e02cd12caf7cfa9b3d4e94187c6',\n", + " 'width': 300,\n", + " 'height': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00004851cd12caf7cfa9b3d4e94187c6',\n", + " 'width': 64,\n", + " 'height': 64}],\n", + " 'name': 'S.I.O.S.O.S.: Volume One (Digitally Remastered)',\n", + " 'release_date': '2012-10-24',\n", + " 'release_date_precision': 'day',\n", + " 'uri': 'spotify:album:6MP9Ve00hzh3oIeMiecE9R',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/5UEdalZXwxU3mzNl1xWr5y'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5UEdalZXwxU3mzNl1xWr5y',\n", + " 'id': '5UEdalZXwxU3mzNl1xWr5y',\n", + " 'name': 'The Spooks',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5UEdalZXwxU3mzNl1xWr5y'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/6MP9Ve00hzh3oIeMiecE9R'},\n", + " 'total_tracks': 14},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/5UEdalZXwxU3mzNl1xWr5y'},\n", + " 'href': 'https://api.spotify.com/v1/artists/5UEdalZXwxU3mzNl1xWr5y',\n", + " 'id': '5UEdalZXwxU3mzNl1xWr5y',\n", + " 'name': 'The Spooks',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:5UEdalZXwxU3mzNl1xWr5y'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/1k0PI7DPUewud9LeaxM9m6'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1k0PI7DPUewud9LeaxM9m6',\n", + " 'id': '1k0PI7DPUewud9LeaxM9m6',\n", + " 'name': 'Jay Kulkalski',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1k0PI7DPUewud9LeaxM9m6'}],\n", + " 'disc_number': 1,\n", + " 'track_number': 3,\n", + " 'duration_ms': 273973,\n", + " 'external_ids': {'isrc': 'USGZ21243131'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/673OnqT7JuOTkxyfa0BT0t'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/673OnqT7JuOTkxyfa0BT0t',\n", + " 'id': '673OnqT7JuOTkxyfa0BT0t',\n", + " 'name': \"Things I've Seen\",\n", + " 'uri': 'spotify:track:673OnqT7JuOTkxyfa0BT0t',\n", + " 'is_local': False},\n", + " 'video_thumbnail': {'url': None}},\n", + " {'added_at': '2026-03-25T09:29:27Z',\n", + " 'added_by': {'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'},\n", + " 'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665'},\n", + " 'is_local': False,\n", + " 'primary_color': None,\n", + " 'item': {'is_playable': True,\n", + " 'explicit': False,\n", + " 'type': 'track',\n", + " 'episode': False,\n", + " 'track': True,\n", + " 'album': {'is_playable': True,\n", + " 'type': 'album',\n", + " 'album_type': 'single',\n", + " 'href': 'https://api.spotify.com/v1/albums/5RRxkgSIBJ02AUEUf9pi9d',\n", + " 'id': '5RRxkgSIBJ02AUEUf9pi9d',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b273bcb6ddb24695fe8d8e954c51',\n", + " 'width': 640,\n", + " 'height': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e02bcb6ddb24695fe8d8e954c51',\n", + " 'width': 300,\n", + " 'height': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00004851bcb6ddb24695fe8d8e954c51',\n", + " 'width': 64,\n", + " 'height': 64}],\n", + " 'name': 'Dream',\n", + " 'release_date': '2025-08-05',\n", + " 'release_date_precision': 'day',\n", + " 'uri': 'spotify:album:5RRxkgSIBJ02AUEUf9pi9d',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3MFpHeyqVwW0n7mZbJPNyE'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3MFpHeyqVwW0n7mZbJPNyE',\n", + " 'id': '3MFpHeyqVwW0n7mZbJPNyE',\n", + " 'name': 'Collect 200',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3MFpHeyqVwW0n7mZbJPNyE'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/5RRxkgSIBJ02AUEUf9pi9d'},\n", + " 'total_tracks': 1},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3MFpHeyqVwW0n7mZbJPNyE'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3MFpHeyqVwW0n7mZbJPNyE',\n", + " 'id': '3MFpHeyqVwW0n7mZbJPNyE',\n", + " 'name': 'Collect 200',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3MFpHeyqVwW0n7mZbJPNyE'}],\n", + " 'disc_number': 1,\n", + " 'track_number': 1,\n", + " 'duration_ms': 164885,\n", + " 'external_ids': {'isrc': 'CBEFB2501046'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1zQ3aaipEmoZ4tHtwIR28a'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1zQ3aaipEmoZ4tHtwIR28a',\n", + " 'id': '1zQ3aaipEmoZ4tHtwIR28a',\n", + " 'name': 'Dream',\n", + " 'uri': 'spotify:track:1zQ3aaipEmoZ4tHtwIR28a',\n", + " 'is_local': False},\n", + " 'video_thumbnail': {'url': None}},\n", + " {'added_at': '2026-03-25T09:33:10Z',\n", + " 'added_by': {'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'},\n", + " 'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665'},\n", + " 'is_local': False,\n", + " 'primary_color': None,\n", + " 'item': {'is_playable': True,\n", + " 'explicit': True,\n", + " 'type': 'track',\n", + " 'episode': False,\n", + " 'track': True,\n", + " 'album': {'is_playable': True,\n", + " 'type': 'album',\n", + " 'album_type': 'single',\n", + " 'href': 'https://api.spotify.com/v1/albums/2OeZ42uzQXCop2v3xLTK0d',\n", + " 'id': '2OeZ42uzQXCop2v3xLTK0d',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b27355e37e9ddf91fb90c0d9404e',\n", + " 'width': 640,\n", + " 'height': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e0255e37e9ddf91fb90c0d9404e',\n", + " 'width': 300,\n", + " 'height': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d0000485155e37e9ddf91fb90c0d9404e',\n", + " 'width': 64,\n", + " 'height': 64}],\n", + " 'name': 'She Waits',\n", + " 'release_date': '2025-09-16',\n", + " 'release_date_precision': 'day',\n", + " 'uri': 'spotify:album:2OeZ42uzQXCop2v3xLTK0d',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3MFpHeyqVwW0n7mZbJPNyE'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3MFpHeyqVwW0n7mZbJPNyE',\n", + " 'id': '3MFpHeyqVwW0n7mZbJPNyE',\n", + " 'name': 'Collect 200',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3MFpHeyqVwW0n7mZbJPNyE'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/2OeZ42uzQXCop2v3xLTK0d'},\n", + " 'total_tracks': 1},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3MFpHeyqVwW0n7mZbJPNyE'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3MFpHeyqVwW0n7mZbJPNyE',\n", + " 'id': '3MFpHeyqVwW0n7mZbJPNyE',\n", + " 'name': 'Collect 200',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3MFpHeyqVwW0n7mZbJPNyE'}],\n", + " 'disc_number': 1,\n", + " 'track_number': 1,\n", + " 'duration_ms': 177840,\n", + " 'external_ids': {'isrc': 'CBEFB2501279'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/6UPql2upXpCahPme1FzOs6'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/6UPql2upXpCahPme1FzOs6',\n", + " 'id': '6UPql2upXpCahPme1FzOs6',\n", + " 'name': 'She Waits',\n", + " 'uri': 'spotify:track:6UPql2upXpCahPme1FzOs6',\n", + " 'is_local': False},\n", + " 'video_thumbnail': {'url': None}},\n", + " {'added_at': '2026-03-25T09:34:09Z',\n", + " 'added_by': {'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'},\n", + " 'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665'},\n", + " 'is_local': False,\n", + " 'primary_color': None,\n", + " 'item': {'is_playable': True,\n", + " 'explicit': False,\n", + " 'type': 'track',\n", + " 'episode': False,\n", + " 'track': True,\n", + " 'album': {'is_playable': True,\n", + " 'type': 'album',\n", + " 'album_type': 'single',\n", + " 'href': 'https://api.spotify.com/v1/albums/2R5Dy2a0uemGmppzhYGfgS',\n", + " 'id': '2R5Dy2a0uemGmppzhYGfgS',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b273fa4aa2eccb3dfaf4a6cc2fe2',\n", + " 'width': 640,\n", + " 'height': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e02fa4aa2eccb3dfaf4a6cc2fe2',\n", + " 'width': 300,\n", + " 'height': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00004851fa4aa2eccb3dfaf4a6cc2fe2',\n", + " 'width': 64,\n", + " 'height': 64}],\n", + " 'name': 'Prinses Pil',\n", + " 'release_date': '2025-04-25',\n", + " 'release_date_precision': 'day',\n", + " 'uri': 'spotify:album:2R5Dy2a0uemGmppzhYGfgS',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7J41Q5hdwuBgyVo7zGhPhO'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7J41Q5hdwuBgyVo7zGhPhO',\n", + " 'id': '7J41Q5hdwuBgyVo7zGhPhO',\n", + " 'name': 'MEROL',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7J41Q5hdwuBgyVo7zGhPhO'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/1ESdlHhFi2Ww9jt8qLOyYp'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1ESdlHhFi2Ww9jt8qLOyYp',\n", + " 'id': '1ESdlHhFi2Ww9jt8qLOyYp',\n", + " 'name': 'Elmer',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1ESdlHhFi2Ww9jt8qLOyYp'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/2R5Dy2a0uemGmppzhYGfgS'},\n", + " 'total_tracks': 1},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7J41Q5hdwuBgyVo7zGhPhO'},\n", + " 'href': 'https://api.spotify.com/v1/artists/7J41Q5hdwuBgyVo7zGhPhO',\n", + " 'id': '7J41Q5hdwuBgyVo7zGhPhO',\n", + " 'name': 'MEROL',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:7J41Q5hdwuBgyVo7zGhPhO'},\n", + " {'external_urls': {'spotify': 'https://open.spotify.com/artist/1ESdlHhFi2Ww9jt8qLOyYp'},\n", + " 'href': 'https://api.spotify.com/v1/artists/1ESdlHhFi2Ww9jt8qLOyYp',\n", + " 'id': '1ESdlHhFi2Ww9jt8qLOyYp',\n", + " 'name': 'Elmer',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:1ESdlHhFi2Ww9jt8qLOyYp'}],\n", + " 'disc_number': 1,\n", + " 'track_number': 1,\n", + " 'duration_ms': 163197,\n", + " 'external_ids': {'isrc': 'NLX1P2400053'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/1WrwcIHLBhnXY459ybsY6p'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/1WrwcIHLBhnXY459ybsY6p',\n", + " 'id': '1WrwcIHLBhnXY459ybsY6p',\n", + " 'name': 'Prinses Pil',\n", + " 'uri': 'spotify:track:1WrwcIHLBhnXY459ybsY6p',\n", + " 'is_local': False},\n", + " 'video_thumbnail': {'url': None}},\n", + " {'added_at': '2026-03-25T09:46:27Z',\n", + " 'added_by': {'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'},\n", + " 'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665'},\n", + " 'is_local': False,\n", + " 'primary_color': None,\n", + " 'item': {'is_playable': True,\n", + " 'explicit': False,\n", + " 'type': 'track',\n", + " 'episode': False,\n", + " 'track': True,\n", + " 'album': {'is_playable': True,\n", + " 'type': 'album',\n", + " 'album_type': 'single',\n", + " 'href': 'https://api.spotify.com/v1/albums/4cUQUMvniiMM4NVpIxH1Kh',\n", + " 'id': '4cUQUMvniiMM4NVpIxH1Kh',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b2733e8c766fdcd9021b33bbfb8a',\n", + " 'width': 640,\n", + " 'height': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e023e8c766fdcd9021b33bbfb8a',\n", + " 'width': 300,\n", + " 'height': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d000048513e8c766fdcd9021b33bbfb8a',\n", + " 'width': 64,\n", + " 'height': 64}],\n", + " 'name': 'Jet Lag',\n", + " 'release_date': '2026-03-20',\n", + " 'release_date_precision': 'day',\n", + " 'uri': 'spotify:album:4cUQUMvniiMM4NVpIxH1Kh',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3K5sYlHk7RZimjYhUWej8D'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3K5sYlHk7RZimjYhUWej8D',\n", + " 'id': '3K5sYlHk7RZimjYhUWej8D',\n", + " 'name': 'LUIZA',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3K5sYlHk7RZimjYhUWej8D'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/4cUQUMvniiMM4NVpIxH1Kh'},\n", + " 'total_tracks': 1},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/3K5sYlHk7RZimjYhUWej8D'},\n", + " 'href': 'https://api.spotify.com/v1/artists/3K5sYlHk7RZimjYhUWej8D',\n", + " 'id': '3K5sYlHk7RZimjYhUWej8D',\n", + " 'name': 'LUIZA',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:3K5sYlHk7RZimjYhUWej8D'}],\n", + " 'disc_number': 1,\n", + " 'track_number': 1,\n", + " 'duration_ms': 165000,\n", + " 'external_ids': {'isrc': 'FR6F32502790'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/7fRTjRTHXx2NeDsU6V0585'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/7fRTjRTHXx2NeDsU6V0585',\n", + " 'id': '7fRTjRTHXx2NeDsU6V0585',\n", + " 'name': 'Jet Lag',\n", + " 'uri': 'spotify:track:7fRTjRTHXx2NeDsU6V0585',\n", + " 'is_local': False},\n", + " 'video_thumbnail': {'url': None}},\n", + " {'added_at': '2026-03-25T09:50:58Z',\n", + " 'added_by': {'external_urls': {'spotify': 'https://open.spotify.com/user/1124867665'},\n", + " 'href': 'https://api.spotify.com/v1/users/1124867665',\n", + " 'id': '1124867665',\n", + " 'type': 'user',\n", + " 'uri': 'spotify:user:1124867665'},\n", + " 'is_local': False,\n", + " 'primary_color': None,\n", + " 'item': {'is_playable': True,\n", + " 'explicit': False,\n", + " 'type': 'track',\n", + " 'episode': False,\n", + " 'track': True,\n", + " 'album': {'is_playable': True,\n", + " 'type': 'album',\n", + " 'album_type': 'single',\n", + " 'href': 'https://api.spotify.com/v1/albums/22aPi3QZtDAXY5EbHdLLmY',\n", + " 'id': '22aPi3QZtDAXY5EbHdLLmY',\n", + " 'images': [{'url': 'https://i.scdn.co/image/ab67616d0000b27318285e12126f8ec3956fb6a6',\n", + " 'width': 640,\n", + " 'height': 640},\n", + " {'url': 'https://i.scdn.co/image/ab67616d00001e0218285e12126f8ec3956fb6a6',\n", + " 'width': 300,\n", + " 'height': 300},\n", + " {'url': 'https://i.scdn.co/image/ab67616d0000485118285e12126f8ec3956fb6a6',\n", + " 'width': 64,\n", + " 'height': 64}],\n", + " 'name': 'BOBA',\n", + " 'release_date': '2026-03-13',\n", + " 'release_date_precision': 'day',\n", + " 'uri': 'spotify:album:22aPi3QZtDAXY5EbHdLLmY',\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/586uxXMyD5ObPuzjtrzO1Q'},\n", + " 'href': 'https://api.spotify.com/v1/artists/586uxXMyD5ObPuzjtrzO1Q',\n", + " 'id': '586uxXMyD5ObPuzjtrzO1Q',\n", + " 'name': 'SOFI TUKKER',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:586uxXMyD5ObPuzjtrzO1Q'}],\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/album/22aPi3QZtDAXY5EbHdLLmY'},\n", + " 'total_tracks': 1},\n", + " 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/586uxXMyD5ObPuzjtrzO1Q'},\n", + " 'href': 'https://api.spotify.com/v1/artists/586uxXMyD5ObPuzjtrzO1Q',\n", + " 'id': '586uxXMyD5ObPuzjtrzO1Q',\n", + " 'name': 'SOFI TUKKER',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:586uxXMyD5ObPuzjtrzO1Q'}],\n", + " 'disc_number': 1,\n", + " 'track_number': 1,\n", + " 'duration_ms': 180987,\n", + " 'external_ids': {'isrc': 'USA2P2611156'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/2GohKE1tNrKUsZPF4ZzrRT'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/2GohKE1tNrKUsZPF4ZzrRT',\n", + " 'id': '2GohKE1tNrKUsZPF4ZzrRT',\n", + " 'name': 'BOBA',\n", + " 'uri': 'spotify:track:2GohKE1tNrKUsZPF4ZzrRT',\n", + " 'is_local': False},\n", + " 'video_thumbnail': {'url': None}}],\n", + " 'limit': 100,\n", + " 'next': None,\n", + " 'offset': 0,\n", + " 'previous': None,\n", + " 'total': 12},\n", + " 'type': 'playlist',\n", + " 'uri': 'spotify:playlist:6DLduYM0nS1x0XuvEAEHTK'}" + ] + }, + "execution_count": 144, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "playlist" + ] + }, + { + "cell_type": "code", + "execution_count": 145, + "id": "090dc452", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "03 March 2026\n", + "\n", + "12\n" + ] + } + ], + "source": [ + "print(playlist[\"name\"])\n", + "print(playlist[\"description\"])\n", + "print(playlist[\"items\"][\"total\"])" + ] + }, + { + "cell_type": "code", + "execution_count": 146, + "id": "339acf33", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Golden',\n", + " 'I Just Wanna Sleep',\n", + " 'I Gotta Go',\n", + " \"I'm Alive\",\n", + " 'Egyptian Cotton',\n", + " 'Pull Up',\n", + " \"Things I've Seen\",\n", + " 'Dream',\n", + " 'She Waits',\n", + " 'Prinses Pil']" + ] + }, + "execution_count": 146, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "first_10_tracks = [\n", + " item[\"item\"][\"name\"]\n", + " for item in playlist[\"items\"][\"items\"][:10]\n", + "]\n", + "\n", + "first_10_tracks" + ] + }, + { + "cell_type": "code", + "execution_count": 147, + "id": "cafedec2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Golden': ['HUNTR/X',\n", + " 'EJAE',\n", + " 'AUDREY NUNA',\n", + " 'REI AMI',\n", + " 'KPop Demon Hunters Cast'],\n", + " 'I Just Wanna Sleep': ['Justin Jay', 'Josh Taylor'],\n", + " 'I Gotta Go': ['Selah Stone'],\n", + " \"I'm Alive\": ['TTRRUUCES'],\n", + " 'Egyptian Cotton': ['House of EL'],\n", + " 'Pull Up': ['Collect 200'],\n", + " \"Things I've Seen\": ['The Spooks', 'Jay Kulkalski'],\n", + " 'Dream': ['Collect 200'],\n", + " 'She Waits': ['Collect 200'],\n", + " 'Prinses Pil': ['MEROL', 'Elmer']}" + ] + }, + "execution_count": 147, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "track_artist_dict = {\n", + " item[\"item\"][\"name\"]: [artist[\"name\"] for artist in item[\"item\"][\"artists\"]]\n", + " for item in playlist[\"items\"][\"items\"][:10]\n", + "}\n", + "\n", + "track_artist_dict" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cb47da6b", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "course (3.12.12)", "language": "python", "name": "python3" }, @@ -558,7 +6783,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.12.12" } }, "nbformat": 4,