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

refactor(Playlist): Ignore ContinuationItem nodes from SectionList#contents #579

Merged
merged 2 commits into from
Jan 18, 2024

Conversation

LuanRT
Copy link
Owner

@LuanRT LuanRT commented Jan 13, 2024

This should address some issues where the library would fetch the wrong continuation or even empty continuations.

NOTE: The solution in 987f506 no longer applies after this PR is merged, as empty continuations were all in SectionList#contents. If you had any code in place to handle that error, it is safe to remove it after this PR is merged.

Other related changes

  1. Added style to PlaylistVideo. This helps identifying if the video is just a recommendation (PLAYLIST_VIDEO_RENDERER_STYLE_RECOMMENDED_VIDEO) or part of the playlist.

  2. Playlist#items can only return PlaylistVideo nodes now. Its return type isObservedArray<PlaylistVideo>.

…ontents`

This should fix some issues regarding the library fetching the wrong continuation or empty continuations (NOTE: This means the solution in 987f506 no longer applies as empty continuations were all in `SectionList#contents`).
Copy link
Contributor

@iBicha iBicha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the quick fix!

@LuanRT LuanRT merged commit 04d55d0 into main Jan 18, 2024
3 checks passed
@LuanRT LuanRT deleted the refactor/playlist-continuations branch January 18, 2024 17:39
@absidue
Copy link
Collaborator

absidue commented Feb 18, 2024

Looks like this broke support for shorts only playlists (they use ReelItems instead of PlaylistVideos), as this code assumes that playlists only contain PlaylistVideos. It results in the following error being thrown in the items getter: Error: Expected node of any type PlaylistVideo, got ReelItem

As I don't know what the equivalent for the style attribute is for ReelItems or if recommended ones even appear in playlists that only contain shorts, I won't be able to make a pull request to fix this myself (as discussed in the other thread video recommendations only show up with you are logged into YouTube).

Here is an example of a shorts only playlist (the auto-generated shorts playlist for the @YouTubeMusic YouTube channel): UUSHStaiwu-FAgp_RC_tBiLh9A

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

Successfully merging this pull request may close these issues.

3 participants