More detailed Setup Doc
I changed the instructions for getting the headers_auth file to be easier to understand.
This commit is contained in:
parent
6b51e11bb4
commit
7835d229dd
1 changed files with 16 additions and 4 deletions
|
|
@ -14,12 +14,24 @@ To run authenticated requests you need to set up you need to copy your request h
|
||||||
To do so, follow these steps:
|
To do so, follow these steps:
|
||||||
|
|
||||||
- Open https://music.youtube.com in Firefox
|
- 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.
|
- Go to the developer tools (Ctrl-Shift-I) and open the "Network" tab.
|
||||||
|
- Find an authenticated POST request (Status: 200, Method: POST, Domain: music.youtube.com, File: log_event?...). You can filter for /browse to easily find a suitable request.
|
||||||
- Copy the request headers (right click > copy > copy request headers)
|
- Copy the request headers (right click > copy > copy request headers)
|
||||||
|
|
||||||
Now call :py:func:`YTMusic.setup` with the parameter ``filepath=headers_auth.json`` and paste the request headers to the terminal input.
|
Now open a python console and call :py:func:`YTMusic.setup` with the parameter ``filepath=headers_auth.json`` and follow the instructions and paste the request headers to the terminal input:
|
||||||
If you don't want terminal interaction you can pass the request headers with the ``headers_raw`` parameter.
|
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from ytmusicapi import YTMusic
|
||||||
|
YTMusic.setup(filepath=headers_auth.json)
|
||||||
|
|
||||||
|
If you don't want terminal interaction you can pass the request headers with the ``headers_raw`` parameter:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from ytmusicapi import YTMusic
|
||||||
|
YTMusic.setup(filepath=headers_auth.json, headers_raw="very long string")
|
||||||
|
|
||||||
The function returns a JSON string with the credentials needed for :doc:`Usage <usage>`. Alternatively, if you passed the filepath parameter as described above,
|
The function returns a JSON string with the credentials needed for :doc:`Usage <usage>`. Alternatively, if you passed the filepath parameter as described above,
|
||||||
a file called ``headers_auth.json`` will be created in the current directory, which you can pass to ``YTMusic()`` for authentication.
|
a file called ``headers_auth.json`` will be created in the current directory, which you can pass to ``YTMusic()`` for authentication.
|
||||||
|
|
||||||
|
|
@ -31,4 +43,4 @@ Manual file creation
|
||||||
Alternatively, you can paste the cookie to ``headers_auth.json`` below and create your own file:
|
Alternatively, you can paste the cookie to ``headers_auth.json`` below and create your own file:
|
||||||
|
|
||||||
.. literalinclude:: ../../headers_auth.json.example
|
.. literalinclude:: ../../headers_auth.json.example
|
||||||
:language: JSON
|
:language: JSON
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue