// ==UserScript== // @name vivo video source to clipboard (for vlc playlist etc) // @author xtrars // @description Wechselt automatisch zum vivo-Tab auf bs.to und auf vivo.XX kopiert es die Video-URL in den Zwischenspeicher oder leitet zur Videoquelle weiter // @description:en Automatically switches to the vivo tab on bs.to and on vivo.XX it copies the video URL to the clipboard or redirects to the video source // @include https://bs.to/* // @include https://vivo.sx/* // @include https://vivo.st/* // @version 1.0 // @run-at document-start // @license CC BY 4.0 // @namespace https://greasyfork.org/users/140785 // @downloadURL none // ==/UserScript== (function() { 'use strict'; // CHANGE IF YOU WANT TO TRUE let bCloseTabAfterCopyToClipboard = false; // ADVANCED USERS ONLY window.addEventListener('load', function() { if (isVivo()) { // thanks to Wissidi dom (https://greasyfork.org/de/scripts/28779-zu-vivo-video-navigieren/code) let src = document.getElementsByTagName('video')[document.getElementsByTagName('video').length -1]['currentSrc']; if (bCloseTabAfterCopyToClipboard) { navigator.clipboard.writeText(src); closeTab(); } else { window['location'].replace(src); } } }); if (isEpisode()) { document['location'].replace(document['location']['href'] + '/Vivo'); } function isEpisode() { let vivoStr = '/Vivo'; let isSerieRegex = /[0-9]{1,2}\/[0-9]{1,2}\-/g; return document['location']['href'].search(vivoStr) === -1 && document['location']['href'].search(isSerieRegex) !== -1; } function isVivo() { let regex = /vivo\..{1,3}\//g; return document['location']['href'].search(regex) && document.getElementsByTagName('video') && document.getElementsByTagName('video')[document.getElementsByTagName('video').length -1] } function closeTab() { setTimeout(function() { window.open("","_self").close(); }, 500); } })();