JAVBUS封面大图

改编自脚本 JAV老司机

< Feedback on JAVBUS封面大图

Review: Good - script works

§
Posted:
Edited:
作者你好,我在你脚本基础把jav老司机离线下载也加进去了。
头部加上 // @grant GM_notification

然后在function addCopybutton(tag,text){}这里替换修改就能用115离线了。
还有搭配 https://greasyfork.org/zh-CN/scripts/390681-115av-helper
的脚本就能调用本地播放器。115av-helper脚本最好加上延迟几秒运行。

let Common = {
/**
* 方法: 通用chrome通知
* @param title
* @param body
* @param icon
* @param click_url
*/
notifiy: function (title, body, icon, click_url) {
var notificationDetails = {
text: body,
title: title,
timeout: 3000,
image: icon,
onclick: function () {
window.open(click_url);
}
};
GM_notification(notificationDetails);
},
};
function request(url) {
return new Promise(resolve => {
//let time1 = new Date();
GM_xmlhttpRequest({
url,
method: 'GET',
headers: {
"Cache-Control": "no-cache"
},
timeout: 30000,
onload: response => { //console.log(url + " reqTime:" + (new Date() - time1));
resolve(response);
},
onabort: response =>{
console.log(url + " abort");
resolve(response);
},
onerror: response =>{
console.log(url + " error");
console.log(response);
resolve(response);
},
ontimeout: response =>{
console.log(url + " timeout");
resolve(response);
},
});
});
}


function addCopybutton(tag,text){
var copyButton = $('复制');
var copyButton115 = $('115');
copyButton.click(function(){
var btn=this;
btn.innerHTML = '成功';
GM_setClipboard(text);
setTimeout(function() {
btn.innerHTML = '复制';
}, 1000);
});
copyButton115.click(function(){
//jav老司机离线
var maglink = text;
var jav_userID = 0;
var icon = "http://geekdream.com/image/115helper_icon_001.jpg";
let promise = request('http://115.com/?ct=offline&ac=space&_='+ new Date().getTime());
promise.then((responseDetails) => {
if (responseDetails.responseText.indexOf('html') >= 0) {
//未登录处理
Common.notifiy("115还没有登录",
'请先登录115账户后,再离线下载!',
icon,
'http://115.com/?mode=login'
);
return false;
}
var sign115 = JSON.parse(responseDetails.response).sign;
var time115 = JSON.parse(responseDetails.response).time;
console.log("uid=" + jav_userID + " sign:" + sign115 + " time:" + time115);
console.log("rsp:" + responseDetails.response);
GM_xmlhttpRequest({
method: 'POST',
url: 'http://115.com/web/lixian/?ct=lixian&ac=add_task_url', //添加115离线任务接口
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
data: "url=" + encodeURIComponent(maglink) + "&uid=" + jav_userID + "&sign=" + sign115
+ "&time=" + time115,
onload: function (responseDetails) {
var lxRs = JSON.parse(responseDetails.responseText); //离线结果
if (lxRs.state) {
//离线任务添加成功
Common.notifiy("115老司机自动开车",
'离线任务添加成功',
icon,
'http://115.com/?tab=offline&mode=wangpan'
);
}
else {
//离线任务添加失败
if (lxRs.errcode == '911') {
lxRs.error_msg = '你的帐号使用异常,需要在线手工重新验证即可正常使用。';
}
Common.notifiy("失败了",
'请重新打开115,' + lxRs.error_msg,
icon,
'http://115.com/?tab=offline&mode=wangpan'
);
}
console.log("sign:" + sign115 + " time:" + time115);
console.log("磁链:" + maglink + " 下载结果:" + lxRs.state + " 原因:" + lxRs.error_msg);
console.log("rsp:" + responseDetails.response);
}
});

});
event.preventDefault(); //阻止跳转
});
var td_tag=$('');
td_tag.append(copyButton);
var td_tag1=$('');
td_tag1.append(copyButton115);
$(tag).prepend(td_tag);
$(tag).prepend(td_tag1);
}

Post reply

Sign in to post a reply.