您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Выдает ссылку на видео в правом нижнем углу плеера (в поле размера файла)
当前为
// ==UserScript== // @name Download Sibnet Video as MP4 // @namespace http://video.sibnet.ru // @description Выдает ссылку на видео в правом нижнем углу плеера (в поле размера файла) // @include http://video.sibnet.ru/* // @include http://video.sibnet.ru/video* // @include http://video.sibnet.ru/*/video* // @include https://video.sibnet.ru/* // @include https://video.sibnet.ru/video* // @include https://video.sibnet.ru/*/video* // @version 1.2.5 // @copyright 2017, Iron mark 42.1 // @author Iron_man // @grant none // ==/UserScript== window.onload = function(){ var video_path = findVideoPath();// get video path name '/v/{numbers}/{videoid}.mpd' from current html source page var xmlHttp = createXMLHttpObject(); try{ xmlHttp.onreadystatechange = function() { if( xmlHttp.readyState == 4 && xmlHttp.status == 200 ) { var result; var video_link = findVideoLink( xmlHttp.responseText );// get downloadable video link if( !video_link ){ console.error("[onload] can't find video source link"); }else{ result = insertLink( video_link );// try to insert the link into 'video_size' element of html source page if( result )// if failed to insert the link then window.location = video_link;// open it in current page } } } if( video_path ) { xmlHttp.open('GET', video_path, true);// send 'GET' request to 'http://video.sibnet.ru/v/{numbers}/{videoid}.mpd' xmlHttp.send(null); } else console.error("[onload] can't find video path"); }catch(err){ console.error("[onload] " + err); } function findVideoPath() { var source_str = document.getElementById('video').innerHTML; var pos = source_str.indexOf( "player.src([{src: \"" ); if( pos == -1 ) { console.error( "Error: matching 'player.src([{src: \"' string not found"); return null; } pos = source_str.indexOf("/v/", pos); var end = source_str.indexOf(".mpd", pos); if( end == -1 ) { console.error("Error: matching '.mpd' string not found"); return null; } var result_str = source_str.substring(pos, end) + ".mpd"; return result_str; } function createXMLHttpObject() // create xmlHttp object { if( window.XMLHttpRequest ) { return new XMLHttpRequest(); } else if( window.ActiveXObject ) { try{ return new ActiveXObject("Microsoft.XMLHTTP"); }catch(err){ try{ return new ActiveXObject("MSxml2.XMLHTTP"); }catch(err){ console.error("[createXMLHttpObject] " + err ); }} }else{ console.error( "Error: can't create xmlHttp object"); return null; } } function findVideoLink( source_str ) { var pos = source_str.indexOf("initialization=\""); if( pos == -1 ) { console.error( "Error: matching string 'initialization=\"' not found"); return null; } pos = source_str.indexOf("http", pos); var end = source_str.indexOf("noip=1", pos); if( end == -1 ) { console.error( "Error: matching string 'noip=1' not found"); return null; } source_str = source_str.substring(pos, end) + "noip=1"; var result_str = source_str.replace("amp;", ""); for( var count = 0; source_str.length != result_str.length && count < 10; ++count ) { source_str = result_str; result_str = source_str.replace("amp;", ""); } result_str = result_str.replace("/init-$RepresentationID$", ""); return result_str; } function insertLink( source_link ) // insert hyper reference in video_size element { var video_size; try{ video_size = document.getElementsByClassName('video_size')[0]; video_size.innerHTML = '<a href="' + source_link + '" title="Скачать">' + video_size.innerHTML + '</a>'; return 0; }catch(err){ console.error("[insertLink] " + err); return 1; } } };