nathom / streamrip

A scriptable music downloader for Qobuz, Tidal, SoundCloud, and Deezer
GNU General Public License v3.0
2.6k stars 226 forks source link

[BUG] Deezer: unable to stream #224

Closed elvetemedve closed 2 years ago

elvetemedve commented 2 years ago

Describe the bug

Certain tracks can't be downloaded. The following message appears

Unable to stream <name-of-the-track>. Message:

Command Used

rip url "https://www.deezer.com/en/track/722768412"

Debug Traceback

DEBUG:streamrip:Config loaded
DEBUG:streamrip:Parsed urls: [('deezer', 'track', '722768412')]
DEBUG:streamrip:Searching for {'id': '722768412'} in database
DEBUG:streamrip:Executing SELECT EXISTS(SELECT 1 FROM downloads WHERE id=?)
DEBUG:streamrip:{'id': '722768412'}
DEBUG:streamrip:{'downloads': {'folder': '/home/geza/StreamripDownloads', 'source_subdirectories': False, 'concurrency': {'enabled': True, 'max_connections': 3}}, 'qobuz': {'quality': 3, 'download_booklets': True, 'email': '', 'password': '', 'app_id': '', 'secrets': []}, 'tidal': {'quality': 3, 'download_videos': True, 'user_id': '', 'country_code': '', 'access_token': '', 'refresh_token': '', 'token_expiry': ''}, 'deezer': {'quality': 2, 'arl': 'f8faec15311a2a907b6f946acc06bad3dc54d99035d567d1951224ab89c2c4089fd7a9a14f4ecd9ff46f0e4ea8761a6734868f555197f4a6d41c2dfd4106650450617b12d8f5a728e76830be185fff104bccf3abdc95ef1c3af000fbfd18b49f', 'use_deezloader': True, 'deezloader_warnings': True}, 'soundcloud': {'quality': 0, 'client_id': '', 'app_version': ''}, 'youtube': {'quality': 0, 'download_videos': False, 'video_downloads_folder': ''}, 'database': {'downloads': {'enabled': True, 'path': '/home/geza/.config/streamrip/downloads.db'}, 'failed_downloads': {'enabled': True, 'path': '/home/geza/.config/streamrip/failed_downloads.db'}}, 'conversion': {'enabled': False, 'codec': 'ALAC', 'sampling_rate': 48000, 'bit_depth': 24, 'lossy_bitrate': 320}, 'filters': {'extras': False, 'repeats': False, 'non_albums': False, 'features': False, 'non_studio_albums': False, 'non_remaster': False}, 'artwork': {'embed': True, 'size': 'large', 'max_width': -1, 'max_height': -1, 'keep_hires_cover': True}, 'metadata': {'set_playlist_to_album': True, 'new_playlist_tracknumbers': True, 'exclude': []}, 'filepaths': {'add_singles_to_folder': False, 'folder_format': '{albumartist} - {title} ({year}) [{container}] [{bit_depth}B-{sampling_rate}kHz]', 'track_format': '{tracknumber}. {artist} - {title}', 'restrict_characters': False}, 'lastfm': {'source': 'qobuz', 'fallback_source': 'deezer'}, 'theme': {'progress_bar': 'dainty'}, 'misc': {'version': '1.7'}}
DEBUG:streamrip:Arguments from config: {'restrict_filenames': False, 'parent_folder': '/home/geza/StreamripDownloads', 'folder_format': '{albumartist} - {title} ({year}) [{container}] [{bit_depth}B-{sampling_rate}kHz]', 'track_format': '{tracknumber}. {artist} - {title}', 'embed_cover': True, 'embed_cover_size': 'large', 'keep_hires_cover': True, 'set_playlist_to_album': True, 'stay_temp': False, 'conversion': {'enabled': False, 'codec': 'ALAC', 'sampling_rate': 48000, 'bit_depth': 24, 'lossy_bitrate': 320}, 'concurrent_downloads': True, 'max_connections': 3, 'new_tracknumbers': True, 'download_videos': True, 'download_booklets': True, 'download_youtube_videos': False, 'youtube_video_downloads_folder': '', 'add_singles_to_folder': False, 'max_artwork_width': -1, 'max_artwork_height': -1, 'exclude_tags': []}
DEBUG:streamrip:Loading metadata
DEBUG:streamrip:{'id': 722768412, 'readable': False, 'title': 'Hyperfolk (Struscio Mix)', 'title_short': 'Hyperfolk', 'title_version': '(Struscio Mix)', 'isrc': 'ITA810300161', 'link': 'https://www.deezer.com/track/722768412', 'share': 'https://www.deezer.com/track/722768412?utm_source=deezer&utm_content=track-722768412&utm_term=0_1636408794&utm_medium=web', 'duration': 310, 'track_position': 12, 'disk_number': 1, 'rank': 100000, 'release_date': '2007-04-18', 'explicit_lyrics': False, 'explicit_content_lyrics': 2, 'explicit_content_cover': 2, 'preview': 'https://cdns-preview-e.dzcdn.net/stream/c-e5777d6cb19bb49dde17a5910bf47046-2.mp3', 'bpm': 0, 'gain': -10.8, 'available_countries': ['AU', 'NZ'], 'contributors': [{'id': 280664, 'name': 'The Soundlovers', 'link': 'https://www.deezer.com/artist/280664', 'share': 'https://www.deezer.com/artist/280664?utm_source=deezer&utm_content=artist-280664&utm_term=0_1636408794&utm_medium=web', 'picture': 'https://api.deezer.com/artist/280664/image', 'picture_small': 'https://e-cdns-images.dzcdn.net/images/artist/e9a71fa7848ef9a80204818058f8caa9/56x56-000000-80-0-0.jpg', 'picture_medium': 'https://e-cdns-images.dzcdn.net/images/artist/e9a71fa7848ef9a80204818058f8caa9/250x250-000000-80-0-0.jpg', 'picture_big': 'https://e-cdns-images.dzcdn.net/images/artist/e9a71fa7848ef9a80204818058f8caa9/500x500-000000-80-0-0.jpg', 'picture_xl': 'https://e-cdns-images.dzcdn.net/images/artist/e9a71fa7848ef9a80204818058f8caa9/1000x1000-000000-80-0-0.jpg', 'radio': True, 'tracklist': 'https://api.deezer.com/artist/280664/top?limit=50', 'type': 'artist', 'role': 'Main'}], 'md5_image': '26c73adbacff4ce30ae8e7176cca8eb6', 'artist': {'id': 280664, 'name': 'The Soundlovers', 'link': 'https://www.deezer.com/artist/280664', 'share': 'https://www.deezer.com/artist/280664?utm_source=deezer&utm_content=artist-280664&utm_term=0_1636408794&utm_medium=web', 'picture': 'https://api.deezer.com/artist/280664/image', 'picture_small': 'https://e-cdns-images.dzcdn.net/images/artist/e9a71fa7848ef9a80204818058f8caa9/56x56-000000-80-0-0.jpg', 'picture_medium': 'https://e-cdns-images.dzcdn.net/images/artist/e9a71fa7848ef9a80204818058f8caa9/250x250-000000-80-0-0.jpg', 'picture_big': 'https://e-cdns-images.dzcdn.net/images/artist/e9a71fa7848ef9a80204818058f8caa9/500x500-000000-80-0-0.jpg', 'picture_xl': 'https://e-cdns-images.dzcdn.net/images/artist/e9a71fa7848ef9a80204818058f8caa9/1000x1000-000000-80-0-0.jpg', 'radio': True, 'tracklist': 'https://api.deezer.com/artist/280664/top?limit=50', 'type': 'artist'}, 'album': {'id': 105725762, 'title': '96-06 (10th Anniversary (DJs Only)) 10th Anniversary (DJs Only)', 'link': 'https://www.deezer.com/album/105725762', 'cover': 'https://api.deezer.com/album/105725762/image', 'cover_small': 'https://e-cdns-images.dzcdn.net/images/cover/26c73adbacff4ce30ae8e7176cca8eb6/56x56-000000-80-0-0.jpg', 'cover_medium': 'https://e-cdns-images.dzcdn.net/images/cover/26c73adbacff4ce30ae8e7176cca8eb6/250x250-000000-80-0-0.jpg', 'cover_big': 'https://e-cdns-images.dzcdn.net/images/cover/26c73adbacff4ce30ae8e7176cca8eb6/500x500-000000-80-0-0.jpg', 'cover_xl': 'https://e-cdns-images.dzcdn.net/images/cover/26c73adbacff4ce30ae8e7176cca8eb6/1000x1000-000000-80-0-0.jpg', 'md5_image': '26c73adbacff4ce30ae8e7176cca8eb6', 'release_date': '2007-04-18', 'tracklist': 'https://api.deezer.com/album/105725762/tracks', 'type': 'album'}, 'type': 'track'}
Downloading The Soundlovers - Hyperfolk (Struscio Mix)

DEBUG:streamrip:Track meta formatter {'tracknumber': 12, 'artist': 'The Soundlovers', 'albumartist': None, 'composer': None, 'title': 'Hyperfolk (Struscio Mix)', 'albumcomposer': None}
DEBUG:streamrip:Formatter keys: <filter object at 0x7f254c3ab460>
DEBUG:streamrip:Formatted path: /home/geza/StreamripDownloads/12. The Soundlovers - Hyperfolk (Struscio Mix).flac
DEBUG:streamrip:Downloading cover from https://e-cdns-images.dzcdn.net/images/cover/26c73adbacff4ce30ae8e7176cca8eb6/500x500-000000-80-0-0.jpg
Cover |██████████████████████████████████████████████████████████████████████████████████████████████| 00:00 left at 15.9MB/s 
DEBUG:streamrip:Track info: {'ALB_ID': '105725762', 'ALB_PICTURE': '26c73adbacff4ce30ae8e7176cca8eb6', 'ALB_TITLE': '96-06 (10th Anniversary (DJs Only)) 10th Anniversary (DJs Only)', 'ARTISTS': [{'ART_ID': '280664', 'ROLE_ID': '0', 'ARTISTS_SONGS_ORDER': '0', 'ART_NAME': 'The Soundlovers', 'ARTIST_IS_DUMMY': False, 'ART_PICTURE': 'e9a71fa7848ef9a80204818058f8caa9', 'RANK': '266615', 'LOCALES': [], '__TYPE__': 'artist'}], 'ART_ID': '280664', 'ART_NAME': 'The Soundlovers', 'ARTIST_IS_DUMMY': False, 'DIGITAL_RELEASE_DATE': '2007-04-18', 'DISK_NUMBER': '1', 'DURATION': '310', 'EXPLICIT_LYRICS': '0', 'EXPLICIT_TRACK_CONTENT': {'EXPLICIT_LYRICS_STATUS': 2, 'EXPLICIT_COVER_STATUS': 2}, 'FALLBACK': {'ALB_ID': '1266527', 'ALB_PICTURE': 'e9a71fa7848ef9a80204818058f8caa9', 'ALB_TITLE': '96-06 Djs Only (10Th Anniversary)', 'ARTISTS': [{'ART_ID': '280664', 'ROLE_ID': '0', 'ARTISTS_SONGS_ORDER': '1', 'ART_NAME': 'The Soundlovers', 'ARTIST_IS_DUMMY': False, 'ART_PICTURE': 'e9a71fa7848ef9a80204818058f8caa9', 'RANK': '266615', 'LOCALES': [], '__TYPE__': 'artist'}], 'ART_ID': '280664', 'ART_NAME': 'The Soundlovers', 'ARTIST_IS_DUMMY': False, 'DIGITAL_RELEASE_DATE': '2007-04-18', 'DISK_NUMBER': '1', 'DURATION': '311', 'EXPLICIT_LYRICS': '0', 'EXPLICIT_TRACK_CONTENT': {'EXPLICIT_LYRICS_STATUS': 0, 'EXPLICIT_COVER_STATUS': 2}, 'GENRE_ID': '27', 'HIERARCHICAL_TITLE': '', 'ISRC': 'ITA810300161', 'LYRICS_ID': 0, 'PHYSICAL_RELEASE_DATE': '2007-04-18', 'PROVIDER_ID': '1', 'RANK': '57562', 'SMARTRADIO': 0, 'SNG_CONTRIBUTORS': {'main_artist': ['The Soundlovers'], 'composer': ['M. Molella', 'N. aarts', 'R. Santini'], 'author': ['M. Molella', 'N. aarts', 'R. Santini']}, 'SNG_ID': '13839281', 'SNG_TITLE': 'Hyperfolk', 'STATUS': 1, 'TRACK_NUMBER': '12', 'USER_ID': 0, 'VERSION': '(Struscio Mix)', 'MD5_ORIGIN': 'b66d307420d4a021f15f063ae8d30bee', 'FILESIZE_AAC_64': '0', 'FILESIZE_MP3_64': '0', 'FILESIZE_MP3_128': '4975803', 'FILESIZE_MP3_256': '0', 'FILESIZE_MP3_320': '12463104', 'FILESIZE_FLAC': '0', 'FILESIZE': '4975803', 'GAIN': '-10.8', 'MEDIA_VERSION': '1', 'TRACK_TOKEN': 'AAAAAWGJndthircb7IweoV53gf_zR8gxKomWNuMIuFUvdMtgNsd4W2stKgxIeD1-09m0jHmWv8yk_39MfApfyTTMlYyPnGvZ-NCP1yOb_zGm_kEWsLxhOG8V47bamraadwJlcmZ0bAF-TdjWyg', 'TRACK_TOKEN_EXPIRE': 1636480795, 'MEDIA': [{'TYPE': 'preview', 'HREF': 'http://cdn-preview-a.deezer.com/stream/c-adc65316fb3316a46a0fd8606ab12ea2-1.mp3'}], 'RIGHTS': {'STREAM_ADS_AVAILABLE': True, 'STREAM_ADS': '2000-01-01', 'STREAM_SUB_AVAILABLE': True, 'STREAM_SUB': '2000-01-01'}, '__TYPE__': 'song'}, 'GENRE_ID': '0', 'HIERARCHICAL_TITLE': '', 'ISRC': 'ITA810300161', 'LYRICS_ID': 0, 'PHYSICAL_RELEASE_DATE': '2007-04-18', 'PROVIDER_ID': '426', 'RANK': '100000', 'SMARTRADIO': 0, 'SNG_CONTRIBUTORS': {'main_artist': ['The Soundlovers']}, 'SNG_ID': '722768412', 'SNG_TITLE': 'Hyperfolk', 'STATUS': 1, 'TRACK_NUMBER': '12', 'USER_ID': 0, 'VERSION': '(Struscio Mix)', 'MD5_ORIGIN': '49e466de7674df55287ee63d75ec2620', 'FILESIZE_AAC_64': '0', 'FILESIZE_MP3_64': '0', 'FILESIZE_MP3_128': '4975803', 'FILESIZE_MP3_256': '0', 'FILESIZE_MP3_320': '12439509', 'FILESIZE_FLAC': '35758947', 'FILESIZE': '4975803', 'GAIN': '-10.8', 'MEDIA_VERSION': '2', 'TRACK_TOKEN': 'AAAAAWGJndthircbLZhcLvlzR1c6wLlXL97rUjyMFskgfjTj7XNiLO8oO5a5sM5E16UJg2AowliOOCGZLIB7BwUSz4oZJpdU7Ceq6Ah8UWJ3rq96FFRbM6kCEA8Aj82wHpUbEMbS9EUc9xSUVnPUp4SS', 'TRACK_TOKEN_EXPIRE': 1636480795, 'MEDIA': [{'TYPE': 'preview', 'HREF': 'http://cdn-preview-e.deezer.com/stream/c-e5777d6cb19bb49dde17a5910bf47046-2.mp3'}], 'RIGHTS': {}, '__TYPE__': 'song'}
DEBUG:streamrip:WrongGeolocation()
Unable to stream The Soundlovers - Hyperfolk (Struscio Mix). Message: 
DEBUG:streamrip:Executing INSERT INTO failed_downloads (source, media_type, id) VALUES (?, ?, ?)
DEBUG:streamrip:Items to add: ('deezer', 'track', '722768412')
DEBUG:streamrip:UNIQUE constraint failed: failed_downloads.id

