[GM] VOE-DL (listed) 09.07.2022 11:52:36 (55 lines) [Edit] [Raw] [View]

// ==UserScript== // @name VOE-DL // @version 1 // @grant none // @include https://voe.sx/ // @include https://voeun-block.net/ // @include https://un-block-voe.net/ // @include https://v-o-e-unblock.com/ // ==/UserScript==

init();

function init(){

const tableRowDownload = getElementByXPath("//tr[td[contains(text(), 'File Download')]]//td[2]");

if (!tableRowDownload) { console.info("[VOE-DL] Download table not found"); return; }

let downloadButton = document.createElement("DIV"); downloadButton.className = "btn btn-primary"; downloadButton.innerText = "VOE-DL"; downloadButton.onclick = goToDownload;

tableRowDownload.appendChild(downloadButton);

console.info("[VOE-DL] Initialized");

};

function goToDownload(){

const videoId = document.location.pathname.split('/')[1];

if (videoId == undefined) { altert("Video-Id not found"); return; }

document.location.href = "https://voe.sx/dl?op=download_orig&key=summer&mode=n&id=" + videoId;

};

//LIBRARIES

function getElementByXPath(path, root) { return document.evaluate(path, root || document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; }