From 9b5e011752f249a79958a2492e9921751c6dcba2 Mon Sep 17 00:00:00 2001 From: titijoli2-ai Date: Tue, 30 Jun 2026 02:51:07 +0200 Subject: [PATCH 1/2] Add files via upload --- lab-apis.ipynb | 1734 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 1670 insertions(+), 64 deletions(-) diff --git a/lab-apis.ipynb b/lab-apis.ipynb index e923554..25625f4 100644 --- a/lab-apis.ipynb +++ b/lab-apis.ipynb @@ -25,41 +25,67 @@ ] }, { - "cell_type": "markdown", - "id": "47d71611-c617-4972-a0c3-7090c24b399c", + "cell_type": "code", + "execution_count": 1, + "id": "96c91ecd-999a-4030-84fc-61474fcfafb1", "metadata": {}, + "outputs": [], "source": [ - "Save your client ID and your client secret in your preferred way, and read it or load it into the following variables:" + "import spotipy\n", + "from spotipy.oauth2 import SpotifyClientCredentials" ] }, { - "cell_type": "code", - "execution_count": null, - "id": "ea44c82a-5c07-4dbc-beb2-bba2601bb75e", + "cell_type": "markdown", + "id": "47d71611-c617-4972-a0c3-7090c24b399c", "metadata": {}, - "outputs": [], "source": [ - "CLIENT_ID = \"\"\n", - "CLIENT_SECRET = \"\"" + "Save your client ID and your client secret in your preferred way, and read it or load it into the following variables:" ] }, { "cell_type": "code", - "execution_count": null, - "id": "319cfd4e-f6fb-4419-80e0-e3983cd25e43", + "execution_count": 11, + "id": "ea44c82a-5c07-4dbc-beb2-bba2601bb75e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n" + ] + } + ], "source": [ - "CLIENT_ID = \"4109b2d9f5014671863bb2df1d1fbdd3\"\n", - "CLIENT_SECRET = \"5cb719fae80c4191a9c0b288f51bfe50\"" + "CLIENT_ID = \"698d718410ec4a88a6083db676db71da\"\n", + "CLIENT_SECRET = \"f736b2228bf24425ad0ac6941e7bc07f\"\n", + "print(type(CLIENT_ID))\n", + "print(type(CLIENT_SECRET))" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "04e12954-fd70-4311-88a5-fb7e2c29799c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Defaulting to user installation because normal site-packages is not writeable\n", + "Requirement already satisfied: spotipy in C:\\Users\\PC\\AppData\\Roaming\\Python\\Python314\\site-packages (2.26.0)\n", + "Requirement already satisfied: redis>=3.5.3 in C:\\Users\\PC\\AppData\\Roaming\\Python\\Python314\\site-packages (from spotipy) (8.0.1)\n", + "Requirement already satisfied: requests>=2.25.0 in C:\\Users\\PC\\AppData\\Roaming\\Python\\Python314\\site-packages (from spotipy) (2.32.5)\n", + "Requirement already satisfied: urllib3>=1.26.0 in C:\\Users\\PC\\AppData\\Roaming\\Python\\Python314\\site-packages (from spotipy) (2.6.3)\n", + "Requirement already satisfied: charset_normalizer<4,>=2 in C:\\Users\\PC\\AppData\\Roaming\\Python\\Python314\\site-packages (from requests>=2.25.0->spotipy) (3.4.4)\n", + "Requirement already satisfied: idna<4,>=2.5 in C:\\Users\\PC\\AppData\\Roaming\\Python\\Python314\\site-packages (from requests>=2.25.0->spotipy) (3.11)\n", + "Requirement already satisfied: certifi>=2017.4.17 in C:\\Users\\PC\\AppData\\Roaming\\Python\\Python314\\site-packages (from requests>=2.25.0->spotipy) (2026.1.4)\n" + ] + } + ], "source": [ "# If you havent done so, install the spotipy wrapper\n", "!pip install spotipy" @@ -75,7 +101,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "03034bc6-9858-412a-83b7-18abdc345d7e", "metadata": {}, "outputs": [], @@ -88,6 +114,64 @@ " client_secret=CLIENT_SECRET))\n" ] }, + { + "cell_type": "code", + "execution_count": 16, + "id": "b98fc61c-672a-4100-b2e0-e8550f582e76", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['tracks'])" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "results = sp.search(q='Lady Gaga', limit=10)\n", + "results.keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "08b93bb7-562c-42fe-985c-584d0e34992c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Poker Face\n", + "Shallow\n", + "Die With A Smile\n", + "Bad Romance\n", + "Always Remember Us This Way\n", + "Judas\n", + "Just Dance\n", + "Abracadabra\n", + "Alejandro\n", + "Telephone\n" + ] + } + ], + "source": [ + "for track in results[\"tracks\"][\"items\"]:\n", + " print(track[\"name\"])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6d252951-7e6a-4c9b-a855-e70a56b7b721", + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "id": "8fed9628-08d7-4290-a4be-5527696b01c5", @@ -106,95 +190,1171 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "7772a1e0-9692-4d04-a590-76111a272d8d", "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': 12,\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/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/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/6LY3AerY6KNGOPsNPL63Kk'},\n", + " 'href': 'https://api.spotify.com/v1/albums/6LY3AerY6KNGOPsNPL63Kk',\n", + " 'id': '6LY3AerY6KNGOPsNPL63Kk',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273a5d31644260279be8d0c46c0'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02a5d31644260279be8d0c46c0'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851a5d31644260279be8d0c46c0'}],\n", + " 'is_playable': True,\n", + " 'name': 'Born This Way (International Special Edition Version)',\n", + " 'release_date': '2011-05-23',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 23,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:6LY3AerY6KNGOPsNPL63Kk'},\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': 249066,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM71104998'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/7F25roCtYi55JouckaayPC'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/7F25roCtYi55JouckaayPC',\n", + " 'id': '7F25roCtYi55JouckaayPC',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Judas',\n", + " 'track_number': 4,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:7F25roCtYi55JouckaayPC'},\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/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/15t0kN9X1UtCJ1XHnKk6H3'},\n", + " 'href': 'https://api.spotify.com/v1/albums/15t0kN9X1UtCJ1XHnKk6H3',\n", + " 'id': '15t0kN9X1UtCJ1XHnKk6H3',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b2732e0830bb20df176018c18391'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e022e0830bb20df176018c18391'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d000048512e0830bb20df176018c18391'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Fame Monster (France FNAC Version)',\n", + " 'release_date': '2009-01-01',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 25,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:15t0kN9X1UtCJ1XHnKk6H3'},\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/3nbh5VQkQMLPuoHtpt6N5c'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/3nbh5VQkQMLPuoHtpt6N5c',\n", + " 'id': '3nbh5VQkQMLPuoHtpt6N5c',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Alejandro',\n", + " 'track_number': 2,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:3nbh5VQkQMLPuoHtpt6N5c'},\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/15t0kN9X1UtCJ1XHnKk6H3'},\n", + " 'href': 'https://api.spotify.com/v1/albums/15t0kN9X1UtCJ1XHnKk6H3',\n", + " 'id': '15t0kN9X1UtCJ1XHnKk6H3',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b2732e0830bb20df176018c18391'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e022e0830bb20df176018c18391'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d000048512e0830bb20df176018c18391'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Fame Monster (France FNAC Version)',\n", + " 'release_date': '2009-01-01',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 25,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:15t0kN9X1UtCJ1XHnKk6H3'},\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/6vWDO969PvNqNYHIOW5v0m'},\n", + " 'href': 'https://api.spotify.com/v1/artists/6vWDO969PvNqNYHIOW5v0m',\n", + " 'id': '6vWDO969PvNqNYHIOW5v0m',\n", + " 'name': 'Beyoncé',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:6vWDO969PvNqNYHIOW5v0m'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 220626,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM70905541'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/3MzuXxZE0yAT3ypwNVfmBJ'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/3MzuXxZE0yAT3ypwNVfmBJ',\n", + " 'id': '3MzuXxZE0yAT3ypwNVfmBJ',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Telephone',\n", + " 'track_number': 6,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:3MzuXxZE0yAT3ypwNVfmBJ'}]}}" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "results = sp.search(q='Lady Gaga', limit=50)\n", + "results = sp.search(q='Lady Gaga', limit=10)\n", "results" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "id": "edc14c95-474b-4e2a-aea3-bdfd0a205546", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['tracks'])" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results.keys() # We can see that we only have tracks" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "id": "ad8ef934-1dbb-4008-ac8e-f5c29823fe6a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "dict_keys(['href', 'limit', 'next', 'offset', 'previous', 'total', 'items'])" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"].keys() # Let's check the values" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "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": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"href\"] # Query we have searched " ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "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/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/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/6LY3AerY6KNGOPsNPL63Kk'},\n", + " 'href': 'https://api.spotify.com/v1/albums/6LY3AerY6KNGOPsNPL63Kk',\n", + " 'id': '6LY3AerY6KNGOPsNPL63Kk',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b273a5d31644260279be8d0c46c0'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e02a5d31644260279be8d0c46c0'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00004851a5d31644260279be8d0c46c0'}],\n", + " 'is_playable': True,\n", + " 'name': 'Born This Way (International Special Edition Version)',\n", + " 'release_date': '2011-05-23',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 23,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:6LY3AerY6KNGOPsNPL63Kk'},\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': 249066,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM71104998'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/7F25roCtYi55JouckaayPC'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/7F25roCtYi55JouckaayPC',\n", + " 'id': '7F25roCtYi55JouckaayPC',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Judas',\n", + " 'track_number': 4,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:7F25roCtYi55JouckaayPC'},\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/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/15t0kN9X1UtCJ1XHnKk6H3'},\n", + " 'href': 'https://api.spotify.com/v1/albums/15t0kN9X1UtCJ1XHnKk6H3',\n", + " 'id': '15t0kN9X1UtCJ1XHnKk6H3',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b2732e0830bb20df176018c18391'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e022e0830bb20df176018c18391'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d000048512e0830bb20df176018c18391'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Fame Monster (France FNAC Version)',\n", + " 'release_date': '2009-01-01',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 25,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:15t0kN9X1UtCJ1XHnKk6H3'},\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/3nbh5VQkQMLPuoHtpt6N5c'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/3nbh5VQkQMLPuoHtpt6N5c',\n", + " 'id': '3nbh5VQkQMLPuoHtpt6N5c',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Alejandro',\n", + " 'track_number': 2,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:3nbh5VQkQMLPuoHtpt6N5c'},\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/15t0kN9X1UtCJ1XHnKk6H3'},\n", + " 'href': 'https://api.spotify.com/v1/albums/15t0kN9X1UtCJ1XHnKk6H3',\n", + " 'id': '15t0kN9X1UtCJ1XHnKk6H3',\n", + " 'images': [{'height': 640,\n", + " 'width': 640,\n", + " 'url': 'https://i.scdn.co/image/ab67616d0000b2732e0830bb20df176018c18391'},\n", + " {'height': 300,\n", + " 'width': 300,\n", + " 'url': 'https://i.scdn.co/image/ab67616d00001e022e0830bb20df176018c18391'},\n", + " {'height': 64,\n", + " 'width': 64,\n", + " 'url': 'https://i.scdn.co/image/ab67616d000048512e0830bb20df176018c18391'}],\n", + " 'is_playable': True,\n", + " 'name': 'The Fame Monster (France FNAC Version)',\n", + " 'release_date': '2009-01-01',\n", + " 'release_date_precision': 'day',\n", + " 'total_tracks': 25,\n", + " 'type': 'album',\n", + " 'uri': 'spotify:album:15t0kN9X1UtCJ1XHnKk6H3'},\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/6vWDO969PvNqNYHIOW5v0m'},\n", + " 'href': 'https://api.spotify.com/v1/artists/6vWDO969PvNqNYHIOW5v0m',\n", + " 'id': '6vWDO969PvNqNYHIOW5v0m',\n", + " 'name': 'Beyoncé',\n", + " 'type': 'artist',\n", + " 'uri': 'spotify:artist:6vWDO969PvNqNYHIOW5v0m'}],\n", + " 'disc_number': 1,\n", + " 'duration_ms': 220626,\n", + " 'explicit': False,\n", + " 'external_ids': {'isrc': 'USUM70905541'},\n", + " 'external_urls': {'spotify': 'https://open.spotify.com/track/3MzuXxZE0yAT3ypwNVfmBJ'},\n", + " 'href': 'https://api.spotify.com/v1/tracks/3MzuXxZE0yAT3ypwNVfmBJ',\n", + " 'id': '3MzuXxZE0yAT3ypwNVfmBJ',\n", + " 'is_local': False,\n", + " 'is_playable': True,\n", + " 'name': 'Telephone',\n", + " 'track_number': 6,\n", + " 'type': 'track',\n", + " 'uri': 'spotify:track:3MzuXxZE0yAT3ypwNVfmBJ'}]" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"items\"] #items (actual tracks)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "id": "529fff56-47d3-4d78-8ff5-9530fe290d1d", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "10" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"limit\"]#Limit we have chosen" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "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": 25, + "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": 26, "id": "f5ccdf79-5d9e-40de-adb9-2cc1e5b7c74a", "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"offset\"] # Actual offset (starting point)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "id": "356730c1-60a2-4ea8-bd2c-e0522bab8a4d", "metadata": {}, "outputs": [], @@ -204,10 +1364,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "id": "7c44c8fd-63ea-45ba-94bd-5c5e8e1458b3", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "12" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"total\"] # Number of matches" ] @@ -222,33 +1393,115 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "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": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"items\"][0] # Explore the first song" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "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": 30, + "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": 31, "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": 31, + "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": 32, "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": 33, "id": "6a826e9c-d2e7-4537-a82c-3dc3a2b80b9f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'1QV6tiMFM6fSOKOGLMHYYg'" + ] + }, + "execution_count": 33, + "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": 34, "id": "a5bd871b-6087-4680-819c-1a1d8ba879bc", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'Poker Face'" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Track name\n", "results[\"tracks\"][\"items\"][0][\"name\"] " @@ -290,15 +1573,49 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 36, "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[36]\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": [ "# Popularity index\n", "results[\"tracks\"][\"items\"][0][\"popularity\"] " ] }, + { + "cell_type": "code", + "execution_count": 37, + "id": "0c4f74f5-37dc-48e1-8077-e5c7ae0b9b76", + "metadata": {}, + "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": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "results[\"tracks\"][\"items\"][0].keys() ## The popularity field is not available in the current Spotify API response\n", + "# results[\"tracks\"][\"items\"][0][\"popularity\"]" + ] + }, { "cell_type": "markdown", "id": "0e81c762-e6c5-424e-a4eb-12ab45dffb9f", @@ -315,10 +1632,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 38, "id": "8bcdccfc-dde9-4f4b-8af5-3caa335b89b5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'spotify:track:1QV6tiMFM6fSOKOGLMHYYg'" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "results[\"tracks\"][\"items\"][0][\"uri\"]" ] @@ -353,6 +1681,180 @@ "Combine the above steps to create a playlist that includes the top tracks of your favorite artists and the top tracks of the artists related to them." ] }, + { + "cell_type": "code", + "execution_count": 43, + "id": "46e93b3f-430d-4453-9886-224ae1f986ff", + "metadata": {}, + "outputs": [], + "source": [ + "#1- List artists\n", + "\n", + "artists = [\"Lady Gaga\", \"Beyonce\", \"Stromae\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "id": "7e1bc8f5-c003-44bb-acbb-52dfd6f7bd3a", + "metadata": {}, + "outputs": [], + "source": [ + "# Get the first 5 tracks returned by Spotify for one artist\n", + "def get_top_tracks(artist_name):\n", + " results = sp.search(q=artist_name, type=\"track\", limit=5)\n", + " \n", + " tracks = []\n", + " \n", + " for item in results[\"tracks\"][\"items\"]:\n", + " tracks.append(item[\"name\"])\n", + " \n", + " return tracks\n" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "id": "1b9d7f1d-3e8f-49c0-9052-204119bc5561", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Poker Face',\n", + " 'Shallow',\n", + " 'Die With A Smile',\n", + " 'Bad Romance',\n", + " 'Always Remember Us This Way']" + ] + }, + "execution_count": 45, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\n", + "get_top_tracks(\"Lady Gaga\")" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "id": "ff49c427-cdaa-432f-9377-d2f91b7f6fbf", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[['Poker Face',\n", + " 'Shallow',\n", + " 'Die With A Smile',\n", + " 'Bad Romance',\n", + " 'Always Remember Us This Way'],\n", + " ['Crazy In Love (feat. JAY-Z)',\n", + " \"TEXAS HOLD 'EM\",\n", + " 'Drunk in Love (feat. JAY-Z)',\n", + " 'Halo',\n", + " 'Crazy In Love (feat. JAY-Z)'],\n", + " ['Alors on danse - Radio Edit',\n", + " 'Formidable',\n", + " 'Papaoutai',\n", + " 'Tous les mêmes',\n", + " 'L’enfer']]" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#2Fetch Top Tracks\n", + "\n", + "artists = [\"Lady Gaga\", \"Beyoncé\", \"Stromae\"]\n", + "\n", + "top_tracks_list = [get_top_tracks(artist) for artist in artists]\n", + "\n", + "top_tracks_list" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "id": "a23d63f6-ba77-4450-94f3-194fca69f7d4", + "metadata": {}, + "outputs": [], + "source": [ + "#3 Find the first 5 related artists\n", + "def find_related_artists(artist_name):\n", + "\n", + " # Get the artist ID\n", + " result = sp.search(q=artist_name, type=\"artist\", limit=1)\n", + "\n", + " artist_id = result[\"artists\"][\"items\"][0][\"id\"]\n", + "\n", + " # Get related artists\n", + " related = sp.artist_related_artists(artist_id)\n", + "\n", + " # Return the first 5 names\n", + " return [artist[\"name\"] for artist in related[\"artists\"][:5]]" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "id": "6364d6dd-240a-4d74-be37-0be29e13f60d", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "HTTP Error for GET to https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms/related-artists with Params: {} returned 403 due to Forbidden\n" + ] + }, + { + "ename": "SpotifyException", + "evalue": "http status: 403, code: -1 - https://api.spotify.com/v1/artists/1HY2Jd0NmPuamShAr6KMms/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~\\AppData\\Roaming\\Python\\Python314\\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~\\AppData\\Roaming\\Python\\Python314\\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/1HY2Jd0NmPuamShAr6KMms/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[49]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[43mfind_related_artists\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mLady Gaga\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[48]\u001b[39m\u001b[32m, line 10\u001b[39m, in \u001b[36mfind_related_artists\u001b[39m\u001b[34m(artist_name)\u001b[39m\n\u001b[32m 7\u001b[39m artist_id = result[\u001b[33m\"\u001b[39m\u001b[33martists\u001b[39m\u001b[33m\"\u001b[39m][\u001b[33m\"\u001b[39m\u001b[33mitems\u001b[39m\u001b[33m\"\u001b[39m][\u001b[32m0\u001b[39m][\u001b[33m\"\u001b[39m\u001b[33mid\u001b[39m\u001b[33m\"\u001b[39m]\n\u001b[32m 9\u001b[39m \u001b[38;5;66;03m# Get related artists\u001b[39;00m\n\u001b[32m---> \u001b[39m\u001b[32m10\u001b[39m related = \u001b[43msp\u001b[49m\u001b[43m.\u001b[49m\u001b[43martist_related_artists\u001b[49m\u001b[43m(\u001b[49m\u001b[43martist_id\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 12\u001b[39m \u001b[38;5;66;03m# Return the first 5 names\u001b[39;00m\n\u001b[32m 13\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m [artist[\u001b[33m\"\u001b[39m\u001b[33mname\u001b[39m\u001b[33m\"\u001b[39m] \u001b[38;5;28;01mfor\u001b[39;00m artist \u001b[38;5;129;01min\u001b[39;00m related[\u001b[33m\"\u001b[39m\u001b[33martists\u001b[39m\u001b[33m\"\u001b[39m][:\u001b[32m5\u001b[39m]]\n", + "\u001b[36mFile \u001b[39m\u001b[32m~\\AppData\\Roaming\\Python\\Python314\\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~\\AppData\\Roaming\\Python\\Python314\\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~\\AppData\\Roaming\\Python\\Python314\\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/1HY2Jd0NmPuamShAr6KMms/related-artists:\n Forbidden, reason: None" + ] + } + ], + "source": [ + "find_related_artists(\"Lady Gaga\")" + ] + }, + { + "cell_type": "markdown", + "id": "058d9b50-9c90-4186-9013-01a552fa5a15", + "metadata": {}, + "source": [ + "The related artists endpoint returned a 403 Forbidden error. This endpoint is deprecated/restricted by Spotify, so this part of the exercise cannot be completed with the current API access." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ff36ef2b-ef8b-4161-a246-020363d96105", + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "id": "0c442378-e26f-47c8-b4f1-b4fa07089935", @@ -383,12 +1885,10 @@ { "cell_type": "code", "execution_count": null, - "id": "29694252-f217-454d-8881-681b2b6eeb1e", + "id": "d67fa80a-0727-43f0-a7aa-475c9fb4e428", "metadata": {}, "outputs": [], - "source": [ - "# Your answer here" - ] + "source": [] }, { "cell_type": "markdown", @@ -404,14 +1904,56 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 50, "id": "25fb0cf8-c13a-41b0-b8f8-7e0700fd1e41", "metadata": {}, - "outputs": [], + "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~\\AppData\\Roaming\\Python\\Python314\\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~\\AppData\\Roaming\\Python\\Python314\\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[50]\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~\\AppData\\Roaming\\Python\\Python314\\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~\\AppData\\Roaming\\Python\\Python314\\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~\\AppData\\Roaming\\Python\\Python314\\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": 51, + "id": "b8b580f5-5297-45b7-a2a4-4360dc135525", + "metadata": {}, + "outputs": [], + "source": [ + "### Note\n", + "\n", + "#The `featured_playlists()` endpoint returned a **403 Forbidden** error.\n", + "\n", + "#This method is now deprecated or restricted by Spotify, \n", + "#so the featured playlists part of the exercise cannot be completed with the current API access." + ] + }, { "cell_type": "markdown", "id": "90f558f3-c638-4df4-b5a4-e24f7847d52a", @@ -431,10 +1973,37 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 52, "id": "46d35121-9256-4cf4-81f5-118b87f7af32", "metadata": {}, - "outputs": [], + "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~\\AppData\\Roaming\\Python\\Python314\\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~\\AppData\\Roaming\\Python\\Python314\\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[52]\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~\\AppData\\Roaming\\Python\\Python314\\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~\\AppData\\Roaming\\Python\\Python314\\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~\\AppData\\Roaming\\Python\\Python314\\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)" @@ -442,10 +2011,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 53, "id": "5260f67f-6024-4fee-8449-30904f03bf76", "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'playlist' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mNameError\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[53]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[38;5;28mprint\u001b[39m(\u001b[43mplaylist\u001b[49m[\u001b[33m'\u001b[39m\u001b[33mname\u001b[39m\u001b[33m'\u001b[39m]) \u001b[38;5;66;03m# Print the playlist's name\u001b[39;00m\n\u001b[32m 2\u001b[39m \u001b[38;5;28mprint\u001b[39m(playlist[\u001b[33m'\u001b[39m\u001b[33mdescription\u001b[39m\u001b[33m'\u001b[39m]) \u001b[38;5;66;03m# Print the playlist's description\u001b[39;00m\n", + "\u001b[31mNameError\u001b[39m: name 'playlist' is not defined" + ] + } + ], "source": [ "print(playlist['name']) # Print the playlist's name\n", "print(playlist['description']) # Print the playlist's description" @@ -506,6 +2087,31 @@ "print(artists_list)" ] }, + { + "cell_type": "markdown", + "id": "8c873b96-9249-4ee2-801d-061f4883c345", + "metadata": {}, + "source": [ + "### Note on Spotify API limitations\n", + "\n", + "Several endpoints used in this lab are no longer available with standard Spotify API access.\n", + "\n", + "Observed issues:\n", + "- `artist_related_artists()` → 403 Forbidden\n", + "- `featured_playlists()` → 403 Forbidden\n", + "- `sp.playlist(\"37i9dQZF1DXd9zR7tdziuQ\")` → 404 Resource not found\n", + "\n", + "The code was implemented according to the official Spotipy documentation and the lab instructions, but recent Spotify API changes prevent these sections from being completed as originally designed." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b6776902-142d-4181-a298-9d4b628b13b1", + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "id": "7b52207e-a4f0-4f90-9f4e-3170d7f0f3fe", @@ -558,7 +2164,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.14.3" } }, "nbformat": 4, From 6798f53c5fde51cb4173d2fb3d7ad5355cf75d52 Mon Sep 17 00:00:00 2001 From: titijoli2-ai Date: Tue, 30 Jun 2026 03:13:36 +0200 Subject: [PATCH 2/2] Add files via upload Remove Spotify credentials --- lab-apis.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lab-apis.ipynb b/lab-apis.ipynb index 25625f4..11ea4f1 100644 --- a/lab-apis.ipynb +++ b/lab-apis.ipynb @@ -59,8 +59,8 @@ } ], "source": [ - "CLIENT_ID = \"698d718410ec4a88a6083db676db71da\"\n", - "CLIENT_SECRET = \"f736b2228bf24425ad0ac6941e7bc07f\"\n", + "CLIENT_ID = \"\"\n", + "CLIENT_SECRET = \"\"\n", "print(type(CLIENT_ID))\n", "print(type(CLIENT_SECRET))" ]