nathom / streamrip

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

[BUG] Deezer downloads appear to be corrupt (unable to transcode) #636

Open Jpixta opened 9 months ago

Jpixta commented 9 months ago

Describe the bug

Downloaded .flac files from deezer using streamrip appear to be corrupt. Tested on multiple .flac downloads I receive the following error(s) when using 3rd party encoding programs:

foobar2000

1 out of 1 files converted with major problems.

Source: "D:\Music\Streamrip\Deezer\Taylor Swift - You're Losing Me (From The Vault) (2023) - [FLAC] [16B-44100kHz]\01 - You’re Losing Me (From The Vault).flac" Corrupted FLAC stream File appears to be incomplete

dbpoweramp

md5 did not match decoded data, file is corrupt

In my testing, all streamrip deezer downloads have this problem.

Command Used

rip url https://www.deezer.com/en/album/517490772

Debug Traceback

[16:48:13] DEBUG    Showing all debug logs                                     cli.py:102
⠼ Resolving URLs...[16:48:19] DEBUG    Pending tracks: [PendingTrack(id=2561521562,              album.py:92
                    album=AlbumMetadata(info=AlbumInfo(id='517490772',
                    quality=2, container='FLAC', label='Taylor Swift',
                    explicit=False, sampling_rate=44100, bit_depth=16,
                    booklets=None), album="You're Losing Me (From The
                    Vault)", albumartist='Taylor Swift', year='2023',
                    genre=['Pop'], covers=Covers(('original',
                    'https://e-cdns-images.dzcdn.net/images/cover/5a59b0d1e15
                    d4d2faaa250e576731848/1000x1000-000000-80-0-0.jpg',
                    "D:\\Music\\Streamrip\\Deezer\\Taylor Swift - You're
                    Losing Me (From The Vault) (2023) - [FLAC]
                    [16B-44100kHz]\\cover.jpg")
                    ('large',
                    'https://e-cdns-images.dzcdn.net/images/cover/5a59b0d1e15
                    d4d2faaa250e576731848/500x500-000000-80-0-0.jpg',
                    "D:\\Music\\Streamrip\\Deezer\\Taylor Swift - You're
                    Losing Me (From The Vault) (2023) - [FLAC]
                    [16B-44100kHz]\\__artwork\\cover-8432111001324892892.jpg"
                    )
                    ('small',
                    'https://e-cdns-images.dzcdn.net/images/cover/5a59b0d1e15
                    d4d2faaa250e576731848/250x250-000000-80-0-0.jpg', None)
                    ('thumbnail',
                    'https://e-cdns-images.dzcdn.net/images/cover/5a59b0d1e15
                    d4d2faaa250e576731848/56x56-000000-80-0-0.jpg', None)),
                    tracktotal=1, disctotal=1, albumcomposer=None,
                    comment=None, compilation=None, copyright=None,
                    date='2023-11-29', description=None, encoder=None,
                    grouping=None, lyrics=None, purchase_date=None),
                    client=<streamrip.client.deezer.DeezerClient object at
                    0x0000026B02635850>, config=<streamrip.config.Config
                    object at 0x0000026B0266A510>,
                    folder="D:\\Music\\Streamrip\\Deezer\\Taylor Swift -
                    You're Losing Me (From The Vault) (2023) - [FLAC]
                    [16B-44100kHz]",
                    db=Database(downloads=<streamrip.db.Downloads object at
                    0x0000026B02299550>, failed=<streamrip.db.Failed object
                    at 0x0000026B026E3DA0>),
                    cover_path="D:\\Music\\Streamrip\\Deezer\\Taylor Swift -
                    You're Losing Me (From The Vault) (2023) - [FLAC]
                    [16B-44100kHz]\\__artwork\\cover-8432111001324892892.jpg"
                    )]
           DEBUG    Executing SELECT EXISTS(SELECT 1 FROM downloads WHERE id=?) db.py:108
[16:48:20] DEBUG    Fetching deezer url with token                          deezer.py:167
                    AAAAAWXbtaRl3M7kt-NE_YIL1VH5FwUng5GchZz3Xuygh_ldI-83BJC
                    ld96bPRimFunhcBysRipoK5Ya4fW75W6qOM9tEkl6VyHWDffZXYIa25
                    ZLbBkWaPv3msZ8X3XvcCfB6EcGug6U88IS6RmkArte8ghCw3dmmdsT2
                    hE1L2kRPmPdE4eTClpXYW_NLM91Ze_yFFddKRsjKTqNulOQBpiroylR
                    xWiHHlRu6ELuYzVbhff0Ub7C_6AOeYj04btPMyKiKuoKISXLQFC0sqb
                    omwXPnLLvRpDYSw
           DEBUG    dz track info: {'ALB_ID': '517490772', 'ALB_PICTURE':   deezer.py:190
                    '5a59b0d1e15d4d2faaa250e576731848', 'ALB_TITLE':
                    "You're Losing Me (From The Vault)", 'ARTISTS':
                    [{'ART_ID': '12246', 'ROLE_ID': '0',
                    'ARTISTS_SONGS_ORDER': '1', 'ART_NAME': 'Taylor Swift',
                    'ARTIST_IS_DUMMY': False, 'ART_PICTURE':
                    'fbf3bafb1b13d1f274a854ded5b66d77', 'RANK': '1000000',
                    'LOCALES': {'lang_en': {'name': 'Taylor Swift'},
                    'lang_ja-hrkt': {'name': 'テイラースウィフト'},
                    'lang_ja-jpan': {'name': 'テイラー・スウィフト'},
                    'lang_ar': {'name': 'تايلور سويفت'}, 'lang_he':
                    {'name': 'טיילור סוויפט'}}, '__TYPE__': 'artist'}],
                    'ART_ID': '12246', 'ART_NAME': 'Taylor Swift',
                    'ARTIST_IS_DUMMY': False, 'DIGITAL_RELEASE_DATE':
                    '2023-11-29', 'DISK_NUMBER': '1', 'DURATION': '278',
                    'EXPLICIT_LYRICS': '0', 'EXPLICIT_TRACK_CONTENT':
                    {'EXPLICIT_LYRICS_STATUS': 0, 'EXPLICIT_COVER_STATUS':
                    0}, 'GENRE_ID': '0', 'HIERARCHICAL_TITLE': '', 'ISRC':
                    'USUG12302772', 'LYRICS_ID': 103171875,
                    'PHYSICAL_RELEASE_DATE': '2023-11-29', 'PROVIDER_ID':
                    '427', 'RANK': '887783', 'SMARTRADIO': 0,
                    'SNG_CONTRIBUTORS': {'main_artist': ['Taylor Swift'],
                    'artist': ['Taylor Swift', 'Jack Antonoff', 'Bobby
                    Hawk'], 'composer': ['Taylor Swift', 'Jack Antonoff']},
                    'SNG_ID': '2561521562', 'SNG_TITLE': 'You’re Losing Me
                    (From The Vault)', 'STATUS': 1, 'TRACK_NUMBER': '1',
                    'USER_ID': 0, 'VERSION': '', 'MD5_ORIGIN':
                    'dd43a8a6c874de4a6faaeeec2b4b25c5', 'FILESIZE_AAC_64':
                    '0', 'FILESIZE_MP3_64': '0', 'FILESIZE_MP3_128':
                    '4446248', 'FILESIZE_MP3_256': '0', 'FILESIZE_MP3_320':
                    '11115623', 'FILESIZE_FLAC': '25860711', 'FILESIZE':
                    '4446248', 'GAIN': '-11.9', 'MEDIA_VERSION': '2',
                    'TRACK_TOKEN':
                    'AAAAAWXbtaRl3M7kt-NE_YIL1VH5FwUng5GchZz3Xuygh_ldI-83BJ
                    Cld96bPRimFunhcBysRipoK5Ya4fW75W6qOM9tEkl6VyHWDffZXYIa2
                    5ZLbBkWaPv3msZ8X3XvcCfB6EcGug6U88IS6RmkArte8ghCw3dmmdsT
                    2hE1L2kRPmPdE4eTClpXYW_NLM91Ze_yFFddKRsjKTqNulOQBpiroyl
                    RxWiHHlRu6ELuYzVbhff0Ub7C_6AOeYj04btPMyKiKuoKISXLQFC0sq
                    bomwXPnLLvRpDYSw', 'TRACK_TOKEN_EXPIRE': 1708969700,
                    'MEDIA': [{'TYPE': 'preview', 'HREF':
                    'http://cdn-preview-0.deezer.com/stream/c-0aaee11f605a4
                    c05605ed1e524b6d250-2.mp3'}], 'RIGHTS':
                    {'STREAM_ADS_AVAILABLE': True, 'STREAM_ADS':
                    '2000-01-01', 'STREAM_SUB_AVAILABLE': True,
                    'STREAM_SUB': '2000-01-01'}, '__TYPE__': 'song'}
           DEBUG    Deezer info for downloadable: {'quality': 2, 'id': downloadable.py:89
                    2561521562, 'quality_to_size': [4446248, 11115623,
                    25860711], 'url':
                    'https://e-cdnt-proxy-d.dzcdn.net/media/1/e07f8aea
                    75e3c03152c1a9a8cabcd9e1f563a4b455c873de3e37d365c2
                    9b2f1ad6683d2364106fa3531158fc5f4a85f4e927c3fa7f2f
                    61ad41c0048801691cc918a492871544e03f5358e4dd18a69a
                    8d?guHIpA3yNk13JozdtepyrDqB5zdeGJJFFdijld4QEjekF7R
                    88mmsTb8ZT_c2KYYLD_gHqMM3R_8fQBG4YKY4yD3Gh4dZLUMrf
                    _auVKCMdPOGRlb5dZIjqgRYDu9Q1WK0W87_4x1W_Dbl3gYrPcq
                    9FTWGjIvVvW-ZtdnhmuSnqRrayiM48nzLDgx-5Wqwy9c7aeIkz
                    BGMHw8vLGpfFazmhMO8gjL-OVB-gXcZqnjVVSxrTt3jA1Z6o57
                    HEqtoter4HQ2W2bfb7P0U4AfmHFLse347xVf0qKkKNMuqR6qoT
                    B5PeU9aY-l4T-lMRB-VFPeFbOgjPP_b3OTR9g'}
           DEBUG    Deezer file (id 2561521562) at                    downloadable.py:129
                    https://e-cdnt-proxy-d.dzcdn.net/media/1/e07f8aea
                    75e3c03152c1a9a8cabcd9e1f563a4b455c873de3e37d365c
                    29b2f1ad6683d2364106fa3531158fc5f4a85f4e927c3fa7f
                    2f61ad41c0048801691cc918a492871544e03f5358e4dd18a
                    69a8d?guHIpA3yNk13JozdtepyrDqB5zdeGJJFFdijld4QEje
                    kF7R88mmsTb8ZT_c2KYYLD_gHqMM3R_8fQBG4YKY4yD3Gh4dZ
                    LUMrf_auVKCMdPOGRlb5dZIjqgRYDu9Q1WK0W87_4x1W_Dbl3
                    gYrPcq9FTWGjIvVvW-ZtdnhmuSnqRrayiM48nzLDgx-5Wqwy9
                    c7aeIkzBGMHw8vLGpfFazmhMO8gjL-OVB-gXcZqnjVVSxrTt3
                    jA1Z6o57HEqtoter4HQ2W2bfb7P0U4AfmHFLse347xVf0qKkK
                    NMuqR6qoTB5PeU9aY-l4T-lMRB-VFPeFbOgjPP_b3OTR9g is
                    encrypted. Decrypting with b'`e2f61"c7u|6jo26'
───────────────────── Downloading You're Losing Me (From The Vault) ─────────────────────
[16:48:21] DEBUG    Removing dirs {"D:\\Music\\Streamrip\\Deezer\\Taylor    artwork.py:19
                    Swift - You're Losing Me (From The Vault) (2023) -
                    [FLAC] [16B-44100kHz]\\__artwork"}

Config File

[downloads]
# Folder where tracks are downloaded to
folder = "D:\\Music\\Streamrip"
# Put Qobuz albums in a 'Qobuz' folder, Tidal albums in 'Tidal' etc.
source_subdirectories = true

# 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.
concurrency = 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
# Set to -1 for no limit
max_connections = 6
# Max number of API requests per source to handle per minute
# Set to -1 for no limit
requests_per_minute = 60

[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

# Authenticate to Qobuz using auth token? Value can be true/false only
use_auth_token = false
# Enter your userid if the above use_auth_token is set to true, else enter your email
email_or_userid = ""
# Enter your auth token if the above use_auth_token is set to true, else enter the md5 hash of your plaintext password
password_or_token = ""
# 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 = 136624114
country_code = "US"
access_token = "eyJraWQiOiJ2OU1GbFhqWSIsImFsZyI6IkVTMjU2In0.eyJ0eXBlIjoibzJfYWNjZXNzIiwidWlkIjoxMzY2MjQxMTQsInNjb3BlIjoid19zdWIgcl91c3Igd191c3IiLCJnVmVyIjowLCJzVmVyIjowLCJjaWQiOjMyMzUsImV4cCI6MTcwOTAwODI5NCwic2lkIjoiYjJiNmU4OWQtMTNiZS00ZTVhLTk1MzYtNmEwOTlkNTJjMDFkIiwiaXNzIjoiaHR0cHM6Ly9hdXRoLnRpZGFsLmNvbS92MSJ9.4wDzjS1c-IsPs1vExUqXuFQetJhWk94_Mp_7-od9HUn_Xl1U2ClqINbnAwa3W1PeYtACfqwF06drMzOooMzlYw"
refresh_token = "eyJraWQiOiJoUzFKYTdVMCIsImFsZyI6IkVTNTEyIn0.eyJ0eXBlIjoibzJfcmVmcmVzaCIsInVpZCI6MTM2NjI0MTE0LCJzY29wZSI6Indfc3ViIHJfdXNyIHdfdXNyIiwiY2lkIjozMjM1LCJzVmVyIjowLCJnVmVyIjowLCJpc3MiOiJodHRwczovL2F1dGgudGlkYWwuY29tL3YxIn0.Acnk8ZNNhQA64j7kZiFAFIhD_lZ3ab7zYVeQQds57CubdQeyTGfnDJMXF-KtdOloE24NqsbQTHVQpGtYaTfrAk9yAeIqkhV70FjPlJ5Z5REpx2tRQ9Bhi_K3aCz_exlGF5-ThpeFhuhD1AHC67JK6EPJgVlWn01YMw4G5atLj6IqDvaS"
# 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 = 1709008293.4224672

[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 = "validarl"
# This allows for free 320kbps MP3 downloads from Deezer
# If an arl is provided, deezloader is never used
use_deezloader = false
# 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 = "C:\\Users\\tswift\\StreamripDownloads\\YouTubeVideos"

[database]
# Create a database that contains all the track IDs downloaded so far
# Any time a track logged in the database is requested, it is skipped
# This can be disabled temporarily with the --no-db flag
downloads_enabled = true
# Path to the downloads database 
downloads_path = "C:\\Users\\tswift\\AppData\\Roaming\\streamrip\\downloads.db"
# If a download fails, the item ID is stored here. Then, `rip repair` can be
# called to retry the downloads
failed_downloads_enabled = true
failed_downloads_path = "C:\\Users\\tswift\\AppData\\Roaming\\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.
# This will also be applied to other sources, but is not guaranteed to work correctly
[qobuz_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.
embed_size = "large"
# If this is set to a value > 0, max(width, height) of the embedded art will be set to this value in pixels
# Proportions of the image will remain the same
embed_max_width = -1
# Save the cover image at the highest quality as a seperate jpg file
save_artwork = true
# If this is set to a value > 0, max(width, height) of the saved art will be set to this value in pixels
# Proportions of the image will remain the same
saved_max_width = -1

[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
# If part of a playlist, sets the `tracknumber` field in the metadata to the track's 
# position in the playlist instead of its position in its album
renumber_playlist_tracks = 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 = true
# Available keys: "albumartist", "title", "year", "bit_depth", "sampling_rate",
# "id", and "albumcomposer"
folder_format = "{albumartist} - {title} ({year}) - [{container}] [{bit_depth}B-{sampling_rate}kHz]"
# Available keys: "tracknumber", "artist", "albumartist", "composer", "title",
# and "albumcomposer", "explicit"
track_format = "{tracknumber:02} - {title}{explicit}"
# Only allow printable ASCII characters in filenames.
restrict_characters = false
# Truncate the filename if it is greater than this number of characters
# Setting this to false may cause downloads to fail on some systems
truncate_to = 120

# 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 = ""

[cli]
# Print "Downloading {Album name}" etc. to screen
text_output = true
# Show resolve, download progress bars
progress_bars = true
# The maximum number of search results to show in the interactive menu
max_search_results = 100

[misc]
# Metadata to identify this config file. Do not change.
version = "2.0.3"
# Print a message if a new version of streamrip is available 
check_for_updates = true

Operating System

Windows 11 Pro

streamrip version

2.0.5

Screenshots and recordings

No response

Additional context

Output of debug traceback appears to fail due a permissions issue. Normally usage of the rip url command does not experience any such problem.

Jpixta commented 9 months ago

Here is some additional info using flac -t https://xiph.org/flac/documentation_tools_flac.html :

.\flac -t 'D:\Music\Streamrip\Deezer\Taylor Swift - You're Losing Me (From The Vault) (2023) - [FLAC] [16B-44100kHz]\01 - You're Losing Me (From The Vault).flac'

flac 1.4.3 Copyright (C) 2000-2009 Josh Coalson, 2011-2023 Xiph.Org Foundation flac comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. Type `flac' for details.

01 - You're Losing Me (From The Vault).flac: *** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC

01 - You're Losing Me (From The Vault).flac: ERROR during decoding state = FLAC__STREAM_DECODER_END_OF_STREAM

Using another program to download the same file, such as deemix, the file is fine:

.\flac -t 'D:\Music\Deemix\Taylor Swift - You're Losing Me (From The Vault).flac'

flac 1.4.3 Copyright (C) 2000-2009 Josh Coalson, 2011-2023 Xiph.Org Foundation flac comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. Type `flac' for details.

Taylor Swift - You're Losing Me (From The Vault).flac: ok

valefrox commented 9 months ago

The last byte is missing: #607.