yogeshwaran01 / spotify-playlist-to-youtube-playlist

From Spotify's Groove to YouTube's Show: Spot2Tube
https://dev.to/yogeshwaran01/from-spotify-to-youtube-how-i-built-a-python-script-to-convert-playlists-2h89
MIT License
47 stars 5 forks source link

Help Error provlem since last Oauth feature Pull #23

Open Rexadev opened 1 year ago

Rexadev commented 1 year ago
Syncing Playlists ..
Syncing between Spotify: xxand YouTube: xx
Traceback (most recent call last):
  File "D:\spotify-playlist-to-youtube-playlist (yogeshwaran01)\spotify-playlist-to-youtube-playlist-2023-09-07\main.py", line 231, in <module>
    cli()
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\spotify-playlist-to-youtube-playlist (yogeshwaran01)\spotify-playlist-to-youtube-playlist-2023-09-07\main.py", line 161, in sync
    youtube_playlist = youtube.get_playlist(playlist["youtube_playlist_id"])
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\spotify-playlist-to-youtube-playlist (yogeshwaran01)\spotify-playlist-to-youtube-playlist-2023-09-07\youtube_client.py", line 96, in get_playlist
    response = request.execute()
               ^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\googleapiclient\_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\googleapiclient\http.py", line 923, in execute
    resp, content = _retry_request(
                    ^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\googleapiclient\http.py", line 191, in _retry_request
    resp, content = http.request(uri, method, *args, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\google_auth_httplib2.py", line 209, in request
    self.credentials.before_request(self._request, method, uri, request_headers)
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\google\auth\credentials.py", line 135, in before_request
    self.refresh(request)
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\google\oauth2\credentials.py", line 335, in refresh    ) = reauth.refresh_grant(
        ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\google\oauth2\reauth.py", line 351, in refresh_grant
    _client._handle_error_response(response_data, retryable_error)
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\google\oauth2\_client.py", line 73, in _handle_error_response
    raise exceptions.RefreshError(
google.auth.exceptions.RefreshError: ('invalid_grant: Bad Request', {'error': 'invalid_grant', 'error_description': 'Bad Request'})
Press any key to continue . . .
yogeshwaran01 commented 1 year ago

It to be fixed, Delete this file credentials.json

Rexadev commented 1 year ago

It to be fixed, Delete this file credentials.json

i didnt create the file how did it get there

yogeshwaran01 commented 1 year ago

It generated by the script. It stores the credentials. If this credentials expires, throw errors

Rexadev commented 1 year ago

@yogeshwaran01 Still the same serror after deleting the credentials.json

Syncing Playlists ..
Syncing between Spotify: xx and YouTube: xx
Traceback (most recent call last):
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\urllib3\connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\urllib3\util\connection.py", line 95, in create_connection
    raise err
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\urllib3\util\connection.py", line 85, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\urllib3\connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\urllib3\connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\urllib3\connection.py", line 363, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\urllib3\connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x000001A7A0CD4800>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\requests\adapters.py", line 489, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\urllib3\connectionpool.py", line 787, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\urllib3\util\retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
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 0x000001A7A0CD4800>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\spotify-playlist-to-youtube-playlist (yogeshwaran01)\spotify-playlist-to-youtube-playlist-2023-09-07\main.py", line 231, in <module>
    cli()
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\spotify-playlist-to-youtube-playlist (yogeshwaran01)\spotify-playlist-to-youtube-playlist-2023-09-07\main.py", line 160, in sync
    spotify_playlist = spotify.get_playlist(playlist["spotify_playlist_id"])
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\spotify-playlist-to-youtube-playlist (yogeshwaran01)\spotify-playlist-to-youtube-playlist-2023-09-07\spotify_client.py", line 28, in get_playlist
    playlist = self.spotify.playlist(id)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\1 Organized\y System\Python\Lib\site-packages\spotipy\client.py", line 651, in playlist
    return self._get(
           ^^^^^^^^^^
  File "C:\Program Files\1 Organized\y System\Python\Lib\site-packages\spotipy\client.py", line 323, in _get
    return self._internal_call("GET", url, payload, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\1 Organized\y System\Python\Lib\site-packages\spotipy\client.py", line 247, in _internal_call
    headers = self._auth_headers()
              ^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\1 Organized\y System\Python\Lib\site-packages\spotipy\client.py", line 238, in _auth_headers
    token = self.auth_manager.get_access_token(as_dict=False)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\1 Organized\y System\Python\Lib\site-packages\spotipy\oauth2.py", line 238, in get_access_token    token_info = self._request_access_token()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\1 Organized\y System\Python\Lib\site-packages\spotipy\oauth2.py", line 257, in _request_access_token
    response = self._session.post(
               ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\requests\sessions.py", line 635, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\requests\sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\requests\sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User*\AppData\Roaming\Python\Python312\site-packages\requests\adapters.py", line 565, 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 0x000001A7A0CD4800>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))
Press any key to continue . . .
yogeshwaran01 commented 1 year ago

It is a connection error. Check for stable Internet connection.

Rexadev commented 1 year ago

It is a connection error. Check for stable Internet connection.

My internet is good

yogeshwaran01 commented 1 year ago

Try after sometime

Rexadev commented 1 year ago

It worked

But Sometimes it also shows The request cannot be completed because you have exceeded your <a href="/youtube/v3/getting-started#quota">quota</a>.', 'domain': 'youtube.quota', 'reason': 'quotaExceeded'}

Please add feature to show error instead of python line error

Rexadev commented 8 months ago

@yogeshwaran01 project dead