Config File

[downloads]
# Folder where tracks are downloaded to
folder = "/home/geza/StreamripDownloads"
# Put Qobuz albums in a 'Qobuz' folder, Tidal albums in 'Tidal' etc.
source_subdirectories = false

[downloads.concurrency]
# Download (and convert) tracks all at once, instead of sequentially. 
# If you are converting the tracks, or have fast internet, this will 
# substantially improve processing speed.
enabled = true
# The maximum number of tracks to download at once
# If you have very fast internet, you will benefit from a higher value,
# A value that is too high for your bandwidth may cause slowdowns
max_connections = 3

[qobuz]
# 1: 320kbps MP3, 2: 16/44.1, 3: 24/<=96, 4: 24/>=96
quality = 3
# This will download booklet pdfs that are included with some albums
download_booklets = true

email = ""
# This is an md5 hash of the plaintext password
password = ""
# Do not change
app_id = ""
# Do not change
secrets = []

[tidal]
# 0: 256kbps AAC, 1: 320kbps AAC, 2: 16/44.1 "HiFi" FLAC, 3: 24/44.1 "MQA" FLAC
quality = 3
# This will download videos included in Video Albums.
download_videos = true

# Do not change any of the fields below
user_id = ""
country_code = ""
access_token = ""
refresh_token = ""
# Tokens last 1 week after refresh. This is the Unix timestamp of the expiration
# time. If you haven't used streamrip in more than a week, you may have to log
# in again using `rip config --tidal`
token_expiry = ""

