// ==SiteScript==
// @siteName ero oppai 無料動画
// @siteUrl http://ero-oppai.com/
// @author mayan
// @authorUrl
// @scriptUrl
// @description
// @date 2016/01/08
// @version 0.1.3
// ==/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));} );
}
}
var _EroOp = {};
_EroOp.showMsg = true;
function isSiteUrl( url ) {
if ( url.match( /http:\/\/(?:www\.)?ero-oppai.com\/[^\/?]+/ ) ) return true;
if ( url.match( /http:\/\/(?:www\.)?ero-oppai\.com\/?(\?.+)/ )
&& RegExp.$1.match( /[?&]p=\d+/ ) ) return true;
return false;
}
function getVideoDetail( url ) {
if ( typeof _EroOp != "object" ) _EroOp = {};
url = url.replace( /^http:\/\/www\.ero-oppai\.com\//, "http://ero-oppai.com/" );
if ( url.match( /http:\/\/ero-oppai.com\/([^\/?]+)/ ) ) {
var enc = RegExp.$1;
} else
if ( url.match( /http:\/\/(?:www\.)?ero-oppai\.com\/?(\?.+)/ )
&& RegExp.$1.match( /[?&]p=(\d+)/ ) ) {
var vid = RegExp.$1;
} else {
//return null;
}
var craving = new CravingSiteScript();
var objRef = {};
try {
objRef.text = craving.getResponseText( url );
} catch( e ) {
objRef.text = "";
}
if ( !objRef.text ) return null;
if ( !vid &&
objRef.text.match( /]*?rel\s*=\s*('|")?shortlink\2[^>]*)>/im )
&& RegExp.$1.match( /\s+href\s*=\s*("|')(.*?)\1/i )
&& RegExp.$2.match( /[?&]p=(\d+)/ ) ) {
vid = RegExp.$1;
}
if ( objRef.text.match( /
]*?class\s*=\s*("|')?post-title\1[^>]*>\s*(.*?)\s*<\/h1\s*>/im ) ) {
var title = craving.decodeHtml( RegExp.$2 );
}
if ( !title &&
objRef.text.match( /]*?itemprop\s*=\s*("|')?name\2[^>]*)>/im )
&& RegExp.$1.match( /\s+content\s*=\s*("|')(.*?)\1/i ) ) {
title = craving.decodeHtml( RegExp.$2 );
}
if ( !title &&
objRef.text.match( /]*)?>\s*(.*?)\s*<\/title\s*>/im ) ) {
title = craving.decodeHtml( RegExp.$1 ).replace( /\s\|[^|]*$/, "" );
}
if ( !title && enc ) {
try {
title = decodeURIComponent( enc );
} catch( e ) {
title = "";
}
}
if ( !title ) title = "erooppai_" + ( vid || ( new Date().getTime() ) );
title = title.replace(/[\\\/:*?"<>|]/g, "_");
var arrTmp0 = [];
var objReg_video = /