skip-video

Makes the video skip to its end or fast forwards it with the given amount. It does it by setting the currentTime attribute of the video object.

Parameters

NameDescriptionMandatoryDefault Value

playerSelector

The CSS or the XPath selector to the video element in the page.

Yes

-

xpathCondition

The XPath selector that will be used to know when to trigger the skipping logic.

Yes

-

optionalParameters

Optional parameters to configure the snippet. Any number of the supported parameters from the table below can be added to this in any order. Separate the optional parameters with space as if they are different arguments to the filter.

No

NameDescriptionDefault ValueExample Value

maxAttempts

If the video is not fully loaded by the time the xPath condition is met; there is a retry mechanism in the snippet. The snippet will try to skip the video once every retryMs interval. -max-attempts parameter will determine the maximum number of attempts the snippet should do before giving up. This parameter doesn't need to be changed for most of the cases but might be useful for some circumvention scenarios.

10

-max-attemps:20

retryMs

If the video is not fully loaded by the time the xPath condition is met; there is a retry mechanism in the snippet. The snippet will try to skip the video once every -retry-ms interval. This parameter doesn't need to be changed for most of the cases. Unit is in milliseconds.

10

-retry-ms:100

-run-once

Used to disable the snippet after it has skipped the video once.

False

-run-once:true

-skip-to

Determines the time of the video to skip to. If the value is zero or negative, the snippet skips to the end of the video (video.currentTime = video.duration + skipTo). If the skipTo value is positive, the snippets skips the video by the given value (video.currentTime = video.currentTime + skipTo). A small negative value like (-0.1) or zero is preferred for most of the cases as it would cause the video to nearly instantly end. Large positive values can be used to quickly fast forward a video (5-10 seconds at a time) to better mimic user behaviour and escape some detection methods. Example: If there is a 30 second ad, -0.1 is given as the skipTo parameter, the video will be instantly skipped to 29.900 (0.1 seconds before the 30 second mark). If positive 10 seconds is given as the skipTo parameter, video will be skipped to 10 seconds, 20 seconds and to 30 seconds every time there is a tick of the snippet (happens at every page mutation). If 0 is given as the skipTo parameter, video will be instantly skipped to the end (30 second mark). Unit is in seconds.

-0.1

-skip-to:10

-stop-on-video-end

Used to pause the snippet when the video is already near its end. Video is considered near its end when the difference between the video duration and the current time is less than 0.5 seconds.

False

-stop-on-video-end:true

-wait-until

Optional parameter that can be used to delay the running of the snippet until the given state is reached. Accepts: loading, interactive, complete, load or any event name. Pass empty string to disable.-wait-until:"" (Snippet will run immediately).

Disabled (snippet runs immediately)

-wait-until:load

Filter examples

The following table lists examples that use the skip-video snippet:

FilterResult

skip-video 'video.main-video-player' './/div[contains(@class,"player-container")][contains(@class, "ad"]'

Finds the video player with main-video-player class and skips it to the end whenever the div with player-container class has the class ad attached it.

skip-video 'some-css-selector-to-video' 'xpath-condition-on-when-to-run-skipping' '-run-once:true' '-skip-to:10'

This filter will only skip 10 seconds of the video when the xpath condition first matches.

skip-video 'some-css-selector-to-video' 'xpath-condition-on-when-to-run-skipping' '-wait-until:load' '-stop-on-video-end:true'

This filter will delay the running of the snippet until the page is fully loaded and it will pause the snippet once the video is close to its end. Any number of parameters can be added to customize the snippet.

Last updated