mirror of
https://github.com/glomatico/votify.git
synced 2026-09-27 03:22:39 +02:00
add cookies_browser option
This commit is contained in:
+14
-3
@@ -141,13 +141,18 @@ def load_config_file(
|
||||
is_flag=True,
|
||||
help="Don't print exceptions.",
|
||||
)
|
||||
# SpotifyApi specific options
|
||||
@click.option(
|
||||
"--cookies-path",
|
||||
type=Path,
|
||||
default=spotify_api_sig.parameters["cookies_path"].default,
|
||||
default=Path("./cookies.txt"),
|
||||
help="Path to cookies file.",
|
||||
)
|
||||
@click.option(
|
||||
"--cookies-browser",
|
||||
type=str,
|
||||
default=None,
|
||||
help="Browser to use to get cookies instead of loading a file.",
|
||||
)
|
||||
# Downloader specific options
|
||||
@click.option(
|
||||
"--output-path",
|
||||
@@ -351,6 +356,7 @@ def main(
|
||||
log_level: str,
|
||||
no_exceptions: bool,
|
||||
cookies_path: Path,
|
||||
cookies_browser: str,
|
||||
output_path: Path,
|
||||
temp_path: Path,
|
||||
wvd_path: Path,
|
||||
@@ -389,7 +395,12 @@ def main(
|
||||
)
|
||||
logger.setLevel(log_level)
|
||||
logger.info("Starting Votify")
|
||||
spotify_api = SpotifyApi(cookies_path)
|
||||
if cookies_browser:
|
||||
spotify_api = SpotifyApi.from_browser(cookies_browser)
|
||||
else:
|
||||
if not cookies_path.exists():
|
||||
logger.critical(X_NOT_FOUND_STRING.format("Cookies file", cookies_path))
|
||||
spotify_api = SpotifyApi.from_file(cookies_path)
|
||||
if spotify_api.config_info["isAnonymous"]:
|
||||
logger.critical(
|
||||
"Failed to get a valid session. Try logging in and exporting your cookies again"
|
||||
|
||||
Reference in New Issue
Block a user