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

get_playlist: title, artists and album are correctly resolved in collaborative playlists (#603) #612

Merged
merged 3 commits into from
Jul 3, 2024

Conversation

czifumasa
Copy link
Collaborator

Fixed invalid playlist item info for collaborative playlists from #603 issue.
Instead of hardcoded indexes for flexColumns, now they are resolved using their navigationEndpoint with following logic:

  • watchEndpoint -> title
  • browseEndpoint with pageType == MUSIC_PAGE_TYPE_ALBUM -> album
  • browseEndpoint with pageType == MUSIC_PAGE_TYPE_ARTIST (Regular Artists) or pageType == MUSIC_PAGE_TYPE_UNKNOWN (Artists for uploaded songs)-> artists
  • browseEndpoint with pageType == MUSIC_PAGE_TYPE_USER_CHANNEL -> user channel

Additional checks:

  • sometimes song does not have navigable artist (example 4th track in https://music.youtube.com/playlist?list=OLAK5uy_mfa2N_1Ro0GZKmcrHLR_1VqSr30efpwTc). Then first unrecognized column is treated as artist.
  • for non-song videos the last user channel is treated as artist
    • In regular playlists non-song videos have single user channel column for the channel that uploaded video,
    • In collaborative playlists non-song videos have two user channel columns. First column for the channel that added video to the playlist. The song column for the channel that uploaded video.

Unavailable songs do not have navigationEndpoints so hardcoded indexes are still used. Collaborative user is not listed for unavailable song, so it should not be a problem.

@sigma67
Copy link
Owner

sigma67 commented Jul 3, 2024

Could you please add appropriate tests that fail without your changes and pass with them?

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

Attention: Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 93.53%. Comparing base (05cb3ca) to head (4207444).

Files Patch % Lines
ytmusicapi/parsers/playlists.py 92.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #612      +/-   ##
==========================================
+ Coverage   93.44%   93.53%   +0.09%     
==========================================
  Files          36       36              
  Lines        2211     2211              
==========================================
+ Hits         2066     2068       +2     
+ Misses        145      143       -2     
Flag Coverage Δ
unittests 93.53% <92.00%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

2 participants