From 8be7680bb540939ec8003a6117261f9142a1cfda Mon Sep 17 00:00:00 2001 From: kuba Date: Tue, 10 Oct 2023 20:42:49 +0200 Subject: [PATCH] check if youtube-music is accessible --- spotdl/console/entry_point.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spotdl/console/entry_point.py b/spotdl/console/entry_point.py index 5ae0cf1b1..b82b13c26 100644 --- a/spotdl/console/entry_point.py +++ b/spotdl/console/entry_point.py @@ -16,6 +16,7 @@ from spotdl.utils.arguments import parse_arguments from spotdl.utils.config import create_settings from spotdl.utils.console import ACTIONS, generate_initial_config, is_executable +from spotdl.utils.downloader import check_ytmusic_connection from spotdl.utils.ffmpeg import FFmpegError, download_ffmpeg, is_ffmpeg_installed from spotdl.utils.logging import init_logging from spotdl.utils.spotify import SpotifyClient, SpotifyError, save_spotify_cache @@ -75,6 +76,14 @@ def console_entry_point(): "or `spotdl --ffmpeg /path/to/ffmpeg` to specify the path to ffmpeg." ) + # Check if we are not blocked by ytm + if "youtube-music" in downloader_settings["audio_providers"]: + if not check_ytmusic_connection(): + raise DownloaderError( + "You are blocked by YouTube Music. " + "Please use a VPN, change youtube-music to piped, or use other audio providers" + ) + # Initialize spotify client SpotifyClient.init(**spotify_settings) spotify_client = SpotifyClient()