Skip to content

URL unchecked #317

@Hsad1644

Description

@Hsad1644

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions