mirror of
https://github.com/sigma67/ytmusicapi.git
synced 2026-04-27 00:06:00 +03:00
[GH-ISSUE #429] search: list index out of range for some search terms #319
Labels
No labels
a/b
bug
documentation
enhancement
good first issue
help wanted
invalid
pull-request
question
wontfix
yt-error
yt-update
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ytmusicapi#319
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ageisen2000 on GitHub (Aug 24, 2023).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/429
Here is the dump
@dabidlu commented on GitHub (Aug 24, 2023):
Just got the same error; although seems to be a transient error. Rerunning, I was able to successfully create the playllist.
@sigma67 commented on GitHub (Aug 24, 2023):
Can you identify the specific song that is causing the issue? You can perhaps add a print statement in the source code before each search query. This would actually be an upstream issue with ytmusicapi.
@ageisen2000 commented on GitHub (Aug 24, 2023):
As far as I could tell it was never any specific song. It failed at a different spot every time
@sigma67 commented on GitHub (Aug 24, 2023):
What is your version of ytmusicapi? pip show ytmusicapi
@kler commented on GitHub (Aug 25, 2023):
I can confirm that the error is present within
ytmusicapi1.2.0.As visible in the stack trace this comes from
get_item_text()inytmusicapi\parsers\_utils.pyI tried the migration several times, and failed at different points, so it's not consistent for a certain song for instance.
The error depends on the data returned from Youtube Music, making
ytmusicapicrash.Code analysis
Looking at the variable called
columninget_item_text()in the debugger, it only has the0:th index, while the calling function calls it with a hard coded index of2:search_result['name'] = get_item_text(data, 1, 2)(link to code)In case it would be acceptable to ignore the missing entry, there is a param called
none_if_absent, however this is not passed from the caller function, meaning that the bug itself is actually in theytmusicapi, and not in its utilization inspotify_to_ytmusicAFAICT.I've tried setting
none_if_absent=Truein the caller functionparse_search_result()line 80, and does indeed make it work, but I have no idea what side effects it has or if I'm breaking some intended behaviour.I also had a similar error in
parse_menu_playlists()(link to code)where it calls
nav(), which fails in the item calledmenu.I tried setting
none_if_absent=Truehere as well, and it made the playlist creation succeed.Side note: Only 4,517 songs where actually created, but there may be duplicates, I don't know...
@sigma67 commented on GitHub (Aug 25, 2023):
So I'm trying with some pretty large playlists right now but failing to reproduce. It might be something specific to your accounts or a very rare bug where the name is missing on a profile result.
It would be very helpful if you could add the following debugging code to your local ytmusicapi installation and paste the output data here whenever you see the issue. Instead of this line
github.com/sigma67/ytmusicapi@6660058a47/ytmusicapi/parsers/search.py (L80)add
@sigma67 commented on GitHub (Aug 25, 2023):
Managed to reproduce. I figure it's safe to ignore the value if absent since there are no other flexitems on this type of search result (yet).
@kler commented on GitHub (Aug 25, 2023):
Great, thx!
I also made a run with the changes you proposed, and this is the result:
There is unfortunately also a second problem in the
nav()function innavigation.py- but didn't store the stack trace from when I had the error. Will possibly come back with that in another bug report if I hit it again.