91视频推送下载
// ==UserScript==
// @name 91视频推送下载
// @namespace 91porn_PushDownload
// @version 1.2
// @description 搭配M3U8批量下载器(https://www.52pojie.cn/thread-1374045-1-1.html)使用,点击推送下片,吉尔又要吐了 (‾◡◝)
// @author cocang
// @match *://*.91porn.com/view_video.php*
// @icon http://www.91porn.com/favicon.ico
// @grant GM_xmlhttpRequest
// @connect 127.0.0.1
// ==/UserScript==
function clickFunc() {
GM_xmlhttpRequest({
method: "POST",
url: "http://127.0.0.1:8787/",
headers: {
"Content-Type": "application/json",
},
data: JSON.stringify({
data:
document.querySelector("#videodetails > h4").innerText +
" - " +
document.querySelector("span.title-yakov > a > span").innerText +
"," +
document.querySelector("#player_one_html5_api>source").src,
type: "2",
}),
onload: function (xhr) {
let json = JSON.parse(xhr.responseText);
if (Boolean(json.stat)) {
showToast("推送下载成功", 2000);
} else {
showToast("推送下载失败", 2000);
}
},
onerror: function (xhr) {
showToast("推送失败,请打开M3U8批量下载器或检查8787端口占用情况", 2000);
},
});
}
function showToast(msg, duration) {
duration = isNaN(duration) ? 3000 : duration;
let m = document.createElement("div");
m.innerHTML = msg;
m.style.cssText =
"max-width:60%;min-width: 150px;padding:0 14px;height: 40px;color: rgb(255, 255, 255);line-height: 40px;text-align: center;border-radius: 4px;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 999999;background: rgba(0, 0, 0,.7);font-size: 16px;";
document.body.appendChild(m);
setTimeout(function () {
let d = 0.5;
m.style.transition =
"-webkit-transform " + d + "s ease-in, opacity " + d + "s ease-in";
m.style.opacity = "0";
setTimeout(function () {
document.body.removeChild(m);
}, d * 1000);
}, duration);
}
let html = document.querySelector("div.clear").innerHTML;
document.querySelector("div.clear").innerHTML =
"<button class='login_register_header' id='btndl'>点击推送下载 <i class='fa fa-download'></i></button>" +
html;
document.getElementById("btndl").onclick = clickFunc;
document.querySelector("#vjs_preroll_video").src = '';