Closed PogusTheWhisper closed 4 days ago
Make sure you edit these variables, you can get them from here https://developer.spotify.com/ create a test app copy paste the required variables on first run it will ask for spotify authorisation from browser so make sure you are logged in spotify.com after authorisation the script will start searching for all available songs.
INFO:main:Reading song names from song_names.xlsx INFO:main:Searching for songs on Spotify INFO:spotipy.oauth2:User authentication requires interaction with your web browser. Once you enter your credentials and give authorization, you will be redirected to a url. Paste that url you were directed to to complete the authorization. INFO:spotipy.oauth2:Opened https://accounts.spotify.com/authorize?client_id=48509606f37b4dd19bede9ccb01e6245&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fcallback&scope=playlist-modify-private in your browser gio: https://accounts.spotify.com/authorize?client_id=48509606f37b4dd19bede9ccb01e6245&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fcallback&scope=playlist-modify-private: Operation not supported Traceback (most recent call last): File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/urllib3/connection.py", line 199, in _new_conn sock = connection.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection raise err File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/urllib3/util/connection.py", line 73, in create_connection sock.connect(sa) OSError: [Errno 101] Network is unreachable
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/urllib3/connectionpool.py", line 789, in urlopen response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/urllib3/connectionpool.py", line 490, in _make_request raise new_e File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/urllib3/connectionpool.py", line 466, in _make_request self._validate_conn(conn) File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1095, in _validate_conn conn.connect() File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/urllib3/connection.py", line 693, in connect self.sock = sock = self._new_conn() ^^^^^^^^^^^^^^^^ File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/urllib3/connection.py", line 214, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fbdcf445810>: Failed to establish a new connection: [Errno 101] Network is unreachable
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/requests/adapters.py", line 667, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/urllib3/connectionpool.py", line 843, in urlopen retries = retries.increment( ^^^^^^^^^^^^^^^^^^ File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/urllib3/util/retry.py", line 519, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='accounts.spotify.com', port=443): Max retries exceeded with url: /api/token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fbdcf445810>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/pogus_ubuntu/VScode/Apple-Music-to-Spotify/create_spotify_playlist.py", line 106, in
main()
File "/home/pogus_ubuntu/VScode/Apple-Music-to-Spotify/create_spotify_playlist.py", line 71, in main
track_uri = search_song_on_spotify(song_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pogus_ubuntu/VScode/Apple-Music-to-Spotify/create_spotify_playlist.py", line 43, in search_song_on_spotify
results = sp.search(q=song_name, type='track', limit=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/spotipy/client.py", line 602, in search
return self._get(
^^^^^^^^^^
File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/spotipy/client.py", line 327, in _get
return self._internal_call("GET", url, payload, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/spotipy/client.py", line 251, in _internal_call
headers = self._auth_headers()
^^^^^^^^^^^^^^^^^^^^
File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/spotipy/client.py", line 242, in _auth_headers
token = self.auth_manager.get_access_token(as_dict=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/spotipy/oauth2.py", line 541, in get_access_token
response = self._session.post(
^^^^^^^^^^^^^^^^^^^
File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/requests/sessions.py", line 637, in post
return self.request("POST", url, data=data, json=json, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pogus_ubuntu/.cache/pypoetry/virtualenvs/apple-music-to-spotify-dAFSZHIC-py3.11/lib/python3.11/site-packages/requests/adapters.py", line 700, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='accounts.spotify.com', port=443): Max retries exceeded with url: /api/token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fbdcf445810>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Notifications was not provided by any .service files