Trinovantes / userscript-youtube-playlist-organizer

Drag and drop interface to organize playlists on YouTube
GNU Affero General Public License v3.0
22 stars 0 forks source link

Most recently modified playlist not showing on script's sidebar #18

Closed Crunchbits closed 1 year ago

Crunchbits commented 1 year ago

The most recently modified playlist name is not showing. If I modify a playlist by adding or removing a video from it normally or through the script sidebar it will not show on the script sidebar(Watch later works fine). If the name is loaded in the sidebar and then the modification happens, then it will hide it in the sidebar on tab refresh or on the sidebar of a new playlist tab.

Trinovantes commented 1 year ago

Is the playlist missing or does it just have the old name?

I'm not sure what the bug is. Can you provide steps to reproduce and show a screenshot/video of what you see and what you expect?

Crunchbits commented 1 year ago

The playlist goes missing. As shown in the video I made test playlists A-G. At the start of the video the userscript only shows A-F and not G. Then after making a modification to playlist F and refreshing the tab, it brings back G but hides F. It never shows the playlist that was last modified.

https://github.com/Trinovantes/userscript-youtube-playlist-organizer/assets/87384615/ac512071-e81d-4d41-91b9-f199d58c5d0a

This was recorded on a fresh profile of Firefox version 113.0.1 (64-bit) using tampermonkey so no other extensions/userscripts messed with anything. Problem also occurs in Chrome.

Crunchbits commented 1 year ago

And to be clear the problem still happens regardless of whether you modified the playlist using the userscript(as shown in the video) or how you normally would without the userscript.

Trinovantes commented 1 year ago

Huh, that's such a weird bug

I can't reproduce it on my end. If I have to guess, you're probably being shown a different HTML markup as part of some A/B test (Google does hundreds of these at a time)

Can you open your dev console after page finish loading and see which elements the #expandable-items > ytd-guide-entry-renderer selector is finding? This is how the userscript determines which playlists you currently have.

Screenshot 2023-05-20 085002

Crunchbits commented 1 year ago

Here's what it shows:

Screenshot1

Also from what I noticed, while hovering over the different guide entries(0-6): Entry 0 highlights the 2nd highest playlist on the top(G) and it goes down the list with: 1 = E 2 = A 3 = D 4 = C 5 = B 6 = Liked videos

Screenshot2

So excluding the highest playlist, it's all in order from top to bottom, so in terms of sorting it seems to make sense.

So yeah it doesn't seem to be listing the most recently modified playlist(F). Could it be an issue with the "Liked Videos" being listed as an entry(entry 6)? I know it's a technically a playlist so I don't think that's where the issue is coming from but I'm not sure.

Trinovantes commented 1 year ago

What does your sidebar's DOM look like?

Mine includes all my playlists and "Liked Videos". The script simply filters out any links found with the selector that doesn't match playlist\?list=([\w]+) regex pattern. It's also possible your "F" playlist id doesn't match the \w regex filter.

Edit: I think from your video, your playlist id includes a "-" which indeed doesn't get captured by the regex. Can you confirm?

Crunchbits commented 1 year ago

My "F" playlist does not have a "-". Although some of my playlists do contain "-", some even 2 consecutive dashes. And they were showing before and after the latest update. So the dashes seem to have been getting picked up fine and I don't think that's been the issue.

I think the issue is that it's not capturing the highest playlist on the sidebar. I checked my sidebar's DOM and it' split into 2 groups. The first group is the highest playlist(G) on the sidebar. The second group is all the other playlists including ""Liked Videos". In the following picture, the first group starts in the first highlighted line and the second group starts in the second highlighted line.

Screenshot_10

So yeah it appears that the playlist in the first group is not captured for a reason I do not know.

Trinovantes commented 1 year ago

Ok I see

For whatever reason, YouTube gives you an UI that puts a playlist outside of the collapsed items container #expandable-items

I've released v2.3.2 which goes further up the DOM to find playlist links. Hopefully it works for you

Crunchbits commented 1 year ago

It's showing now! Thanks!!