crazyrabbit0 / UserScripts

UserScripts for Browser Extensions
GNU General Public License v3.0
5 stars 0 forks source link

Skip Members-only videos #3

Closed JeffreyMercado closed 5 months ago

JeffreyMercado commented 6 months ago

Gotta start with the thanks, use this particularly when listening to large playlists and playing the ~700+ video, YT tends to not continue at that point. This was perfect.

Would it be possible to detect if it's stopped on a member video that you are not a member of that channel?

Some playlists have member videos scattered throughout and it gets stuck. Just want to get past it and on to the next.

crazyrabbit0 commented 6 months ago

You are welcome! Glad I could help 👌

Could you share said playlist, so I can test it?

JeffreyMercado commented 6 months ago

Here's a playlist with nothing but members only: https://www.youtube.com/playlist?list=PLUnBm8KiAXgUgsOI3hc4CkVGGv-6J2rul

But you could get the same with a private playlist and adding them in the middle somewhere.

crazyrabbit0 commented 6 months ago

I made a possible fix, can you try it out and let me know if it works?

JeffreyMercado commented 6 months ago

It doesn't seem to work. The video player doesn't load at all (just a constant loading spinner). I don't see any thing in the console to indicate any error.

I do have Ublock Origin installed as well as the Return YouTube Dislike script. The errors I see seem to be related to those. (ads don't load, tracking calls blocked, etc.)

JeffreyMercado commented 6 months ago

It seems to be trying to prematurely click on the next button in reset_loop() before the player loads after moving to the next video. loop.code and loop.value are undefined at that point.

I threw in a bunch of logs to try to debug if it helps: https://gist.github.com/JeffreyMercado/f98739de2e4213a0650d272621d45972

crazyrabbit0 commented 6 months ago

I don't see why the video player doesn't load because of the script, do you have the same problem without the script?

I made a small change to try, but it shouldn't make much of a difference anyway.

I tried it on many playlists with and without members-only videos and it seems to be working fine.

JeffreyMercado commented 6 months ago

It only seems to work if you happen to be starting the playlist on a members video. Refreshing on a member video will cause it to advance. However, it doesn't seem to work when you started on a normal video now. When you eventually get to the member video, it stops. I think the script stopped checking for changes at that point.

crazyrabbit0 commented 6 months ago

Interesting 🤔 Could you share such a playlist, to try it out?

JeffreyMercado commented 5 months ago

I can't share the exact playlist, it's not mine to share. But I was able to reproduce it on another playlist: https://www.youtube.com/playlist?list=PL5szH-37gk_JiEeQa1rZTs8VA6Ax9LoJ7

It has six videos, three and four are members videos and the rest are regular videos.

When I tested this, it exhibited the three different cases I mentioned, depending on the video you start on and browser refresh the page. It's important that you refresh the page otherwise the below won't happen. My theory is that the script only starts working on first load.

  1. https://www.youtube.com/watch?v=wUVWuH9RDGQ&list=PL5szH-37gk_JiEeQa1rZTs8VA6Ax9LoJ7&index=1 Play starting with the first video and seek close to the end of the video (do not skip) then let it play through to the next video. Do the same with the second video. By the time you reach the member video, you're left with the black screen with the spinner. Doesn't happen reliably, I think you need to let each video play for a while before moving on.
  2. https://www.youtube.com/watch?v=IL2P1IB-2nc&list=PL5szH-37gk_JiEeQa1rZTs8VA6Ax9LoJ7&index=2 Play starting with the second video and seek close to the end of the video (do not skip) then let it play through to the next video. By the time you reach the member video, you'll get the normal "Members-only content" banner with the thumbnail image shown. This is also the same behavior you'd get if you just hit "Next Video" through to the member video or just click on the third video in the playlist (after loading).
  3. https://www.youtube.com/watch?v=5V8n50DoxVI&list=PL5szH-37gk_JiEeQa1rZTs8VA6Ax9LoJ7&index=3 Play starting with the third video, it will advance forward to the next video since it is members only, and advance through the fourth because it's members only, then start playing on the fifth video.
crazyrabbit0 commented 5 months ago

Based on the playlist you supplied, I made a change to the detection of Members-only videos. This should fix the Members-only skip (and probably skip any video that can't be played). Update to the latest version (2.1.2) and let me know if it's ok now.

[!NOTE] I managed to get the "black screen with the spinner" both with and without the script, it seems to be YouTube's problem, it happens randomly on Members-only videos, it should be skipped now that script has better Members-only detection.

JeffreyMercado commented 5 months ago

That looks like it fixed the members skip issue, thanks!

Side note: I was trying to rule out the script for a different bug but it looks like it this. I'll open a new issue for it.