mytube

Skip youtube video ads duration < 180 seconds and banners. Tested on FIrefox

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Автор
player27
Щоденних встановлень
0
Всього встановлень
29
Рейтинги
0 1 0
Версія
2024-04-13
Створено
13.04.2024
Оновлено
13.04.2024
Size
1,6 кБ
Ліцензія
Н/Д
Відноситься до

This JavaScript function is designed to enhance the user experience when watching YouTube videos by automatically skipping short videos and hiding various types of advertisements. Here's a breakdown of its functionality:

1. **Skipping Short Videos:**
- It targets the video player element on the webpage by selecting the element with the class ".video-stream".
- If the video player exists (`videoPlayer` is truthy) and the duration of the video is less than 180 seconds (3 minutes), the script performs the following actions:
- Pauses the video (`videoPlayer.pause()`).
- Sets the current playback time to slightly before the end of the video (`videoPlayer.currentTime = videoPlayer.duration - 0.001`), ensuring that the video is considered completed.
- Plays the video (`videoPlayer.play()`).
- Emulates a click on the video player (`videoPlayer.click()`), possibly to activate certain functionalities.
- It also attempts to skip any ads by clicking on elements with classes containing "ad-skip".

2. **Hiding Advertisements:**
- It defines an array `adWords` containing keywords commonly associated with advertisements.
- It selects all elements with classes containing "ytd" (likely YouTube elements) and iterates over them.
- For each element, it checks if its class contains any of the ad-related keywords (`adWords`). If it does and the element is currently displayed (`element.style.display !== 'none'`), it hides the element by setting its display style to "none".

3. **Interval Execution:**
- The function `mytube` is set to run repeatedly at intervals of 250 milliseconds (`setInterval(mytube, 250)`). This ensures that the function continuously monitors the page for changes and applies its modifications as needed.

Overall, this script aims to automate the process of skipping short videos and hiding advertisements on YouTube, providing a smoother and more enjoyable viewing experience for users.