acgonzales / pydeezer

A package to search and download musics on Deezer.
The Unlicense
52 stars 14 forks source link

New version does not catch invalid arl instead gives error while downloading tracks #21

Open delrius-euphoria opened 3 years ago

delrius-euphoria commented 3 years ago

I noticed the new version does not give LoginError when if we use wrong arl instead it proceeds to fetch information with/without arl but download can only happen if the arl is valid. So LoginError is become useless, please take a look

import pydeezer
from pydeezer.constants import track_formats

deezer = pydeezer.Deezer()
deezer.login_via_arl(arl='123') # Wrong login, no error given

s = deezer.get_track('1164622882')
print(s['info']['title']) # Gets it no issue

s['download'](download_dir='C://PyProjects//Music Downloader//dist//',quality=track_formats.MP3_128) # Error given

Output:

Leaning on you
Traceback (most recent call last):
  File "c:\PyProjects\Music Downloader\test.py", line 12, in <module>
    s['download'](download_dir='C://PyProjects//Music Downloader//dist//',quality=track_formats.MP3_128)     
  File "C:\Users\nihaa\AppData\Local\Programs\Python\Python39\lib\site-packages\pydeezer\Deezer.py", line 311, in download_track
    url, quality_key = self.get_track_download_url(
  File "C:\Users\nihaa\AppData\Local\Programs\Python\Python39\lib\site-packages\pydeezer\Deezer.py", line 261, in get_track_download_url
    url = decrypt_url(track_formats.TRACK_FORMAT_MAP[quality]["code"])
  File "C:\Users\nihaa\AppData\Local\Programs\Python\Python39\lib\site-packages\pydeezer\Deezer.py", line 241, in decrypt_url
    step1 = magic_char.join((md5_origin,
TypeError: sequence item 0: expected str instance, NoneType found

I know that the error is skipped only on the newer version because the exe I made with older version shows invalid arl while newer version does not.