Setup
See also the Setup page
- ytmusicapi.setup(filepath: str | None = None, headers_raw: str | None = None) str
Requests browser headers from the user via command line and returns a string that can be passed to YTMusic()
- Parameters:
filepath – Optional filepath to store headers to.
headers_raw – Optional request headers copied from browser. Otherwise requested from terminal
- Returns:
configuration headers string
- ytmusicapi.setup_oauth(client_id: str, client_secret: str, filepath: str | None = None, session: Session | None = None, proxies: dict | None = None, open_browser: bool = False) RefreshingToken
Starts oauth flow from the terminal and returns a string that can be passed to YTMusic()
- Parameters:
client_id – Optional. Used to specify the client_id oauth should use for authentication flow. If provided, client_secret MUST also be passed or both will be ignored.
client_secret – Optional. Same as client_id but for the oauth client secret.
session – Session to use for authentication
proxies – Proxies to use for authentication
filepath – Optional filepath to store headers to.
open_browser – If True, open the default browser with the setup link
- Returns:
configuration headers string