Mp4Hydra Movie/Video Downloader

Adds a movie download button to the mp4hydra.org video player. Clicking the button will start the download of the mp4 video file.

目前为 2024-01-06 提交的版本。查看 最新版本

// ==UserScript==
// @name        Mp4Hydra Movie/Video Downloader
// @namespace   https://greasyfork.org/
// @version     1.12
// @description Adds a movie download button to the mp4hydra.org video player. Clicking the button will start the download of the mp4 video file.
// @author      paleocode
// @match       https://mp4hydra.org/movie/*
// @icon        https://mp4hydra.org/favicon-32x32.png
// @license     MIT
// @unwrap
// ==/UserScript==
(function () {
    if (document.title === 'Movie Not Found | Mp4Hydra.org') {
        return;
    }
    function getSrc() {
        var src = player.src();
        console.log("Source: " + src);
        return src;
    }
    let vidSrc = "";
    var button = Object.assign(document.createElement('button'), {
        innerHTML: 'Download',
        title: 'Download Movie',
        style: 'display: inline-block;margin: 0 0 0 10px; color: #000;',
        onclick: function () {
            var link = document.createElement("a");
            link.href = vidSrc;
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
        }
    })
    const interval = setInterval(function () {
        if (document.querySelector('#vcount > small') === null || document.querySelector('#vcount > small').innerText == "---") return;
        clearInterval(interval);
        vidSrc = getSrc() + '?dl=dl';
        document.querySelector('#vbar').appendChild(button);
    }, 100);
})();