update oauth docs and request interactive input instead of aborting (#694)

* update oauth docs and request interactive input instead of aborting

* move input inside oauth path, improve filename output

* update oauth.rst
This commit is contained in:
sigma67 2024-12-17 22:35:28 +01:00 • committed by GitHub
commit cdd4e38a57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 10 deletions

View file

@ -1,7 +1,16 @@
OAuth authentication
====================
After you have installed ``ytmusicapi``, simply run
.. attention::
As of November 2024, YouTube Music requires a Client Id and Secret for the YouTube Data API to connect to the API.
Go to the `YouTube Data API docs <https://developers.google.com/youtube/registering_an_application>`_ to
obtain the credentials. This requires a Google Cloud Console account and project.
For your new credentials, select ``OAuth client ID`` and pick ``TVs and Limited Input devices``.
After you have installed ``ytmusicapi``, run
.. code-block:: bash
@ -11,5 +20,11 @@ and follow the instructions. This will create a file ``oauth.json`` in the curre
You can pass this file to :py:class:`YTMusic` as explained in :doc:`../usage`.
You will also need to pass ``client_id`` and ``client_secret`` to :py:class:`YTMusic`:
.. code-block::
ytmusic = YTMusic('oauth.json', oauth_credentials=OAuthCredentials(client_id=client_id, client_secret=client_secret)
This OAuth flow uses the
`Google API flow for TV devices <https://developers.google.com/youtube/v3/guides/auth/devices>`_.
`Google API flow for TV devices <https://developers.google.com/youtube/v3/guides/auth/devices>`_.