squgeim / yt-ad-autoskipper

A browser extension that automates skipping ad on Youtube. This is not an ad blocker, it just automates the process of clicking on the "Skip Ad" button on Youtube.
https://chrome.google.com/webstore/detail/youtube-ad-auto-skipper/lokpenepehfdekijkebhpnpcjjpngpnd
GNU General Public License v3.0
270 stars 56 forks source link

Support even newer skip button #68

Closed mvarendorff closed 4 months ago

mvarendorff commented 4 months ago

We're not stopping with the variants! Looks like YouTube shuffled some selectors around. Unfortunately, the ID isn't stable, so can't use that but from what I have seen and played around with button.ytp-skip-ad-button appears to be unique.

grafik

Should close #63 and potentially #67

nicholas-eden commented 4 months ago

You also need to update the selector that checks if an ad is playing:

https://github.com/squgeim/yt-ad-autoskipper/blob/master/src/utils/youtubeEvents.ts#L29

const adPlaying =
    document
      .querySelectorAll(".ytp-ad-module > div").length > 0;
mvarendorff commented 4 months ago

Nice catch, thanks @nicholas-eden! Since adPlaying is used to determine if the playing ad has changed, I tweaked the selector a bit to find something with an aria-label that can be used to see if the ad has changed.

squgeim commented 4 months ago

Thank you so much @geisterfurz007 @nicholas-eden!