Refresh youtube videos (uBlock Origin Lite ad workaround)

When a video starts, this refreshes the new video immediately as workaround to issue of uBlock Origin Lite not blocking the unwanted content and requiring manual refresh.

  1. // ==UserScript==
  2. // @name Refresh youtube videos (uBlock Origin Lite ad workaround)
  3. // @namespace http://tampermonkey.net/
  4. // @description When a video starts, this refreshes the new video immediately as workaround to issue of uBlock Origin Lite not blocking the unwanted content and requiring manual refresh.
  5. // @version 2024-12-29_3
  6. // @author Xcape
  7. // @match https://www.youtube.com/*
  8. // @icon https://lh3.googleusercontent.com/lsanoOfx5N_t-7gh5Qg9FGIirVEjdCqalZXyLZYRd5d7Fydm83FQhu4Oq0JmlRyMtyF_LfwuQQZyKRTHs6emnFirsA=s60
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. let checkID = localStorage.getItem('checkID');
  17.  
  18. setInterval(() => {
  19. const videoID = new URLSearchParams(window.location.search).get('v');
  20. if (videoID !== null) {
  21. if (videoID !== checkID) {
  22. checkID = videoID;
  23. localStorage.setItem('checkID', checkID);
  24. setTimeout(() => {
  25. location.reload();
  26. }, 500);
  27. }
  28. } else {
  29. localStorage.setItem('checkID', 'blahblah');
  30. }
  31. }, 100);
  32.  
  33. })();