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
[str
]) – Optional filepath to store headers to.headers_raw (
Optional
[str
]) – Optional request headers copied from browser. Otherwise requested from terminal
- Return type:
str
- Returns:
configuration headers string
- ytmusicapi.setup_oauth(client_id: str, client_secret: str, filepath: str | None = None, session: requests.sessions.Session | None = None, proxies: dict | None = None, open_browser: bool = False) ytmusicapi.auth.oauth.token.RefreshingToken
Starts oauth flow from the terminal and returns a string that can be passed to YTMusic()
- Parameters:
client_id (
str
) – 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 (
str
) – Optional. Same as client_id but for the oauth client secret.session (
Optional
[Session
]) – Session to use for authenticationproxies (
Optional
[dict
]) – Proxies to use for authenticationfilepath (
Optional
[str
]) – Optional filepath to store headers to.open_browser (
bool
) – If True, open the default browser with the setup link
- Return type:
- Returns:
configuration headers string