[deezer]
# 0, 1, or 2
# This only applies to paid Deezer subscriptions. Those using deezloader
# are automatically limited to quality = 1
quality = 2
# An authentication cookie that allows streamrip to use your Deezer account
# See https://github.com/nathom/streamrip/wiki/Finding-Your-Deezer-ARL-Cookie
# for instructions on how to find this
arl = "****"
# This allows for free 320kbps MP3 downloads from Deezer
# If an arl is provided, deezloader is never used
use_deezloader = true
# This warns you when the paid deezer account is not logged in and rip falls
# back to deezloader, which is unreliable
deezloader_warnings = true

[soundcloud]
# Only 0 is available for now
quality = 0
# This changes periodically, so it needs to be updated
client_id = ""
app_version = ""

[youtube]
# Only 0 is available for now
quality = 0
# Download the video along with the audio
download_videos = false
# The path to download the videos to
video_downloads_folder = ""

# This stores a list of item IDs so that repeats are not downloaded.

[database.downloads]
enabled = true
path = "/home/geza/.config/streamrip/downloads.db"

# If a download fails, the item ID is stored here. Then, `rip repair` can be
# called to retry the downloads

[database.failed_downloads]
enabled = true
path = "/home/geza/.config/streamrip/failed_downloads.db"

# Convert tracks to a codec after downloading them.

