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

URL unchecked #317

Open
Hsad1644 opened this issue Jan 4, 2023 · 2 comments
Open

URL unchecked #317

Hsad1644 opened this issue Jan 4, 2023 · 2 comments
Labels

Comments

@Hsad1644
Copy link

Hsad1644 commented Jan 4, 2023

Describe the bug
I'm using this library via a batch file on a Windows 10 22H1. The batch file is called dlspty.bat and the command format is simply

dlspty.bat [spotify playlist link] 

The batch file itself looks like this

set SPOTIPY_CLIENT_ID=***
set SPOTIPY_CLIENT_SECRET=***
spotify_dl -l $1 -o D:\Music\Music

The output with error

C:\Users\anupa>spotify_dl -l $1 -o D:\Music\Music
[21:08:47] Starting spotify_dl v8.5.0                                                                                                                    spotify_dl.py:118
Sponsorblock enabled?: no
Traceback (most recent call last):
  File "C:\Users\anupa\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\anupa\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\anupa\AppData\Local\Programs\Python\Python310\Scripts\spotify_dl.exe\__main__.py", line 7, in <module>
  File "C:\Users\anupa\AppData\Local\Programs\Python\Python310\lib\site-packages\spotify_dl\spotify_dl.py", line 162, in spotify_dl
    valid_urls = validate_spotify_urls(args.url)
  File "C:\Users\anupa\AppData\Local\Programs\Python\Python310\lib\site-packages\spotify_dl\spotify.py", line 252, in validate_spotify_urls
    item_type, item_id = parse_spotify_url(url)
  File "C:\Users\anupa\AppData\Local\Programs\Python\Python310\lib\site-packages\spotify_dl\spotify.py", line 224, in parse_spotify_url
    item_id = parsed_url.split("/")[1]
IndexError: list index out of range
Sentry is attempting to send 2 pending error messages
Waiting up to 2 seconds
Press Ctrl-Break to quit

I refer the playlist link to the main spotify_dl command using $1 in my batch file.
Since it's an IndexError, spotify_dl is likely not checking to verify if $1 is a URL or simply whether the URL field is empty. From the thrown errors I'm guessing the fix is somewhere here.

Is this a cache issue? My API credentials are good too. There has to be some issue with the parser.

To Reproduce
Use my batch file method descried at the beginning. For Linux users -

export SPOTIPY_CLIENT_ID=***
export SPOTIPY_CLIENT_SECRET=***
spotify_dl -l $1 -o ~/Music

Expected behavior
—for it to proceed nominally. This same script has worked before, but I've been encountering this problem after updating to v8.5.0. Matter of fact, this same error has popped during/after a previous update too (on my Linux machine). In both cases they fixed themselves after a few restarts. I'm hoping for the same this time too :')

Screenshots
image

Desktop

  • OS: Windows 10
  • Python 3.10
@Hsad1644 Hsad1644 added the bug label Jan 4, 2023
@SathyaBhat
Copy link
Owner

if it works intermittently then it's likely that the variables are not set correctly/passed to the script

@Hsad1644
Copy link
Author

if it works intermittently then it's likely that the variables are not set correctly/passed to the script

I think there is something wrong with the .bat version of the downloader script. Likely something with arguments in cmd because the error is in the URL parsing. I'll edit the issue title if it turns out to be so.

It works fine when run as source downloader_script.sh i.e, its shell version run on git bash in Win10. Please help fix my script mentioned in the issue description. I will try on my end as well.

Thanks!

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

2 participants