Simplify setup with CLI tool to create headers_auth file

This commit is contained in:
sigma67 2020-03-23 19:51:23 +01:00
commit c038f7dbd5
No known key found for this signature in database
GPG key ID: 1545A01D4474BAF0
5 changed files with 70 additions and 9 deletions

View file

@ -1,22 +1,29 @@
Setup
=====
Installation
------------
.. code-block:: bash
pip install ytmusicapi
**Authenticated requests**
To run authenticated requests you need to copy your request headers from a POST request in your YTMusic Web Client.
Authenticated requests
----------------------
To run authenticated requests you need to set up you need to copy your request headers from a POST request in your YTMusic Web Client.
To do so, follow these steps:
- Copy ``headers_auth.json.example`` (see below) to ``headers_auth.json``
- Open YTMusic in Firefox
- Go to the developer tools (Ctrl-Shift-I) and right click a POST request.
- Open https://music.youtube.com in Firefox
- Go to the developer tools (Ctrl-Shift-I) and find an authenticated POST request. You can filter for /browse to easily find a suitable request.
- Copy the request headers (right click > copy > copy request headers)
- Paste the three missing items to `headers_auth.json`
**headers_auth.json.example**
Now call :py:func:`YTMusic.setup()` and paste the request headers and it will create configuration file
in the correct format in the current directory.
Manual file creation
--------------------
Alternatively, you can paste the three missing items to `headers_auth.json` below and create your own file:
.. literalinclude:: ../../headers_auth.json.example
:language: JSON

View file

@ -13,7 +13,7 @@ Usage
If an endpoint requires authentication you will receive an error:
``Please provide authentication before using this function``
For authenticated requests you need to set up your credentials first: `Setup <setup>`_
For authenticated requests you need to set up your credentials first: :doc:`Setup <setup>`
**Authenticated** request to interact with your playlist: