This is a simple implementation utilizing OpenCV template matching and Tesseract OCR for automatically clicking the "Skip" button as soon as it appears on YouTube.
- OpenCV
- Tesseract OCR (Optical Character Recognition)
Using adblock might violate the YouTube user agreement.
While a native plugin could scan the site for an input with the text "Skip" and send a click event, this approach specifically applies OpenCV for preprocessing and template matching, followed by OCR to confirm the Region of Interest (ROI) contains the actual text "skip".
-
OpenCV: Utilizes OpenCV for preprocessing and template matching.
-
Tesseract OCR: Applies Tesseract OCR to confirm the ROI contains the text "skip".
It's challenging to evaluate due to YouTube's measures to prevent overexposure to ads. After clicking "Skip" quickly a few times, YouTube may temporarily remove ads. However, it's notable that the ad algorithm likely prevents users from being inundated with ads in a short timeframe. For instance, after watching a few ads and then changing videos, users may not be shown more ads on every new video.
- The click location is calculated at the exact center of the ROI.
- Consider adding randomized mouse movement to the location and make the click within the center 65% of the ROI to simulate human interaction with the mouse, potentially making it harder for trackers to distinguish.
A fix to better the template matching would be to implement binary masking on the skip button to not test the transparent part from the original template image, doing so previously increased fasle positives greatly, so it was removed to choose efficiency over perfection. A potential enhancement could involve running YouTube ads in a separate window on a virtual screen, allowing them to run automatically every few minutes. This could reduce the likelihood of ads appearing on other tabs on YouTube. However, while feasible, this approach might be considered more unethical than the current solution, which aims to skip ads manually to avoid interruptions while watching videos.
By LeAnn Alexandra, 2024
This section takes the proof images that have been template matched and calculated, this is the fast way, if you choose not to use the OCR. The results are pretty much consistent and gets better with some binary threshold values.
Proof Image: Proof Image: Proof Image: Proof Image: Proof Image: Proof Image: Proof Image: