Skip to content

Commit

Permalink
check if youtube-music is accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
xnetcat committed Oct 10, 2023
1 parent 1e30d0a commit 8be7680
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions spotdl/console/entry_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 8be7680

Please sign in to comment.