diff --git a/README.md b/README.md index e1b7dff7..825ae407 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,17 @@ ![Stars](https://img.shields.io/github/stars/Footsiefat/zspotify.svg) ![Forks](https://img.shields.io/github/forks/Footsiefat/zspotify.svg) ![Size](https://img.shields.io/github/repo-size/Footsiefat/zspotify) + # ZSpotify ### A Spotify downloader needing only a python interpreter and ffmpeg. +

[Discord Server](https://discord.gg/skVNQKtyFq) - [Matrix Server](https://matrix.to/#/#zspotify:matrix.org) - [Gitea Mirror](https://git.robinsmediateam.dev/Footsiefat/zspotify) - [Main Site](https://footsiefat.github.io/) + ``` Requirements: @@ -27,6 +30,9 @@ Python packages: \*ffmpeg can be installed via apt for Debian-based distros or by downloading the binaries from [ffmpeg.org](https://ffmpeg.org) and placing them in your %PATH% in Windows. Mac users can install it with [Homebrew](https://brew.sh) by running `brew install ffmpeg`. \*\*Git can be installed via apt for Debian-based distros or by downloading the binaries from [git-scm.com](https://git-scm.com/download/win) for Windows. + +### Command line usage: + ``` Basic command line usage: python zspotify Downloads the track, album, playlist or podcast episode specified as a command line argument. If an artist url is given, all albums by specified artist will be downloaded. @@ -54,7 +60,9 @@ Options that can be configured in zs_config.json: ### Docker Usage ``` -Build the docker image from the Dockerfile: +Pull the official docker image (automatically updates): + docker pull cooper7692/zspotify-docker +Or build the docker image yourself from the Dockerfile: docker build -t zspotify . Create and run a container from the image: docker run --rm -v "$PWD/ZSpotify Music:/ZSpotify Music" -v "$PWD/ZSpotify Podcasts:/ZSpotify Podcasts" -it zspotify @@ -66,18 +74,24 @@ Create and run a container from the image: **There have been 2-3 reports from users who received account bans from Spotify for using this tool**. -We recommend using ZSpotify with a burner account. - +We recommend using ZSpotify with a burner account. Alternatively, there is a configuration option labled ```DOWNLOAD_REAL_TIME```, this limits the download speed to the duration of the song being downloaded thus not appearing suspicious to Spotify. This option is much slower and is only recommended for premium users who wish to download songs in 320kbps without buying premium on a burner account. **Use ZSpotify at your own risk**, the developers of ZSpotify are not responsible if your account gets banned. ### What do I do if I see "Your session has been terminated"? + If you see this, don't worry! Just try logging back in. If you see the incorrect username or password error, reset your password and you should be able to log back in and continue using Spotify. ### Contributing + Please refer to [CONTRIBUTING](CONTRIBUTING.md) ### Changelog + Please refer to [CHANGELOG](CHANGELOG.md) + +### Common Errors + +Please refer to [COMMON_ERRORS](COMMON_ERRORS.md) diff --git a/zspotify/app.py b/zspotify/app.py index 0c029d03..ad184df9 100644 --- a/zspotify/app.py +++ b/zspotify/app.py @@ -30,7 +30,8 @@ def client(args) -> None: ZSpotify.DOWNLOAD_QUALITY = AudioQuality.HIGH if args.url: - track_id, album_id, playlist_id, episode_id, show_id, artist_id = regex_input_for_urls(args.url) + track_id, album_id, playlist_id, episode_id, show_id, artist_id = regex_input_for_urls( + args.url) if track_id is not None: download_track(track_id) @@ -43,7 +44,7 @@ def client(args) -> None: name, _ = get_playlist_info(playlist_id) for song in playlist_songs: download_track(song[TRACK][ID], - sanitize_data(name) + '/') + sanitize_data(name) + '/') print('\n') elif episode_id is not None: download_episode(episode_id) @@ -57,7 +58,8 @@ def client(args) -> None: if args.liked_songs: for song in get_saved_tracks(): if not song[TRACK][NAME]: - print('### SKIPPING: SONG DOES NOT EXIST ON SPOTIFY ANYMORE ###') + print( + '### SKIPPING: SONG DOES NOT EXIST ON SPOTIFY ANYMORE ###') else: download_track(song[TRACK][ID], 'Liked Songs/') print('\n') @@ -67,7 +69,8 @@ def client(args) -> None: while len(search_text) == 0: search_text = input('Enter search or URL: ') - track_id, album_id, playlist_id, episode_id, show_id, artist_id = regex_input_for_urls(search_text) + track_id, album_id, playlist_id, episode_id, show_id, artist_id = regex_input_for_urls( + search_text) if track_id is not None: download_track(track_id) @@ -117,7 +120,6 @@ def search(search_term): raise ValueError('Invalid limit passed. Max is 50.\n') params['limit'] = splits[index+1] - if split == '-t' or split == '-type': allowed_types = ['track', 'playlist', 'album', 'artist'] @@ -151,6 +153,7 @@ def search(search_term): counter = 1 dics = [] + total_tracks = 0 if TRACK in params['type'].split(','): tracks = resp[TRACKS][ITEMS] if len(tracks) > 0: @@ -165,20 +168,20 @@ def search(search_term): track_data.append([counter, f'{track[NAME]} {explicit}', ','.join([artist[NAME] for artist in track[ARTISTS]])]) dics.append({ - ID : track[ID], - NAME : track[NAME], - 'type' : TRACK, + ID: track[ID], + NAME: track[NAME], + 'type': TRACK, }) counter += 1 total_tracks = counter - 1 - print(tabulate(track_data, headers=['S.NO', 'Name', 'Artists'], tablefmt='pretty')) + print(tabulate(track_data, headers=[ + 'S.NO', 'Name', 'Artists'], tablefmt='pretty')) print('\n') del tracks del track_data - else: - total_tracks = 0 + total_albums = 0 if ALBUM in params['type'].split(','): albums = resp[ALBUMS][ITEMS] if len(albums) > 0: @@ -188,20 +191,20 @@ def search(search_term): album_data.append([counter, album[NAME], ','.join([artist[NAME] for artist in album[ARTISTS]])]) dics.append({ - ID : album[ID], - NAME : album[NAME], - 'type' : ALBUM, + ID: album[ID], + NAME: album[NAME], + 'type': ALBUM, }) counter += 1 total_albums = counter - total_tracks - 1 - print(tabulate(album_data, headers=['S.NO', 'Album', 'Artists'], tablefmt='pretty')) + print(tabulate(album_data, headers=[ + 'S.NO', 'Album', 'Artists'], tablefmt='pretty')) print('\n') del albums del album_data - else: - total_albums = 0 + total_artists = 0 if ARTIST in params['type'].split(','): artists = resp[ARTISTS][ITEMS] if len(artists) > 0: @@ -210,39 +213,39 @@ def search(search_term): for artist in artists: artist_data.append([counter, artist[NAME]]) dics.append({ - ID : artist[ID], - NAME : artist[NAME], - 'type' : ARTIST, + ID: artist[ID], + NAME: artist[NAME], + 'type': ARTIST, }) counter += 1 total_artists = counter - total_tracks - total_albums - 1 - print(tabulate(artist_data, headers=['S.NO', 'Name'], tablefmt='pretty')) + print(tabulate(artist_data, headers=[ + 'S.NO', 'Name'], tablefmt='pretty')) print('\n') del artists del artist_data - else: - total_artists = 0 + total_playlists = 0 if PLAYLIST in params['type'].split(','): playlists = resp[PLAYLISTS][ITEMS] if len(playlists) > 0: print('### PLAYLISTS ###') playlist_data = [] for playlist in playlists: - playlist_data.append([counter, playlist[NAME], playlist[OWNER][DISPLAY_NAME]]) + playlist_data.append( + [counter, playlist[NAME], playlist[OWNER][DISPLAY_NAME]]) dics.append({ - ID : playlist[ID], - NAME : playlist[NAME], - 'type' : PLAYLIST, + ID: playlist[ID], + NAME: playlist[NAME], + 'type': PLAYLIST, }) counter += 1 total_playlists = counter - total_artists - total_tracks - total_albums - 1 - print(tabulate(playlist_data, headers=['S.NO', 'Name', 'Owner'], tablefmt='pretty')) + print(tabulate(playlist_data, headers=[ + 'S.NO', 'Name', 'Owner'], tablefmt='pretty')) print('\n') del playlists del playlist_data - else: - total_playlists = 0 if total_tracks + total_albums + total_artists + total_playlists == 0: print('NO RESULTS FOUND - EXITING...')