Auto Skip YouTube Ads

Auto skip YouTube ads almost instantly. Very lightweight and efficient.

目前為 2024-06-28 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Auto Skip YouTube Ads
  3. // @name:vi Tự Động Bỏ Qua Quảng Cáo YouTube
  4. // @name:zh-CN 自动跳过 YouTube 广告
  5. // @name:es Saltar automáticamente anuncios de YouTube
  6. // @name:ru Автоматический пропуск рекламы на YouTube
  7. // @namespace https://github.com/tientq64/userscripts
  8. // @version 3.0.1
  9. // @description Auto skip YouTube ads almost instantly. Very lightweight and efficient.
  10. // @description:vi Tự động bỏ qua quảng cáo YouTube gần như ngay lập tức. Rất nhẹ và hiệu quả.
  11. // @description:zh-CN 几乎立即自动跳过 YouTube 广告。非常轻量且高效。
  12. // @description:es Salta automáticamente los anuncios de YouTube casi al instante. Muy ligero y eficiente.
  13. // @description:ru Автоматический пропуск рекламы на YouTube почти мгновенно. Очень легкий и эффективный.
  14. // @author https://github.com/tientq64
  15. // @icon https://cdn-icons-png.flaticon.com/64/9639/9639954.png
  16. // @match https://www.youtube.com
  17. // @match https://www.youtube.com/*
  18. // @grant none
  19. // @license MIT
  20. // @noframes
  21. // @homepage https://github.com/tientq64/userscripts/tree/main/scripts/auto-skip-youtube-ads
  22. // ==/UserScript==
  23.  
  24. function skipAd() {
  25. const adPlayer = document.querySelector('.html5-video-player.ad-showing')
  26. if (adPlayer) {
  27. const skipButton = document.querySelector('.ytp-skip-ad-button, .ytp-ad-skip-button')
  28. if (skipButton) {
  29. skipButton.click()
  30. } else {
  31. const video = adPlayer.querySelector('video')
  32. video.currentTime = video.duration
  33. }
  34. }
  35. const dismissButton = document.querySelector('tp-yt-paper-dialog #dismiss-button')
  36. if (dismissButton) {
  37. dismissButton.click()
  38. const dialog = dismissButton.closest('tp-yt-paper-dialog')
  39. dialog.remove()
  40. }
  41. }
  42. setInterval(skipAd, 1000)
  43. skipAd()
  44. const style = document.createElement('style')
  45. style.textContent = `
  46. #player-ads,
  47. #masthead-ad,
  48. #panels:has(ytd-ads-engagement-panel-content-renderer),
  49. ytd-rich-item-renderer:has(.ytd-ad-slot-renderer),
  50. ytd-reel-video-renderer:has(.ytd-ad-slot-renderer),
  51. tp-yt-paper-dialog:has(#dismiss-button) {
  52. display: none !important;
  53. }`
  54. document.head.appendChild(style)

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址