XVideos Download Link Extractor

Add high resolution download link on the right of the screen. Use save as... to download the video you need.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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.

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

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!)

// ==UserScript==
// @author          Newonroad
// @name            XVideos Download Link Extractor
// @namespace       newonroad
// @description     Add high resolution download link on the right of the screen. Use save as... to download the video you need.
// @include         http*://www.xvideos.com/video*
// @version         0.0.3
// @run-at          document-start
// @grant           none
// ==/UserScript==

(function extractXVideos() {
    window.addEventListener("DOMContentLoaded", function () {
        function createVideoDownloadElement(href, hintText) {
            var videoList = document.createElement("li");
            var videoDownloadElement = document.createElement("a");
            videoDownloadElement.setAttribute("href", href);
            videoDownloadElement.setAttribute("target", "_blank");
            videoDownloadElement.setAttribute("class", "btn btn-default");
            videoDownloadElement.setAttribute("download", window.xv.conf.dyn.id + ".mp4");
            videoDownloadElement.innerHTML = '<span class="icon download"></span><span class="visible-lg-inline"> '+hintText+'</span></a>';
            videoList.appendChild(videoDownloadElement);
            document.querySelector("#video-actions > ul").appendChild(videoList);
        }
        createVideoDownloadElement(window.html5player.url_high, "High");
        createVideoDownloadElement(window.html5player.url_low, "Low");
        createVideoDownloadElement(window.html5player.url_hls, "HLS");
    });
}());