// ==SiteScript== // @siteName Stream2K // @siteUrl http://stream2k.eu/ // @author mayan // @authorUrl // @scriptUrl // @description // @date 2013/11/17 // @version 0.2 // ==/SiteScript== function CravingSiteScript() { this._initialize(); } CravingSiteScript.prototype = { _xhr: null, _initialize: function() {}, _getXmlHttpRequest: function() { if ( this._xhr != null ) { return this._xhr; } var xhr = null; var these = [ function() { return new XMLHttpRequest(); } , function() { return new ActiveXObject( "Msxml2.XMLHTTP" ); } , function() { return new ActiveXObject( "Microsoft.XMLHTTP" ); } , function() { return new ActiveXObject( "Msxml2.XMLHTTP.4.0" ); } ]; for ( var i = 0, length = these.length; i < length; i++ ) { var func = these[ i ]; try { xhr = func(); break; } catch( e ) {} } this._xhr = xhr; return this._xhr; }, _load: function( url, data, method ) { var req = this._getXmlHttpRequest(); var mtd = ( method == null ) ? "GET" : "POST"; req.open( mtd, url, false ); if ( mtd == "POST" ) { req.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" ); } req.send( data ); return req.responseText; }, getResponseText: function( url, data, method ) { return this._load( url, data, method ); }, getResponseJSON: function( url, data, method ) { var text = this._load( url, data, method ); return eval( "("+text+")" ); }, /// Math random: function( limit ) { return Math.floor( Math.random() * limit ); }, /// String decodeHtml: function( str ) { return str.replace( /&(quot|#0*34);/ig, "\"" ) .replace( /&(amp|#0*38);/ig, "&" ) .replace( /&(apos|#0*39);/ig, "'" ) .replace( /&(lt|#0*60);/ig, "<" ) .replace( /&(gt|#0*62);/ig, ">" ) .replace( /&(nbsp|#0*160);/ig, " " ) .replace( /&(frasl|#8260);/ig, "/" ) .replace( /(\d+);/g, function(a,b){return String.fromCharCode(parseInt(b,10));} ) .replace( /([0-9a-f]+);/ig, function(a,b){return String.fromCharCode(parseInt(b,16));} ); } } function isSiteUrl( url ) { if ( url.match( /http:\/\/(?:www\.)?stream2k\.eu\/watch\/[^\/?]+/ ) ) return true; if ( url.match( /http:\/\/(?:www\.)?stream2k\.eu\/?(\?.+)/ ) && RegExp.$1.match( /[?&]p=\d+/ ) ) return true; if ( url.match( /http:\/\/(?:www\.)?streamvids\.eu\/watch\/[^\/?]+/ ) ) return true; if ( url.match( /http:\/\/(?:www\.)?streamvids\.eu\/?(\?.+)/ ) && RegExp.$1.match( /[?&]p=\d+/ ) ) return true; //old if ( url.match( /http:\/\/(?:www\.)?stream2k\.eu\/[^\/?]*?-video_[0-9a-f]+\.html/ ) ) return true; if ( url.match( /http:\/\/(?:www\.)?stream2k\.eu\/embed\.php(\?.+)/ ) && RegExp.$1.match( /[?&]vid=[0-9a-f]+/ ) ) return true; return false; } function getVideoDetail( url ) { if ( url.match( /http:\/\/(?:www\.)?(?:stream2k|streamvids)\.eu\/watch\/([^\/?]+)/ ) ) { var type = "new"; var bk_title = RegExp.$1; } else if ( url.match( /http:\/\/(?:www\.)?(?:stream2k|streamvids)\.eu\/?(\?.+)/ ) && RegExp.$1.match( /[?&]p=(\d+)/ ) ) { type = "new"; bk_title = "stream2k_" + RegExp.$1; } else if ( ( url.match( /http:\/\/(?:www\.)?stream2k\.eu\/[^\/?]*?-video_[0-9a-f]+\.html/ ) ) ||( url.match( /http:\/\/(?:www\.)?stream2k\.eu\/embed\.php(\?.+)/ ) && RegExp.$1.match( /[?&]vid=[0-9a-f]+/ ) ) ) { type = "old"; } else { //return null; } if ( type == "old" ) { return getVideoDetail_old( url ); } var craving = new CravingSiteScript(); try { var text = craving.getResponseText( url ); } catch( e ) { text = ""; } if ( !text ) return null; if ( text.match( /jwplayer\([^)]*\)\.setup\(([\s\S]*?)\)\s*;/m ) ) { var prm = RegExp.$1.replace( /("|')?logo\1\s*:\s*\{[^}]*?\}/m, "" ); if ( prm.match( /[{,]\s*("|')?file\1\s*:\s*("|')(.*?)\2\s*[,}]/m ) ) { var realUrl = RegExp.$3; } } if ( !realUrl ) return null; if ( text.match( /]*?property\s*=\s*("|')?og:title\2[^>]*)>/i ) && RegExp.$1.match( /\s+content\s*=\s*("|')(.*?)\1/i ) ) { var title = craving.decodeHtml( RegExp.$2 ).replace( /\s*\|.*$/, "" ); } if ( !title && text.match( /