Auto skip ads on amazon prime videos

No need to manually click

  1. // ==UserScript==
  2. // @name Auto skip ads on amazon prime videos
  3. // @namespace momala
  4. // @description No need to manually click
  5.  
  6. // @match https://primevideo.com/region/*/detail/*
  7. // @match https://*.primevideo.com/region/*/detail/*
  8.  
  9. // @match https://primevideo.com/detail/*
  10. // @match https://*.primevideo.com/detail/*
  11.  
  12. // @match https://amazon.com/Episode-*/dp/*
  13. // @match https://*.amazon.com/Episode-*/dp/*
  14. // @match https://amazon.co.jp/Episode-*/dp/*
  15. // @match https://*.amazon.co.jp/Episode-*/dp/*
  16. // @match https://amazon.de/Episode-*/dp/*
  17. // @match https://*.amazon.de/Episode-*/dp/*
  18. // @match https://amazon.de/dp/*
  19. // @match https://*.amazon.de/dp/*
  20.  
  21. // @match https://amazon.com/gp/video/detail/*
  22. // @match https://*.amazon.com/gp/video/detail/*
  23. // @match https://amazon.co.jp/gp/video/detail/*
  24. // @match https://*.amazon.co.jp/gp/video/detail/*
  25. // @match https://amazon.de/gp/video/detail/*
  26. // @match https://*.amazon.de/gp/video/detail/*
  27.  
  28. // @version 3
  29. // @noframes
  30. // ==/UserScript==
  31.  
  32. (function() {
  33. 'use strict';
  34. (new MutationObserver(function (mutationlist) {
  35. if (document.querySelector('.webPlayerUIContainer [tabindex="-1"] > div:nth-child(4) > div:nth-child(2)')) {
  36. this.disconnect();
  37. console.log('Got player');
  38. console.log(document.querySelector('.webPlayerUIContainer [tabindex="-1"] > div:nth-child(4) > div:nth-child(2)'));
  39. (new MutationObserver(function (mutationlist) {
  40. console.log('got observer');
  41. console.log(document.querySelectorAll('.webPlayerUIContainer [tabindex="-1"] > div:nth-child(4) > div:nth-child(2) div img[src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4LjQ4NCIgaGVpZ2h0PSIxNC4xNDEiIHZpZXdCb3g9IjAgMCA4LjQ4NCAxNC4xNDEiPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik03LjA3IDUuNjU2TDEuNDE0IDAgMCAxLjQxNCA1LjY1NiA3LjA3IDAgMTIuNzI3bDEuNDE0IDEuNDE0TDcuMDcgOC40ODQgOC40ODQgNy4wN3oiLz48L3N2Zz4="]'));
  42. Array.from(document.querySelectorAll('.webPlayerUIContainer [tabindex="-1"] > div:nth-child(4) > div:nth-child(2) div img[src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4LjQ4NCIgaGVpZ2h0PSIxNC4xNDEiIHZpZXdCb3g9IjAgMCA4LjQ4NCAxNC4xNDEiPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik03LjA3IDUuNjU2TDEuNDE0IDAgMCAxLjQxNCA1LjY1NiA3LjA3IDAgMTIuNzI3bDEuNDE0IDEuNDE0TDcuMDcgOC40ODQgOC40ODQgNy4wN3oiLz48L3N2Zz4="]')).
  43. filter(function(item) { return ['Ignorer', 'Skip', 'Überspringen'].includes(item.parentNode.parentNode.innerText)}).forEach(function(item) {
  44. console.log('Auto skipped ads');
  45. item.click();
  46. });
  47.  
  48. //})).observe(document.querySelector('.webPlayerUIContainer [tabindex="-1"] > div:nth-child(4) > div:nth-child(2)'),{ attributes: false, childList: true, subtree: true });
  49. })).observe(document.querySelector('.webPlayerUIContainer [tabindex="-1"] > div:nth-child(4)'),{ attributes: false, childList: true, subtree: true });
  50. }
  51. })).observe(document.getElementById('dv-web-player'),{ attributes: false, childList: true, subtree: true });
  52. })();