[conversion]
enabled = false
# FLAC, ALAC, OPUS, MP3, VORBIS, or AAC
codec = "ALAC"
# In Hz. Tracks are downsampled if their sampling rate is greater than this. 
# Value of 48000 is recommended to maximize quality and minimize space
sampling_rate = 48000
# Only 16 and 24 are available. It is only applied when the bit depth is higher
# than this value.
bit_depth = 24
# Only applicable for lossy codecs
lossy_bitrate = 320

# Filter a Qobuz artist's discography. Set to 'true' to turn on a filter.

[filters]
# Remove Collectors Editions, live recordings, etc.
extras = false
# Picks the highest quality out of albums with identical titles.
repeats = false
# Remove EPs and Singles
non_albums = false
# Remove albums whose artist is not the one requested
features = false
# Skip non studio albums
non_studio_albums = false
# Only download remastered albums
non_remaster = false

[artwork]
# Write the image to the audio file
embed = true
# The size of the artwork to embed. Options: thumbnail, small, large, original.
# "original" images can be up to 30MB, and may fail embedding. 
# Using "large" is recommended.
size = "large"
# Both of these options limit the size of the embedded artwork. If their values
# are larger than the actual dimensions of the image, they will be ignored.
# If either value is -1, the image is left untouched.
max_width = -1
max_height = -1
# Save the cover image at the highest quality as a seperate jpg file
keep_hires_cover = true

[metadata]
# Sets the value of the 'ALBUM' field in the metadata to the playlist's name. 
# This is useful if your music library software organizes tracks based on album name.
set_playlist_to_album = true
# Replaces the original track's tracknumber with it's position in the playlist
new_playlist_tracknumbers = true
# The following metadata tags won't be applied
# See https://github.com/nathom/streamrip/wiki/Metadata-Tag-Names for more info
exclude = []

# Changes the folder and file names generated by streamrip.

[filepaths]
# Create folders for single tracks within the downloads directory using the folder_format
# template
add_singles_to_folder = false
# Available keys: "albumartist", "title", "year", "bit_depth", "sampling_rate",
# "container", "id", and "albumcomposer"
folder_format = "{albumartist} - {title} ({year}) [{container}] [{bit_depth}B-{sampling_rate}kHz]"
# Available keys: "tracknumber", "artist", "albumartist", "composer", "title",
# and "albumcomposer"
track_format = "{tracknumber}. {artist} - {title}"
# Only allow printable ASCII characters in filenames.
restrict_characters = false

# Last.fm playlists are downloaded by searching for the titles of the tracks

[lastfm]
# The source on which to search for the tracks.
source = "qobuz"
# If no results were found with the primary source, the item is searched for 
# on this one.
fallback_source = "deezer"

[theme]
# Options: "dainty" or "plain"
progress_bar = "dainty"

[misc]
# Metadata to identify this config file. Do not change.
version = "1.7"

Operating System

Linux

streamrip version

1.7

Screenshots and recordings

No response

Additional context

The same track can be streamed in a web browser, so it's not territorial restriction which causes it. The account has an active HiFi subscription plan.

elvetemedve commented 2 years ago

I managed to debug the actual error message coming back from the API:

{
  "data": [
    {
      "errors": [
        {
          "code": 2002,
          "message": "Track token has no sufficient rights on requested media."
        }
      ]
    }
  ]
}
Mikusho commented 2 years ago

same here.... 😭

elvetemedve commented 2 years ago

Maybe I'm wrong, but I believe that's because rip tries to download a track in FLAC format, but the best quality available for that track is MP3.

The screenshot shows the formats requested by the web player: media formats MP3_320, MP3_128 MP3_64 MP3_MISC

The request for the same track in rip looks like this:

{
  "license_token": "****",
  "media": [
    {
      "type": "FULL",
      "formats": [
        {
          "cipher": "BF_CBC_STRIPE",
          "format": "FLAC"
        }
      ]
    }
  ],
  "track_tokens": [
    "****"
  ]
}

Since the track is not available in FLAC, it can't be downloaded, but that error is reported as if it was a permission issue.

elvetemedve commented 2 years ago

@Tibo-29 That sounds like a workaround rather than a fix. Let's assume you want to grab an album where some of the tracks are available as FLAC, while others not. Probably you still want to get the highest possible quality. With your approach all tracks will be downloaded in low quality format.

At least the error message should tell what the real problem is (currently no reason is shown). So that the user can decide what to do next:

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

dajhorn commented 2 years ago

This bug persists into streamrip-1.9.5 and can happen even if the entire album is available as FLAC.

dajhorn commented 2 years ago

The first six tracks in this album will express the bug: https://www.deezer.com/album/1372008

Mutex01 commented 1 year ago

I would love to fix this. 10% is not downloadable because of this. How can I approch it?