Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot download songs which are only invalid characters. #170

Open
thesadru opened this issue Apr 8, 2021 · 3 comments
Open

Cannot download songs which are only invalid characters. #170

thesadru opened this issue Apr 8, 2021 · 3 comments
Labels

Comments

@thesadru
Copy link

thesadru commented Apr 8, 2021

Describe the bug
When trying to download songs like / / // / /

To Reproduce
Please copy paste the entire command, running it in verbose more by passing the -V flag.
example: spotify_dl -V -l "https://open.spotify.com/track/3gCPs1TDRH9v9QlF5h3zD5" -o "."


Starting spotify_dl
Setting debug mode on spotify_dl
Checking for tokens
Tokens fetched: 5101752732e048cb95519b4c5ae9af0b 912b21db564c454fb7288ff8932627be
Arguments: Namespace(url='https://open.spotify.com/track/3gCPs1TDRH9v9QlF5h3zD5', output='.', download=True, format_str='bestaudio/best', skip_mp3=False, scrape=True, verbose=True, version=False)
Got item type track and item_id 3gCPs1TDRH9v9QlF5h3zD5
Traceback (most recent call last):
  File "c:\program files\python39\lib\pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
FileNotFoundError: [WinError 3] The system cannot find the path specified: '    '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\program files\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\program files\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\D\AppData\Roaming\Python\Python39\Scripts\spotify_dl.exe\__main__.py", line 7, in <module>
  File "C:\Users\D\AppData\Roaming\Python\Python39\site-packages\spotify_dl\spotify_dl.py", line 79, in spotify_dl
    save_path.mkdir(parents=True, exist_ok=True)
  File "c:\program files\python39\lib\pathlib.py", line 1317, in mkdir
    self.mkdir(mode, parents=False, exist_ok=exist_ok)
  File "c:\program files\python39\lib\pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
FileNotFoundError: [WinError 3] The system cannot find the path specified: '    '
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-Break to quit

Expected behavior
The characters should have been somehow escaped.

Desktop (please complete the following information):

  • OS: Windows 10
  • Python version: 3.9.0
  • spotify_dl version: 7.5.0
@SathyaBhat
Copy link
Owner

ha, this is amusing. I'll take a look

@kithenry
Copy link
Contributor

kithenry commented Oct 3, 2022

what if all special or illegal characters in a download query instead of being replaced with something else, are prepended [escaped] with a back slash \.. how is that

@SathyaBhat
Copy link
Owner

what if all special or illegal characters in a download query instead of being replaced with something else, are prepended [escaped] with a back slash \.. how is that

@kithstack1 the script is used on all OS, and escaping with \ is not valid because WIndows considers \ as a reserved character, thus filenames cannot have \

image

for this reason the sanitze function exists, but that replaces all "illegal" characters with.. nothing, so probably a better replacement would be an underscore _

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants