本脚本将在免登录115的状态下,在AVMOO、JAVBUS等片库网站中基于115实现一些额外功能(前提当然是你要有会员啦)
当前为
// ==UserScript==
// @name 115AV Helper
// @author kyay006
// @namespace http://tampermonkey.net/
// @version 1.2
// @description 本脚本将在免登录115的状态下,在AVMOO、JAVBUS等片库网站中基于115实现一些额外功能(前提当然是你要有会员啦)
// @description 理论上只要页面看起来跟AVMOO、JAVBUS像,脚本就支持该网站,只需自行在下方参照格式添加一条match即可
// @match http*://avmask.com/*
// @match http*://avmoo.com/*
// @match http*://avsox.asia/*
// @match http*://www.javbus.com/*
// @domain 115.com
// @require https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js
// @grant GM_registerMenuCommand
// @grant GM_xmlhttpRequest
// @grant GM_notification
// @grant GM_addStyle
// ==/UserScript==
(function() {
var cookie = "";//★★★使用前请先在双引号中填入你的115 Cookie★★★
var boxs = $('a.movie-box');
var URL_USER_INFO = "https://webapi.115.com/files/index_info";
var URL_SEARCH = "https://webapi.115.com/files/search?cid=0&limit=10&search_value=";
var URL_VIDEO = "http://115.com/api/video/m3u8/";
getCookieState();
function getCookieState(){
if(cookie == ""){
msg("脚本中的Cookie为空\n请先在脚本中填写Cookie,否则将无法查询数据!");
}else{
httpGet(URL_USER_INFO,function(xhr){
var json = $.parseJSON(xhr.responseText);
if(json.state){
urlMatch();
}else{
msg("脚本中的Cookie已过期,请重新填写!");
}
})
}
}
function urlMatch(){
var path = window.location.pathname;
if(path.search("/movie") == -1){
boxs.each(function(){
setMultiEles($(this));
})
}else{
setSingleEle($('div.container'));
}
}
function setMultiEles(node){
var title = node.find('div.photo-info span');
var code = title.find('date:first').text();
addPlayBtn(code,title,node.find('div.photo-frame'));
}
function setSingleEle(node){
var title = node.find('h3:first');
var code = node.find("span[style='color:#CC0000;']").text();
addPlayBtn(code,title,node.find('div.screencap'));
}
function addPlayBtn(code,title,node){
var json;
var exist = false;
httpGet(URL_SEARCH + code,function(xhr){
json = $.parseJSON(xhr.responseText);
if(!$.isEmptyObject(json.data)){
exist = true;
}else{
code = code.replace("-","");
httpGet(URL_SEARCH + code, function(xhr){
json = $.parseJSON(xhr.responseText);
if(!$.isEmptyObject(json.data)){
exist = true;
}
})
}
if(exist){
setTitleCss(title);
node.append("<a class='play-box' href='javascript:;'><i class='play-ico'></i></a>");
node.find('a.play-box').on('click',function(){
startPlay(getVideo(json.data));
})
}
})
}
function getVideo(data){
var name;
var regExp = /avi|mp4|wmv/;
for(var i=0;i<data.length;i++){
if(!$.isEmptyObject(data[i].pc)){
name = data[i].ico;
if(name){
if(name.search(regExp) >= 0){
return data[i].pc;
}
}
}
}
}
function startPlay(video_pc){
httpGet(URL_VIDEO + video_pc + ".m3u8",function(xhr){
var arr = xhr.responseText.split("\n");
arr.shift();
arr.pop();
var num,index,max = 0;
for(var i=0;i<=arr.length - 2;i=i+2){
num = Number(arr[i].match(/BANDWIDTH=(\d+)/)[1]);
if(num == 3000000){
index = i;
break;
}
if(num > max){
index = i;
max = num;
}
}
window.location.href = "potplayer://" + arr[index+1];
})
}
function setTitleCss(ele){
ele.css("font-weight","bold");
ele.css("color","blue");
}
function httpGet(url, callback){
GM_xmlhttpRequest({
method:"GET",
url:url,
headers:{'Cookie':cookie},
onload:xhr => callback(xhr)
})
}
function msg(content){
GM_notification(content,"油猴脚本\"115已有影片标记\"");
}
//GM_registerMenuCommand("添加磁链",function(){alert("test")})
GM_addStyle(`
div.photo-frame{
position:relative;
}
a.play-box{
display:none;
width:100%;
height:100%;
position:absolute;
top:0;
background:rgba(207,207,207,0.5);
}
i.play-ico{
width:50px;
height:50px;
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAACC0lEQVRoQ+2a0W2DMBCGfc956QgMkB3abtJuABMUJijZINkg3SDZIJVMkke6QSLhPMVc5QgiKwoRYIyPCL9j3cfd7/s5DOxJFjwJBxtBqGWyMiOe571MJpNvAPAYY6ssy2Zpmh6oAZTxVIJMp9OQMfalBa4gQs75jCLMI5AVY+z1NmhETPM8D3a73ZISUGMQLfgVIgZJkmwoAJmAXOJHxLkQInCtH2OQIhtKP7HLA6ErkDI7qToQkiRZ9F1unYLo+mGMRZxzdWD0smyBXPUjpYz2+73KlNVlFUSLPLStn75AFNMBEX1b+ukTpCy3DQAEXeundxCt3Jbn8znoSj8uQcoMxUKIyLShOgfRGqqRIaUCcm2oAPDZRj+kQEwMKVWQxoaUNIhuSDnn0SNrMASQa/8RQrxXnW6DAVE0eZ7Pttutfy8zI4hVK3tnc0T8FUK8Dbm0jurrk3OupjqVi3RpIeJCCOHXsS9UQdaF5a89oSEFgoh/APAxZItyREQ1tIjbHiLOM6J6w+l0CuvogKTYEfFHSukP9sNK9QMA8NvogEpGlA7U8GHeVgeuQS4NLcuy2FQHzkBUQ5NShl3pwAXIuvgpNMyRqWpoxRDbig76yEgtY2dD5OWexg2xibGjCtLY2JECMTF2rkBuf08bGzsnIMWFgVi7MGC1oZlCjndRTN9g18+PGen6jZru9w9A+YlCWMD4+gAAAABJRU5ErkJggg==);
position:absolute;
top:50%;
left:50%;
transform: translate(-50%, -50%);
}
div.photo-frame:hover a.play-box{
display:block;
}
div.screencap:hover a.play-box{
display:block;
}
`);
})();