您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
琉璃神社、灵梦御所、纯爱计划神秘代码转换成下载链接(https版)
当前为
// ==UserScript== // @name Create Download Links for HACG (https) // @namespace hoothin // @description 琉璃神社、灵梦御所、纯爱计划神秘代码转换成下载链接(https版) // @author 天涯倦客 // @supportURL http://t.qq.com/HeartBlade // @include http*://www.hacg.*/wordpress/* // @include http*://hacg.*/wordpress/* // @include http*://www.hacg.*/wp/* // @include http*://hacg.*/wp/* // @include http*://blog.reimu.net/* // @include http*://pan.baidu.com/share/* // @include http*://pan.baidu.com/s/* // @include http*://sexacg.com/* // @version 3.19 // @grant none // @run-at document-end // ==/UserScript== (function(){ if(/hacg.*about\.html/.test(location.href)){ return; } //度盘填充提取码 if(/baidu/.test(location.href)){ if(location.hash.slice(1)){ document.querySelector("#accessCode").value=location.hash.slice(1); document.querySelector('#submitBtn').click(); } return; } var codeRule = /(?:提取|访问|密|艾)[码碼]?\s*[:: ]?\s*([a-z\d]{4}|\S*)/i; if (location.href.indexOf(".reimu.") != -1){ document.querySelector("#main").addEventListener('DOMNodeInserted', function(e) { var pre = document.querySelector("pre"); if (pre && !document.querySelector("#blockBtn")) { var blockBtn=document.createElement("button"); blockBtn.id="blockBtn"; blockBtn.type="button"; blockBtn.textContent="好孩子看不到"; blockBtn.style="padding:4px 0;position: relative;width:120px;"; pre.before(blockBtn); var oldDriver = document.querySelector(".entry-content"); var txt=oldDriver.innerHTML.toString(); if(regObj.btih.test(txt)){ var magH=txt.match(regObj.btih); for (j=0;j<magH.length;j++){ linkArr.btih=hashFunc(magH[j])[3]+'<a href="magnet:?xt=urn:btih:'+hashFunc(magH[j])[2]+'" >磁力链接 </a>'; linkArr.btih+=' →<a href="http://www.torrent.org.cn/Home/Convert/magnet2torrent.html?hash='+hashFunc(magH[j])[2]+'" target="_blank" title="需要先注册登陆">【下载种子】</a>'; linkArr.btih+=' <a href="http://www.btaia.com/torrent/detail/hash/'+hashFunc(magH[j])[2]+'" target="_blank" title="支持Base32,可查看种子内容,需要验证码,长期Invalid CAPTCHA token">【种子详情】</a>'; txt=txt.replace(magH[j],linkArr.btih); } } //度娘 txt=txt.replace(regObj.bdshare,linkArr.baidu); //好盘 txt=txt.replace(regObj.howfile,linkArr.howf); //短链接 txt=txt.replace(regObj.tcn,linkArr.tcn); //115 txt=txt.replace(regObj.yyw,linkArr.yyw); //mega txt=txt.replace(regObj.mega,linkArr.mega); oldDriver.innerHTML=txt; var link; if (document.querySelectorAll) { link = document.querySelectorAll('a'); } else { link = document.getElementsByTagName('a'); } for (var i = 0, k = link.length; i < k; i++) { var target=link[i]; if(/baidu.com/i.test(target.href)&&!/(?:eyun|tieba)\.baidu\.com/i.test(target.href)&&!/#/i.test(target.href)){ //正则校验匹配的网盘,豁免 百度企业云盘 if(codeRule.test(target.textContent)){ target.href+='#'+extCode(target); } else if(target.nextSibling&&codeRule.test(target.nextSibling.textContent)){ if(!/#\S+/i.test(target.href)){ target.href+=/#/i.test(target.href)?extCode(target.nextSibling):('#'+extCode(target.nextSibling)); } } else if(codeRule.test(target.parentNode.textContent)){ if(!/#\S+/i.test(target.href)) target.href+=/#/i.test(target.href)?extCode(target.nextSibling):('#'+extCode(target.nextSibling)); } else { var j = 0, maxParent = 5, //向上遍历的层级 parent = target; while(j<maxParent) { j++; //遍历计数 parent = parent.parentNode; //取得父对象 if(parent.tagName=="TR") { //如果父对象是表格,则从表格中提取密码 if(codeRule.test(parent.nextElementSibling.textContent)) { parent=parent.nextElementSibling; target.href+='#'+extCode(parent); break; } } else if(codeRule.test(parent.textContent)) { //否则按照常规方式提取密码 target.href+='#'+extCode(parent); break; } if(parent==document.body) break; //如果已经遍历到最顶部,停止遍历 } } } } document.querySelector("#blockBtn").addEventListener("click",function(){ if(this.nextSibling.style.display == 'block'){ this.nextSibling.style.display = ''; }else{ this.nextSibling.style.display = 'block'; } }); } }); var pre = document.querySelector("pre"); if (pre && !document.querySelector("#blockBtn")) { var blockBtn=document.createElement("button"); blockBtn.id="blockBtn"; blockBtn.type="button"; blockBtn.textContent="好孩子看不到"; blockBtn.style="padding:4px 0;position: relative;width:120px;"; pre.before(blockBtn); } } var i; //防爆补丁 var feiZao=document.getElementsByTagName("p1"); var fZLength=feiZao.length; if (!!fZLength){ for (i=0;i<fZLength;i++){ feiZao[0].parentNode.removeChild(feiZao[0]); } } var regObj={ //用于匹配的正则 btih:/(?:[^\/=\|]|^)\b([a-fA-F0-9]{40}|[a-zA-Z0-9]{32})\b/g, bdshare:/\s(?:b?\/s\/)(\w{7,8})\b(?:\s+(\w{4})\b)?(?![\">=])/g, //度娘 类型:/s/1i31aCbb b/s/1i31aCbb >>>其后非?!xxx howfile:/@?(?:HF|howfile)\/file\/(\w{4,10})\/(\w{8,})\/?/gi, //好盘 类型I:@HF/file/61dbeea7/0c7f2f56/ @howfile/file/61dbeea7/0c7f2f56/ tcn:/\bt\/(\w{7})/g, //t.cn短链接 类型I:t/RZEWYLu yyw:/(\/lb\/)?(5lb[a-zA-Z0-9]{8,12})/g, //115礼包:/lb/5lbeo3p8eh02 mega:/(?:\.co)?(\.nz\/(#[\w!-]{22,}))/g //.co.nz/#!AZcSmbJA!Q5ZbtIDoQecZc_3Cmc2v_vMaLFJRO6Ctd7uaWdWKqK0 //.nz/#F!Cw9HSQCR!GgOIg9e9FNQGSplRDNxWDw }; var linkArr=[]; //用于替换的链接 linkArr.btih='';//未定义 linkArr.baidu="<a href='http://pan.baidu.com/s/$1#$2' target='_blank'>度娘:$1</a> $2"; linkArr.howf="<a href='http://howfile.com/file/$1/$2/' target='_blank'>好盘:howfile.com/file/$1/$2</a>"; linkArr.tcn="<a href='http://t.cn/$1' target='_blank'>短链:t.cn/$1</a>"; linkArr.yyw="<a href='http://115.com/lb/$2' target='_blank'>115礼包:$2</a> "; linkArr.mega="<a href='https://mega.co$1' target='_blank'>MEGA网盘:$2</a>"; //磁链 function hashFunc(hash){ //hash操作 hashWord=hash.match(/^\W*/g)[0]; hash=hash.replace(/[\s\W]*/g, "").toUpperCase(); hashStart=hash.slice(0,2); hashEnd=hash.slice(-2); return [hashStart,hashEnd,hash,hashWord]; } function processTxt(target){ var txt=target.innerHTML; if(regObj.btih.test(txt)){ var magH=txt.match(regObj.btih); for (j=0;j<magH.length;j++){ linkArr.btih=hashFunc(magH[j])[3]+'<a href="magnet:?xt=urn:btih:'+hashFunc(magH[j])[2]+'" >磁力链接 </a>'; linkArr.btih+=' →<a href="http://www.torrent.org.cn/Home/Convert/magnet2torrent.html?hash='+hashFunc(magH[j])[2]+'" target="_blank" title="需要先注册登陆">【下载种子】</a>'; linkArr.btih+=' <a href="http://www.btaia.com/torrent/detail/hash/'+hashFunc(magH[j])[2]+'" target="_blank" title="支持Base32,可查看种子内容,需要验证码,长期Invalid CAPTCHA token">【种子详情】</a>'; txt=txt.replace(magH[j],linkArr.btih); } } //度娘 txt=txt.replace(regObj.bdshare,linkArr.baidu); //好盘 txt=txt.replace(regObj.howfile,linkArr.howf); //短链接 txt=txt.replace(regObj.tcn,linkArr.tcn); //115 txt=txt.replace(regObj.yyw,linkArr.yyw); //mega txt=txt.replace(regObj.mega,linkArr.mega); target.innerHTML=txt; } var content=document.querySelector('.entry-content'); if(location.href.indexOf("sexacg.") != -1)content=document.querySelector('article'); if(content){ if(location.href.indexOf("sexacg.") != -1){ var quote = content.querySelector('.su-quote-inner'); if(quote){ processTxt(quote); } } var oldDrivers = content.querySelectorAll("p"); for(var i=0,k=oldDrivers.length;i<k;i++){ processTxt(oldDrivers[i]); } oldDrivers = content.querySelectorAll("td"); for(var i=0,k=oldDrivers.length;i<k;i++){ processTxt(oldDrivers[i]); } oldDrivers = content.querySelectorAll("pre"); for(var i=0,k=oldDrivers.length;i<k;i++){ processTxt(oldDrivers[i]); } } function extCode(obj){ text=obj.textContent.trim(); var rule=new RegExp('(?:提取|访问)[码碼]?\s*[:: ]?\\s*([a-z\\d]{4})','i'); return rule.test(text)?text.match(rule)[1]:(codeRule.test(text)?text.match(codeRule)[1]:""); //首先尝试使用 提取码|访问码 作为密码匹配的关键字,无效时则使用更完整的匹配规则 } var link; if (document.querySelectorAll) { link = document.querySelectorAll('a'); } else { link = document.getElementsByTagName('a'); } for (var i = 0, k = link.length; i < k; i++) { if (/.*http:.*\.hacg\./i.test(link[i].outerHTML)) { link[i].href = link[i].outerHTML.match(/(?<=href=").*?(?=")/i)[0].replace(/http/, 'https'); } var target=link[i]; if(/baidu.com/i.test(target.href)&&!/(?:eyun|tieba)\.baidu\.com/i.test(target.href)&&!/#/i.test(target.href)){ //正则校验匹配的网盘,豁免 百度企业云盘 if(codeRule.test(target.textContent)){ target.href+='#'+extCode(target); } else if(target.nextSibling&&codeRule.test(target.nextSibling.textContent)){ if(!/#\S+/i.test(target.href)){ target.href+=/#/i.test(target.href)?extCode(target.nextSibling):('#'+extCode(target.nextSibling)); } } else if(codeRule.test(target.parentNode.textContent)){ if(!/#\S+/i.test(target.href)) target.href+=/#/i.test(target.href)?extCode(target.nextSibling):('#'+extCode(target.nextSibling)); } else { var j = 0, maxParent = 5, //向上遍历的层级 parent = target; while(j<maxParent) { j++; //遍历计数 parent = parent.parentNode; //取得父对象 if(parent.tagName=="TR") { //如果父对象是表格,则从表格中提取密码 if(codeRule.test(parent.nextElementSibling.textContent)) { parent=parent.nextElementSibling; target.href+='#'+extCode(parent); break; } } else if(codeRule.test(parent.textContent)) { //否则按照常规方式提取密码 target.href+='#'+extCode(parent); break; } if(parent==document.body) break; //如果已经遍历到最顶部,停止遍历 } } } } //手动转换文本框 var oD_box=document.createElement("div"); oD_box.id="oD_box"; oD_box.style="position:fixed;top:10px;right:10px; width:210px;"; var oD_text=document.createElement("input"); oD_text.id="oD_text"; oD_text.type="text"; oD_text.placeholder="输入hash值"; oD_text.title='将自动添加"magnet:?xt=urn:btih:",去除[]中的内容、非字母数字字符、空格'; var oD_button=document.createElement("button"); oD_button.id="oD_button"; oD_button.type="button"; oD_button.textContent="开车"; oD_button.style="padding:4px 0; position: relative; top:-1px"; oD_button.onclick=function (){ var oD_hash=oD_text.value.replace(/(\[.*\])|[\W_]/g,""); oD_link.href="magnet:?xt=urn:btih:"+oD_hash; oD_link.textContent="磁链"; oD_link2.href="http://www.torrent.org.cn/Home/Convert/magnet2torrent.html?hash="+oD_hash; oD_link2.textContent="种子"; oD_link2.style="margin-left:20px"; oD_link3.href="http://www.btaia.com/torrent/detail/hash/"+oD_hash; oD_link3.textContent="详情"; oD_link3.style="margin-left:20px"; }; var oD_link=document.createElement("a"); var oD_link2=document.createElement("a"); var oD_link3=document.createElement("a"); oD_link2.target="_blank"; oD_link3.target="_blank"; oD_box.appendChild(oD_text); oD_box.appendChild(oD_button); oD_box.appendChild(oD_link); oD_box.appendChild(oD_link2); oD_box.appendChild(oD_link3); document.body.appendChild(oD_box); if(document.querySelector("#blockBtn")){ document.querySelector("#blockBtn").addEventListener("click", function(){ if(this.nextSibling.style.display == 'block'){ this.nextSibling.style.display = ''; }else{ this.nextSibling.style.display = 'block'; } }); } //评论区度娘、115、tcn var buDang=document.getElementsByClassName('comment-content'); for (i in buDang){ if(buDang[i]&&buDang[i].innerHTML) buDang[i].innerHTML=buDang[i].innerHTML.replace(/\s(\w{7,8})\b(?:\s*(?:<br>|密码:|密码:|pw:|提取码:)?\s*([a-z0-9A-Z]{4}\b|[^\s\<]+?(?=\<)))/gi,linkArr.baidu).replace(regObj.yyw,linkArr.yyw).replace(regObj.tcn,linkArr.tcn); } })();