// ==UserScript== // @name Stream to VLC // @namespace http://tampermonkey.net/ // @version 2.2 // @description Opens VLC from streaming sites // @author mattiadr, giuseppe-dandrea // @match http*://openload.co/* // @match http*://openloads.co/* // @match http*://oload.download/* // @match http*://turbovid.me/* // @match http*://www.flashx.to/* // @match http*://www.flashx.tv/* // @match http*://www.flashx.sx/* // @match http*://www.rapidvideo.com/* // @match http*://wstream.video/* // @match www.video.mediaset.it/* // @match http*://speedvideo.net/* // @match http*://*mp4upload.com/embed* // @grant window.close // @grant GM_openInTab // @grant GM_getValue // @grant GM_setValue // @downloadURL none // ==/UserScript== (function() { /* global vars */ /*******************************************************************************************************************************************************************/ let url = null; /* helper functions */ /*******************************************************************************************************************************************************************/ function play_url(url) { if (url !== null) { window.location.href = 'vlcs:' + url; if (GM_getValue("VLC_first_time", true)) { alert("Please always remember choice or you will need to edit source code (see Readme for more info)"); GM_setValue("VLC_first_time", false); } else { new Promise((resolve) => setTimeout(resolve, 1000)).then(() => { //Comment the next line to be able authorize xdg-open window.close(); }); } } } function wait_until_video_click() { new Promise((resolve) => setTimeout(resolve, 1000)).then(() => { if ($('video')[0].src.indexOf('http') != -1) { url = $('video')[0].src; play_url(url); } else { wait_until_video_click(); } }); } function wait_until_mediaset_ready() { new Promise((resolve) => setTimeout(resolve, 1000)).then(() => { if ($('video > source')[0].src.indexOf('http') != -1) { url = $('video > source')[0].src; play_url(url); } else { wait_until_mediaset_ready(); } }); } /* pages functions */ /*******************************************************************************************************************************************************************/ let page = {}; page['openload.co'] = function() { $('#videooverlay').trigger('click'); url = $('#olvideo_html5_api')[0].src; } page['openloads.co'] = page['openload.co']; page['oload.download'] = page['openload.co']; page['turbovid.me'] = function() { $('html').removeClass(" js "); if ($('#video-content').length === 0) { //$('#container > h2').append("