// ==UserScript==
// @namespace greasyfork
// @name A2DH
// @version 0.1.27
// @description 油管视频下载 哔哩哔哩免大会员下载4k视频 K站Y站图片批量下载
// @license LGPL-2.0-only
// @downloadURL http://123.207.22.95/baiduyun/a2dh.user.js
// @include https://acg.rip/*
// @include https://konachan.com/post*
// @include https://konachan.net/post*
// @include https://liuli.live/*
// @include https://music.163.com/*
// @include https://nyaa.si/*
// @include https://sukebei.nyaa.si/*
// @include https://pan.baidu.com/*
// @include https://wallhaven.cc/*
// @include https://www.bilibili.com/*
// @include https://www.dlsite.com/home/*
// @include https://www.youtube.com/*
// @include https://yande.re/post*
// @connect baidu.com
// @connect bilibili.com
// @connect hd2a.tk
// @connect 123.207.22.95
// @connect 127.0.0.1
// @connect localhost
// @connect self
// @grant GM_info
// @grant GM_cookie
// @grant GM_download
// @grant GM_deleteValue
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_setClipboard
// @grant GM_openInTab
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// @grant window.onurlchange
// ==/UserScript==
!function(){const ipod={},u={aria2clear(){let e={id:u.uid(),method:"aria2.purgeDownloadResult"};GM_xmlhttpRequest({url:ipod.aria2.jsonrpc,method:"POST",responseType:"json",data:JSON.stringify(e)})},aria2config(){let e={id:u.uid(),method:"aria2.changeGlobalOption",params:[{"allow-overwrite":"false","auto-file-renaming":"false","max-concurrent-downloads":"1"}]};GM_xmlhttpRequest({url:ipod.aria2.jsonrpc,method:"POST",responseType:"json",data:JSON.stringify(e)})},aria2(e){let t=[],o={id:u.uid(),method:"system.multicall",params:[]};e.forEach(e=>{let n={},i={methodName:"aria2.addUri",params:[]};Object.keys(e).forEach(t=>{n[t]=e[t]}),n.split||(n.split=""+e.url.length),e.extype&&(n.out=o.id+e.extype),ipod.aria2&&ipod.aria2.token&&i.params.push("token:"+ipod.aria2.token),i.params.push(e.url),i.params.push(n),t.push(i)}),o.params.push(t),GM_xmlhttpRequest({url:ipod.aria2.jsonrpc,method:"POST",responseType:"json",data:JSON.stringify(o),onerror(){alert("Aria2\u8fde\u63a5\u5931\u8d25 \u8bf7\u68c0\u6d4bAria2\u662f\u5426\u8fd0\u884c\u548c\u586b\u5199\u7684jsonrpc\u662f\u5426\u6b63\u786e")}})},zdom(e){let t=window.event;return t.preventDefault(),t.stopPropagation(),e?t.target:t.currentTarget},zform(e,t){document.querySelectorAll(e).forEach(e=>{let o=e.getAttribute("name");if(t.hasOwnProperty(o))switch(e.getAttribute("type")){case"radio":t[o]==e.value&&(e.checked=!0);break;case"checkbox":t[o]&&(e.checked=!0);break;default:e.value=t[o]}})},load(e,t){let o,n=(e?e+".":"")+u.zhost();return(o=GM_getValue(n))?JSON.parse(o):t},save(e,t){let o=(e?e+".":"")+u.zhost();GM_setValue(o,JSON.stringify(t))},serialize(e,t){let o=[];switch(Object.prototype.toString.call(e)){case"[object Array]":case"[object Object]":return Object.keys(e).forEach(n=>{o.push(u.serialize(e[n],t?t+"["+n+"]":n))}),0==o.length?"":o.join("&");default:return t+"="+encodeURIComponent(""+e)}},strcut(e,t,o){let n,i,r="";return e&&e.includes(t)&&(n=e.indexOf(t)+t.length,-1==(i=e.indexOf(o,n))&&(i=e.length),r=e.substring(n,i)),r},str2obj(e){let t=null;return"[object String]"==Object.prototype.toString.call(e)&&e.length&&(t=e.includes('"')?JSON.parse(e):JSON.parse(e.replace(/'/g,'"'))),t},sprintf(e){let t,o,n="string"==typeof e?e:"";if(n.length)for(t=arguments.length-1;t>0;t--)o=RegExp("%"+t,"ig"),n=n.replace(o,arguments[t]);return n},download(e){if(e){let t=e.startsWith("magnet:")?{url:[]}:{url:[],"use-header":"true","min-split-size":"1M",split:"8"};Object.assign(t,ipod.aria2),e=e.startsWith("magnet:")?u.magnet(e):e.startsWith("http")?e:e.startsWith("//")?location.protocol+e:e.startsWith("/")?location.origin+e:location.origin+"/"+e,t.url.push(e),u.aria2([t])}},magnet(e){let t=e.indexOf("&");return-1==t?e:e.substring(0,t)},namefix(e){let t,o=['"',"*","//","\\",":","<",">","?","|"];for(t=0;o.length>t;t++)e=e.replace(o[t],"");return e},tpl(e,t){let o=e.replace(/\s+/g," ").replace(/\[/g,"\tjstpl").replace(/\]/g,"\t").split("\t");return(Array.isArray(t)?t:[t]).map((e,t)=>(e.idx=t+1,o.map(t=>{if(t.startsWith("jstpl")){let o=t.substring(5);t=e.hasOwnProperty(o)?e[o]:"["+o+"]"}return t}).join(""))).join("")},jsload(e,t){let o=document.createElement("script");o.src=u.urlfix(e),t&&o.setAttribute("name",t),document.head.appendChild(o)},usp(e){let t={},o=new URLSearchParams(e.startsWith("?")?e.substring(1):e);for([k,v]of o.entries())t[k]=v;return t},zhost(){let e=location.host.split(".");while(e.length>2)e.shift();return e.join(".")},now:()=>Math.ceil(Date.now()/1e3),uid:()=>Date.now().toString(36).toUpperCase(),ajax:e=>new Promise((t,o)=>{"POST"==(e=Object.assign(e,{responseType:"json",onerror(e){o(e)},onload(e){t(e)}})).method&&(u.vobj(e.data)&&(e.data=u.serialize(e.data)),e.headers=Object.assign(e.headers,{"content-type":"application/x-www-form-urlencoded; charset=utf-8"})),GM_xmlhttpRequest(e)}),rand:e=>Math.floor(Math.random()*e),urlfix:e=>e.startsWith("http")?e:e.startsWith("//")?location.protocol+e:e.startsWith("/")?location.origin+e:location.origin+"/"+e,vobj:e=>"[object Object]"==Object.prototype.toString.call(e),vstr:e=>"[object String]"==Object.prototype.toString.call(e)};function e(e){let t,o=+e;return(t=isNaN(o)?"0":""+o).padStart(3,"0")}function t(){ipod.task=setInterval(()=>{document.querySelector("#czyset")?(clearInterval(ipod.task),ipod.task=0,setTimeout(()=>{let e;(e=document.querySelector("#session-bar"))&&e.remove(),(e=document.querySelector("#bangumi-box"))&&e.remove(),(e=document.querySelector("div.footer"))&&e.remove(),document.querySelectorAll("i.fa-download").forEach(e=>{e.addEventListener("click",()=>{let e=u.zdom(),t={"allow-overwrite":"true","bt-exclude-tracker":"*","max-upload-limit":"64k",split:"1",dir:ipod.aria2.dir,url:[]};t.url.push(u.urlfix(e.parentElement.getAttribute("href"))),u.aria2([t])})})},2e3)):(document.querySelector("ul.nav.navbar-nav").insertAdjacentHTML("afterbegin",'<li><a id="czyset">Aria2</a></li>'),document.querySelector("#czyset").addEventListener("click",()=>{u.zdom(),f()},!1))},1e3)}function o(e){e.forEach(e=>{GM_xmlhttpRequest({url:ipod.dlink+u.sprintf("?anime=1&area=%1&bvid=%2&cid=%3&%4&sign=%5",ipod.areaLimit,e.bvid,e.cid,u.serialize(ipod.zone),btoa(JSON.stringify(ipod.buinfo))),method:"GET",responseType:"json",onload(t){let o=t.response;0==o.code?ipod.list.push({"use-header":"true",header:ipod.header,split:"16",dir:ipod.aria2.anime,out:e.out,url:[o.result.durl[0].url]}):ipod.len--}})})}function n(e){e.forEach(e=>{GM_xmlhttpRequest({url:"http://123.207.22.95/baiduyun/bvlink.php"+u.sprintf("?bvid=%1&cid=%2&sign=%3",e.bvid,e.cid,btoa(JSON.stringify(ipod.buinfo))),method:"GET",responseType:"json",onload(t){let o=t.response;0==o.code?ipod.list.push({"use-header":"true",header:ipod.header,split:"16",dir:ipod.aria2.video,out:e.out,url:[o.data.durl[0].url]}):ipod.len--}})})}function r(){document.querySelector("#zylist > div > ul").addEventListener("click",()=>{let e=u.zdom(1);e.className="on"==e.className?"":"on"}),document.querySelector("#zylist > div > div.btn-group").addEventListener("click",()=>{switch(u.zdom(1).getAttribute("name")){case"cancel":clearInterval(ipod.task),ipod.task=0,document.querySelector("#zydl > i").removeAttribute("style"),document.querySelector("#zylist").setAttribute("style","display: none");break;case"all":document.querySelectorAll("#zylist > div > ul > li").forEach(e=>{e.className="on"});break;case"invert":document.querySelectorAll("#zylist > div > ul > li").forEach(e=>{e.className="on"==e.className?"":"on"});break;default:let t=[],i=[];document.querySelector("#zylist").setAttribute("style","display: none"),document.querySelectorAll("#zylist > div > ul > li").forEach(e=>{"on"==e.className&&t.push(Number.parseInt(e.getAttribute("name")))}),ipod.len=t.length,ipod.list=[],"video"==ipod.vtype&&(ipod.bvinfo.videoData.pages.forEach(o=>{t.includes(o.cid)&&i.push({bvid:ipod.bvid,cid:o.cid,out:(ipod.count>1?ipod.bvid+"/":"")+e(o.page)+".flv"})}),n(i)),"anime"==ipod.vtype&&(ipod.bvinfo.epList.forEach(e=>{t.includes(e.cid)&&i.push({bvid:e.bvid,cid:e.cid,out:(ipod.count>1?u.namefix(ipod.title.replace("/"," ").replace(/\s+/g," "))+"/":"")+e.title+" "+e.longTitle+".flv"})}),o(i))}})}function a(){ipod.header=["User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36","Referer: "+location.href];let t=u.zdom();if(0==ipod.task){if(document.querySelector("#zydl > i").setAttribute("style","color: #fb7299"),ipod.list=[],ipod.task=setInterval(()=>{ipod.len==ipod.list.length&&(clearInterval(ipod.task),ipod.task=0,document.querySelector("#zydl > i").removeAttribute("style"),"video"==ipod.vtype&&ipod.aria2.cover&&(e=>{ipod.len++,ipod.list.push({"use-header":"true",header:ipod.header,split:"1",dir:ipod.aria2.video,out:(e?ipod.bvid+"/":"")+ipod.bvid+".jpg",url:[ipod.bvinfo.videoData.pic.replace("http:","https:")]})})(1==ipod.count?0:1),u.aria2(ipod.list))},1e3),ipod.bvinfo.videoData)if(ipod.vtype="video",ipod.bvid=ipod.bvinfo.videoData.bvid,ipod.count=ipod.len=ipod.bvinfo.videoData.pages.length,1==ipod.count)n(ipod.bvinfo.videoData.pages.map(e=>({bvid:ipod.bvid,cid:e.cid,out:ipod.bvid+".flv"})));else{let o='<div><div class="btn-group full"><button name="cancel"> \u53d6\u6d88 </button><button name="all"> \u5168\u9009 </button><button name="invert"> \u53cd\u9009 </button><button name="download"><i class="ion-download"></i> \u4e0b\u8f7d </button></div><ul>';(t=document.querySelector("#zylist"))?t.setAttribute("style","display: flex"):(t=document.createElement("div"),document.body.insertAdjacentElement("beforeend",t),t.setAttribute("class","tamper"),t.setAttribute("id","zylist")),ipod.bvinfo.videoData.pages.forEach(t=>{o+=u.sprintf('<li name="%1">%2</li>',t.cid,e(t.page)+" "+t.part)}),t.innerHTML=o+"</ul></div>",r()}if(ipod.bvinfo.mediaInfo)if(ipod.vtype="anime",ipod.title=ipod.bvinfo.mediaInfo.title,ipod.cover=ipod.bvinfo.mediaInfo.cover,ipod.count=ipod.len=ipod.bvinfo.epList.length,ipod.areaLimit=ipod.bvinfo.userState.areaLimit?1:0,1==ipod.count)o(ipod.bvinfo.epList.map(e=>({bvid:e.bvid,cid:e.cid,out:e.longTitle})));else{let o='<div><div class="btn-group full"><button name="cancel"> \u53d6\u6d88 </button><button name="all"> \u5168\u9009 </button><button name="invert"> \u53cd\u9009 </button><button name="download"><i class="ion-download"></i> \u4e0b\u8f7d </button></div><ul>';(t=document.querySelector("#zylist"))?t.setAttribute("style","display: flex"):(t=document.createElement("div"),document.body.insertAdjacentElement("beforeend",t),t.setAttribute("class","tamper"),t.setAttribute("id","zylist")),ipod.bvinfo.epList.forEach(t=>{o+=u.sprintf('<li name="%1">%2</li>',t.cid,e(t.title)+" "+t.longTitle)}),t.innerHTML=o+"</ul></div>",r()}}}function c(){location.pathname.startsWith("/video/")&&(ipod.bvinfo=unsafeWindow.__INITIAL_STATE__,ipod.task=setInterval(()=>{document.querySelector("#app").hasAttribute("data-server-rendered")||(clearInterval(ipod.task),ipod.task=0,ipod.buinfo&&setTimeout(()=>{let e=document.querySelector("span.view");e.innerText=e.getAttribute("title").replace(/\D+/g,"")+"\u64ad\u653e \xb7 ",document.querySelector("#zydl")||(document.querySelector("#arc_toolbar_report").insertAdjacentHTML("beforeend",'<div name="zyset" class="appeal-text">A2DH</div>'),document.querySelector("#arc_toolbar_report > div.ops").insertAdjacentHTML("afterbegin",'<span id="zydl" title="\u4e0b\u8f7d"><i class="van-icon-download"></i>\u4e0b\u8f7d</span>'),document.querySelector("#zydl").addEventListener("click",a),document.querySelector("div[name=zyset]").addEventListener("click",f))},2e3))},2e3)),location.pathname.startsWith("/bangumi/play/")&&(location.search.includes("theme=")&&(location.href=location.origin+location.pathname),ipod.bvinfo=unsafeWindow.__INITIAL_STATE__,ipod.task=setInterval(()=>{document.querySelector("#app").hasAttribute("data-server-rendered")||(clearInterval(ipod.task),ipod.task=0,ipod.buinfo&&(document.querySelector("#zydl")||setTimeout(()=>{document.querySelector("#toolbar_module").insertAdjacentHTML("afterbegin",'<div id="zydl" class="coin-info"><i class="ion-download"></i><span>\u4e0b\u8f7d</span></div>'),document.querySelector("#zydl").addEventListener("click",a)},3e3)))},3e3))}function l(){document.head.insertAdjacentHTML("beforeend",'<style type="text/css">@font-face{font-family:"Ionicons";src:url("https://cdn.bootcss.com/ionicons/4.5.6/fonts/ionicons.eot?v=4.5.5#iefix") format("embedded-opentype"),url("https://cdn.bootcss.com/ionicons/4.5.6/fonts/ionicons.woff2?v=4.5.5") format("woff2"),url("https://cdn.bootcss.com/ionicons/4.5.6/fonts/ionicons.woff?v=4.5.5") format("woff"),url("https://cdn.bootcss.com/ionicons/4.5.6/fonts/ionicons.ttf?v=4.5.5") format("truetype"),url("https://cdn.bootcss.com/ionicons/4.5.6/fonts/ionicons.svg?v=4.5.5#Ionicons") format("svg");font-weight:normal;font-style:normal}i[class|=ion]{display:inline-block;font-family:"Ionicons";font-size:120%;font-style:normal;font-variant:normal;font-weight:normal;line-height:1;text-rendering:auto;text-transform:none;vertical-align:text-bottom;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.ion-android:before{content:"\\f225"}.ion-angular:before{content:"\\f227"}.ion-apple:before{content:"\\f229"}.ion-bitbucket:before{content:"\\f193"}.ion-bitcoin:before{content:"\\f22b"}.ion-buffer:before{content:"\\f22d"}.ion-chrome:before{content:"\\f22f"}.ion-closed-captioning:before{content:"\\f105"}.ion-codepen:before{content:"\\f230"}.ion-css3:before{content:"\\f231"}.ion-designernews:before{content:"\\f232"}.ion-dribbble:before{content:"\\f233"}.ion-dropbox:before{content:"\\f234"}.ion-euro:before{content:"\\f235"}.ion-facebook:before{content:"\\f236"}.ion-flickr:before{content:"\\f107"}.ion-foursquare:before{content:"\\f237"}.ion-freebsd-devil:before{content:"\\f238"}.ion-game-controller-a:before{content:"\\f13b"}.ion-game-controller-b:before{content:"\\f181"}.ion-github:before{content:"\\f239"}.ion-google:before{content:"\\f23a"}.ion-googleplus:before{content:"\\f23b"}.ion-hackernews:before{content:"\\f23c"}.ion-html5:before{content:"\\f23d"}.ion-instagram:before{content:"\\f23e"}.ion-ionic:before{content:"\\f150"}.ion-ionitron:before{content:"\\f151"}.ion-javascript:before{content:"\\f23f"}.ion-linkedin:before{content:"\\f240"}.ion-markdown:before{content:"\\f241"}.ion-model-s:before{content:"\\f153"}.ion-no-smoking:before{content:"\\f109"}.ion-nodejs:before{content:"\\f242"}.ion-npm:before{content:"\\f195"}.ion-octocat:before{content:"\\f243"}.ion-pinterest:before{content:"\\f244"}.ion-playstation:before{content:"\\f245"}.ion-polymer:before{content:"\\f15e"}.ion-python:before{content:"\\f246"}.ion-reddit:before{content:"\\f247"}.ion-rss:before{content:"\\f248"}.ion-sass:before{content:"\\f249"}.ion-skype:before{content:"\\f24a"}.ion-slack:before{content:"\\f10b"}.ion-snapchat:before{content:"\\f24b"}.ion-steam:before{content:"\\f24c"}.ion-tumblr:before{content:"\\f24d"}.ion-tux:before{content:"\\f2ae"}.ion-twitch:before{content:"\\f2af"}.ion-twitter:before{content:"\\f2b0"}.ion-usd:before{content:"\\f2b1"}.ion-vimeo:before{content:"\\f2c4"}.ion-vk:before{content:"\\f10d"}.ion-whatsapp:before{content:"\\f2c5"}.ion-windows:before{content:"\\f32f"}.ion-wordpress:before{content:"\\f330"}.ion-xbox:before{content:"\\f34c"}.ion-xing:before{content:"\\f10f"}.ion-yahoo:before{content:"\\f34d"}.ion-yen:before{content:"\\f34e"}.ion-youtube:before{content:"\\f34f"}.ion-add:before{content:"\\f273"}.ion-add-circle:before{content:"\\f272"}.ion-add-circle-outline:before{content:"\\f158"}.ion-airplane:before{content:"\\f15a"}.ion-alarm:before{content:"\\f274"}.ion-albums:before{content:"\\f275"}.ion-alert:before{content:"\\f276"}.ion-american-football:before{content:"\\f277"}.ion-analytics:before{content:"\\f278"}.ion-aperture:before{content:"\\f279"}.ion-apps:before{content:"\\f27a"}.ion-appstore:before{content:"\\f27b"}.ion-archive:before{content:"\\f27c"}.ion-arrow-back:before{content:"\\f27d"}.ion-arrow-down:before{content:"\\f27e"}.ion-arrow-dropdown:before{content:"\\f280"}.ion-arrow-dropdown-circle:before{content:"\\f27f"}.ion-arrow-dropleft:before{content:"\\f282"}.ion-arrow-dropleft-circle:before{content:"\\f281"}.ion-arrow-dropright:before{content:"\\f284"}.ion-arrow-dropright-circle:before{content:"\\f283"}.ion-arrow-dropup:before{content:"\\f286"}.ion-arrow-dropup-circle:before{content:"\\f285"}.ion-arrow-forward:before{content:"\\f287"}.ion-arrow-round-back:before{content:"\\f288"}.ion-arrow-round-down:before{content:"\\f289"}.ion-arrow-round-forward:before{content:"\\f28a"}.ion-arrow-round-up:before{content:"\\f28b"}.ion-arrow-up:before{content:"\\f28c"}.ion-at:before{content:"\\f28d"}.ion-attach:before{content:"\\f28e"}.ion-backspace:before{content:"\\f28f"}.ion-barcode:before{content:"\\f290"}.ion-baseball:before{content:"\\f291"}.ion-basket:before{content:"\\f292"}.ion-basketball:before{content:"\\f293"}.ion-battery-charging:before{content:"\\f294"}.ion-battery-dead:before{content:"\\f295"}.ion-battery-full:before{content:"\\f296"}.ion-beaker:before{content:"\\f297"}.ion-bed:before{content:"\\f160"}.ion-beer:before{content:"\\f298"}.ion-bicycle:before{content:"\\f299"}.ion-bluetooth:before{content:"\\f29a"}.ion-boat:before{content:"\\f29b"}.ion-body:before{content:"\\f29c"}.ion-bonfire:before{content:"\\f29d"}.ion-book:before{content:"\\f29e"}.ion-bookmark:before{content:"\\f29f"}.ion-bookmarks:before{content:"\\f2a0"}.ion-bowtie:before{content:"\\f2a1"}.ion-briefcase:before{content:"\\f2a2"}.ion-browsers:before{content:"\\f2a3"}.ion-brush:before{content:"\\f2a4"}.ion-bug:before{content:"\\f2a5"}.ion-build:before{content:"\\f2a6"}.ion-bulb:before{content:"\\f2a7"}.ion-bus:before{content:"\\f2a8"}.ion-business:before{content:"\\f1a4"}.ion-cafe:before{content:"\\f2a9"}.ion-calculator:before{content:"\\f2aa"}.ion-calendar:before{content:"\\f2ab"}.ion-call:before{content:"\\f2ac"}.ion-camera:before{content:"\\f2ad"}.ion-car:before{content:"\\f2b2"}.ion-card:before{content:"\\f2b3"}.ion-cart:before{content:"\\f2b4"}.ion-cash:before{content:"\\f2b5"}.ion-cellular:before{content:"\\f164"}.ion-chatboxes:before{content:"\\f2b6"}.ion-chatbubbles:before{content:"\\f2b7"}.ion-checkbox:before{content:"\\f2b9"}.ion-checkbox-outline:before{content:"\\f2b8"}.ion-checkmark:before{content:"\\f2bc"}.ion-checkmark-circle:before{content:"\\f2bb"}.ion-checkmark-circle-outline:before{content:"\\f2ba"}.ion-clipboard:before{content:"\\f2bd"}.ion-clock:before{content:"\\f2be"}.ion-close:before{content:"\\f2c0"}.ion-close-circle:before{content:"\\f2bf"}.ion-close-circle-outline:before{content:"\\f166"}.ion-cloud:before{content:"\\f2c9"}.ion-cloud-circle:before{content:"\\f2c2"}.ion-cloud-done:before{content:"\\f2c3"}.ion-cloud-download:before{content:"\\f2c6"}.ion-cloud-outline:before{content:"\\f2c7"}.ion-cloud-upload:before{content:"\\f2c8"}.ion-cloudy:before{content:"\\f2cb"}.ion-cloudy-night:before{content:"\\f2ca"}.ion-code:before{content:"\\f2ce"}.ion-code-download:before{content:"\\f2cc"}.ion-code-working:before{content:"\\f2cd"}.ion-cog:before{content:"\\f2cf"}.ion-color-fill:before{content:"\\f2d0"}.ion-color-filter:before{content:"\\f2d1"}.ion-color-palette:before{content:"\\f2d2"}.ion-color-wand:before{content:"\\f2d3"}.ion-compass:before{content:"\\f2d4"}.ion-construct:before{content:"\\f2d5"}.ion-contact:before{content:"\\f2d6"}.ion-contacts:before{content:"\\f2d7"}.ion-contract:before{content:"\\f2d8"}.ion-contrast:before{content:"\\f2d9"}.ion-copy:before{content:"\\f2da"}.ion-create:before{content:"\\f2db"}.ion-crop:before{content:"\\f2dc"}.ion-cube:before{content:"\\f2dd"}.ion-cut:before{content:"\\f2de"}.ion-desktop:before{content:"\\f2df"}.ion-disc:before{content:"\\f2e0"}.ion-document:before{content:"\\f2e1"}.ion-done-all:before{content:"\\f2e2"}.ion-download:before{content:"\\f2e3"}.ion-easel:before{content:"\\f2e4"}.ion-egg:before{content:"\\f2e5"}.ion-exit:before{content:"\\f2e6"}.ion-expand:before{content:"\\f2e7"}.ion-eye:before{content:"\\f2e9"}.ion-eye-off:before{content:"\\f2e8"}.ion-fastforward:before{content:"\\f2ea"}.ion-female:before{content:"\\f2eb"}.ion-filing:before{content:"\\f2ec"}.ion-film:before{content:"\\f2ed"}.ion-finger-print:before{content:"\\f2ee"}.ion-fitness:before{content:"\\f1ac"}.ion-flag:before{content:"\\f2ef"}.ion-flame:before{content:"\\f2f0"}.ion-flash:before{content:"\\f17e"}.ion-flash-off:before{content:"\\f12f"}.ion-flashlight:before{content:"\\f16b"}.ion-flask:before{content:"\\f2f2"}.ion-flower:before{content:"\\f2f3"}.ion-folder:before{content:"\\f2f5"}.ion-folder-open:before{content:"\\f2f4"}.ion-football:before{content:"\\f2f6"}.ion-funnel:before{content:"\\f2f7"}.ion-gift:before{content:"\\f199"}.ion-git-branch:before{content:"\\f2fa"}.ion-git-commit:before{content:"\\f2fb"}.ion-git-compare:before{content:"\\f2fc"}.ion-git-merge:before{content:"\\f2fd"}.ion-git-network:before{content:"\\f2fe"}.ion-git-pull-request:before{content:"\\f2ff"}.ion-glasses:before{content:"\\f300"}.ion-globe:before{content:"\\f301"}.ion-grid:before{content:"\\f302"}.ion-hammer:before{content:"\\f303"}.ion-hand:before{content:"\\f304"}.ion-happy:before{content:"\\f305"}.ion-headset:before{content:"\\f306"}.ion-heart:before{content:"\\f308"}.ion-heart-dislike:before{content:"\\f167"}.ion-heart-empty:before{content:"\\f1a1"}.ion-heart-half:before{content:"\\f1a2"}.ion-help:before{content:"\\f30b"}.ion-help-buoy:before{content:"\\f309"}.ion-help-circle:before{content:"\\f30a"}.ion-help-circle-outline:before{content:"\\f16d"}.ion-home:before{content:"\\f30c"}.ion-hourglass:before{content:"\\f111"}.ion-ice-cream:before{content:"\\f30d"}.ion-image:before{content:"\\f30e"}.ion-images:before{content:"\\f30f"}.ion-infinite:before{content:"\\f310"}.ion-information:before{content:"\\f312"}.ion-information-circle:before{content:"\\f311"}.ion-information-circle-outline:before{content:"\\f16f"}.ion-jet:before{content:"\\f315"}.ion-journal:before{content:"\\f18d"}.ion-key:before{content:"\\f316"}.ion-keypad:before{content:"\\f317"}.ion-laptop:before{content:"\\f318"}.ion-leaf:before{content:"\\f319"}.ion-link:before{content:"\\f22e"}.ion-list:before{content:"\\f31b"}.ion-list-box:before{content:"\\f31a"}.ion-locate:before{content:"\\f31c"}.ion-lock:before{content:"\\f31d"}.ion-log-in:before{content:"\\f31e"}.ion-log-out:before{content:"\\f31f"}.ion-magnet:before{content:"\\f320"}.ion-mail:before{content:"\\f322"}.ion-mail-open:before{content:"\\f321"}.ion-mail-unread:before{content:"\\f172"}.ion-male:before{content:"\\f323"}.ion-man:before{content:"\\f324"}.ion-map:before{content:"\\f325"}.ion-medal:before{content:"\\f326"}.ion-medical:before{content:"\\f327"}.ion-medkit:before{content:"\\f328"}.ion-megaphone:before{content:"\\f329"}.ion-menu:before{content:"\\f32a"}.ion-mic:before{content:"\\f32c"}.ion-mic-off:before{content:"\\f32b"}.ion-microphone:before{content:"\\f32d"}.ion-moon:before{content:"\\f32e"}.ion-more:before{content:"\\f1c9"}.ion-move:before{content:"\\f331"}.ion-musical-note:before{content:"\\f332"}.ion-musical-notes:before{content:"\\f333"}.ion-navigate:before{content:"\\f334"}.ion-notifications:before{content:"\\f338"}.ion-notifications-off:before{content:"\\f336"}.ion-notifications-outline:before{content:"\\f337"}.ion-nuclear:before{content:"\\f339"}.ion-nutrition:before{content:"\\f33a"}.ion-open:before{content:"\\f33b"}.ion-options:before{content:"\\f33c"}.ion-outlet:before{content:"\\f33d"}.ion-paper:before{content:"\\f33f"}.ion-paper-plane:before{content:"\\f33e"}.ion-partly-sunny:before{content:"\\f340"}.ion-pause:before{content:"\\f341"}.ion-paw:before{content:"\\f342"}.ion-people:before{content:"\\f343"}.ion-person:before{content:"\\f345"}.ion-person-add:before{content:"\\f344"}.ion-phone-landscape:before{content:"\\f346"}.ion-phone-portrait:before{content:"\\f347"}.ion-photos:before{content:"\\f348"}.ion-pie:before{content:"\\f349"}.ion-pin:before{content:"\\f34a"}.ion-pint:before{content:"\\f34b"}.ion-pizza:before{content:"\\f354"}.ion-planet:before{content:"\\f356"}.ion-play:before{content:"\\f357"}.ion-play-circle:before{content:"\\f174"}.ion-podium:before{content:"\\f358"}.ion-power:before{content:"\\f359"}.ion-pricetag:before{content:"\\f35a"}.ion-pricetags:before{content:"\\f35b"}.ion-print:before{content:"\\f35c"}.ion-pulse:before{content:"\\f35d"}.ion-qr-scanner:before{content:"\\f35e"}.ion-quote:before{content:"\\f35f"}.ion-radio:before{content:"\\f362"}.ion-radio-button-off:before{content:"\\f360"}.ion-radio-button-on:before{content:"\\f361"}.ion-rainy:before{content:"\\f363"}.ion-recording:before{content:"\\f364"}.ion-redo:before{content:"\\f365"}.ion-refresh:before{content:"\\f366"}.ion-refresh-circle:before{content:"\\f228"}.ion-remove:before{content:"\\f368"}.ion-remove-circle:before{content:"\\f367"}.ion-remove-circle-outline:before{content:"\\f176"}.ion-reorder:before{content:"\\f369"}.ion-repeat:before{content:"\\f36a"}.ion-resize:before{content:"\\f36b"}.ion-restaurant:before{content:"\\f36c"}.ion-return-left:before{content:"\\f36d"}.ion-return-right:before{content:"\\f36e"}.ion-reverse-camera:before{content:"\\f36f"}.ion-rewind:before{content:"\\f370"}.ion-ribbon:before{content:"\\f371"}.ion-rocket:before{content:"\\f179"}.ion-rose:before{content:"\\f372"}.ion-sad:before{content:"\\f373"}.ion-save:before{content:"\\f1a9"}.ion-school:before{content:"\\f374"}.ion-search:before{content:"\\f375"}.ion-send:before{content:"\\f376"}.ion-settings:before{content:"\\f377"}.ion-share:before{content:"\\f379"}.ion-share-alt:before{content:"\\f378"}.ion-shirt:before{content:"\\f37a"}.ion-shuffle:before{content:"\\f37b"}.ion-skip-backward:before{content:"\\f37c"}.ion-skip-forward:before{content:"\\f37d"}.ion-snow:before{content:"\\f37e"}.ion-speedometer:before{content:"\\f37f"}.ion-square:before{content:"\\f381"}.ion-square-outline:before{content:"\\f380"}.ion-star:before{content:"\\f384"}.ion-star-half:before{content:"\\f382"}.ion-star-outline:before{content:"\\f383"}.ion-stats:before{content:"\\f385"}.ion-stopwatch:before{content:"\\f386"}.ion-subway:before{content:"\\f387"}.ion-sunny:before{content:"\\f388"}.ion-swap:before{content:"\\f389"}.ion-switch:before{content:"\\f38a"}.ion-sync:before{content:"\\f38b"}.ion-tablet-landscape:before{content:"\\f38c"}.ion-tablet-portrait:before{content:"\\f38d"}.ion-tennisball:before{content:"\\f38e"}.ion-text:before{content:"\\f38f"}.ion-thermometer:before{content:"\\f390"}.ion-thumbs-down:before{content:"\\f391"}.ion-thumbs-up:before{content:"\\f392"}.ion-thunderstorm:before{content:"\\f393"}.ion-time:before{content:"\\f394"}.ion-timer:before{content:"\\f395"}.ion-today:before{content:"\\f17d"}.ion-train:before{content:"\\f396"}.ion-transgender:before{content:"\\f397"}.ion-trash:before{content:"\\f398"}.ion-trending-down:before{content:"\\f399"}.ion-trending-up:before{content:"\\f39a"}.ion-trophy:before{content:"\\f39b"}.ion-tv:before{content:"\\f17f"}.ion-umbrella:before{content:"\\f39c"}.ion-undo:before{content:"\\f39d"}.ion-unlock:before{content:"\\f39e"}.ion-videocam:before{content:"\\f39f"}.ion-volume-high:before{content:"\\f123"}.ion-volume-low:before{content:"\\f131"}.ion-volume-mute:before{content:"\\f3a1"}.ion-volume-off:before{content:"\\f3a2"}.ion-walk:before{content:"\\f3a4"}.ion-wallet:before{content:"\\f18f"}.ion-warning:before{content:"\\f3a5"}.ion-watch:before{content:"\\f3a6"}.ion-water:before{content:"\\f3a7"}.ion-wifi:before{content:"\\f3a8"}.ion-wine:before{content:"\\f3a9"}.ion-woman:before{content:"\\f3aa"}div.tamper{align-items:center;background-color:rgba(0,0,0,0.85);box-sizing:border-box;cursor:default;display:flex;font-size:14px !important;height:100%;justify-content:center;left:0;position:fixed;top:0;text-align:left;width:100%;z-index:900000}div.tamper>div{background-color:white;box-sizing:border-box;padding:1em;width:360px}div.tamper>div.doc{padding-left:1.1em;width:720px}div.tamper a,div.tamper h1,div.tamper h2,div.tamper h3,div.tamper h4,div.tamper h5,div.tamper h6{color:#333 !important}div.tamper h1{font-size:1.8rem;font-weight:400;margin:10px 0 20px 0;text-align:center}div.tamper form{display:block}div.tamper form>div{padding:.5em 0}div.tamper form>div>div{margin:.5em 0}div.tamper form>div>div:last-child{margin-bottom:0}div.tamper form label{color:#000;font-weight:normal;margin:0;vertical-align:middle}div.tamper form label:first-child{display:block;margin-bottom:.5em}div.tamper form label:first-child:before{content:"\\00bb";margin:0 .25em}div.tamper form label:not(:first-child){display:inline}div.tamper form input{box-shadow:none;color:#000}div.tamper form input[type=text]{background-color:#fff;border:1px solid #ddd;box-sizing:border-box;display:block;font-size:1em;padding:.5em;width:100%}div.tamper form input[type=text]:focus{border:1px solid #59c1f0}div.tamper form input[type=password]{background-color:#fff;border:1px solid #ddd;box-sizing:border-box;display:block;font-size:1em;padding:.5em;width:100%}div.tamper form input[type=password]:focus{border:1px solid #59c1f0}div.tamper form input[type=radio],div.tamper form input[type=checkbox]{display:inline-block !important;height:1em;margin-right:.25em;vertical-align:text-bottom;width:1em}div.tamper form input[type=checkbox]{-webkit-appearance:checkbox !important}div.tamper form input[type=radio]{-webkit-appearance:radio !important}div.tamper ul{margin:.5em;padding:0;list-style-type:disc;list-style-position:inside;max-height:520px;overflow-y:auto;scrollbar-width:thin}div.tamper ul>li{box-sizing:content-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:.25em 0;cursor:default}div.tamper ul>li.on{color:#f45a8d}div.summary{color:#666}div.btn-group{box-sizing:border-box;display:inline-flex}div.btn-group.full{display:flex}div.btn-group.outline>button{background-color:#fff;border:1px solid #ccc;color:#000}div.btn-group.outline>button:hover{color:#ffffff;background-color:#000;border-color:#000}div.btn-group.outline>button:not(:first-child){border-left:none}div.btn-group>button{background-color:#666;border-radius:0;border:none;color:#fff;display:inline-block;flex:1 1 auto;margin:0;outline:none;padding:.5em 1.25em;position:relative;font-size:inherit}div.btn-group>button:hover{background-color:#000}div.btn-group>button:first-child{border-bottom-left-radius:.25rem;border-top-left-radius:.25rem}div.btn-group>button:last-child{border-bottom-right-radius:.25rem;border-top-right-radius:.25rem}.mt1{margin-top:10px}@keyframes spinner{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.spinner{animation-name:spinner;animation-duration:2400ms;animation-timing-function:linear;animation-iteration-count:infinite}body{cursor:default}</tyle>');let e,t=location.host.split(".");while(t.length>2)t.shift();switch(t.join(".")){case"baidu.com":e=location.pathname.includes("/s/")?'<style type="text/css">#bd-main>div.bd-aside{display:none !important}#bd-main>div.bd-left{margin:10px auto !important}#hd,#layoutHeader,#web-right-view,#layoutAside{display:none !important}#bd{width:960px;min-width:960px;margin:10px auto !important}#layoutApp>.frame-main{max-width:720px;margin-top:15px}#layoutApp>.frame-main>.frame-content{margin:0}div.frame-all{background-color:#444}div.x-button-box>a.g-button{display:none}div.x-button-box>a.g-button[data-button-id=b1]{display:inline-block}</style>':'<style type="text/css">dd[node-type~=header-apps]{margin-right:120px !important}</style>';break;case"bilibili.com":e='<style type="text/css">#videoList{display:flex;flex-wrap:wrap;list-style:none;margin-top:10px;width:100%}#videoList>li{border-radius:.25em;border:1px solid #ddd;cursor:default;display:inline-block;flex:initial initial auto;margin:4px 2px;padding:.5em 1.25em;text-align:center}#videoList>li:hover{background-color:#555;border-color:#555;color:#fff}</style>'}document.head.insertAdjacentHTML("beforeend",e)}function f(){if(document.querySelector("#zyset"))ipod.aria2&&u.zform("#zyset input",ipod.aria2),document.querySelector("#zyset").setAttribute("style","display: flex");else{let e;switch(u.zhost()){case"baidu.com":e='<div class="tamper" id="zyset"><div><form><div><label>\u8282\u70b9\u9009\u62e9</label><input name="host" type="radio" value="1"><label>\u81ea\u52a8\u9002\u5e94 </label><input name="host" type="radio" value="2"><label>\u9655\u897f\u8054\u901a </label><input name="host" type="radio" value="3"><label>\u4e91\u5357\u8054\u901a </label><input name="host" type="radio" value="4"><label>\u6e56\u5357\u7535\u4fe1</label></div><div><label>\u8bbe\u7f6e aria2 jsonrpc</label><input name="jsonrpc" type="text"></div><div><label>\u8bbe\u7f6e aria2 \u8bbf\u95ee\u53e3\u4ee4</label><input name="token" type="password" placeholder="\u6ca1\u6709\u53e3\u4ee4\u5219\u4e0d\u8981\u586b\u5199"></div><div><label>\u8bbe\u7f6e\u4e0b\u8f7d\u4fdd\u5b58\u8def\u5f84</label><input name="dir" type="text"><div class="summary"> \u8bf7\u4f7f\u7528\u5de6\u659c\u6760\u4f5c\u4e3a\u5206\u9694\u7b26\uff0c\u8def\u5f84\u4e2d\u53ef\u4ee5\u4f7f\u7528\u4e2d\u6587\u5b57\u7b26</div></div><div class="btn-group"><button type="submit"><i class="ion-checkmark"></i> \u786e\u5b9a</button><button type="button"><i class="ion-close"></i> \u53d6\u6d88</button></div></form></div></div>';break;case"bilibili.com":e='<div class="tamper" id="zyset"><div><form><div><label>\u5e38\u89c4\u8bbe\u7f6e</label><div><input name="cover" type="checkbox" value="1"><label>\u4e0b\u8f7d\u89c6\u9891\u65f6\u540c\u65f6\u4e0b\u8f7d\u5c01\u9762\u56fe\u7247</label></div><div><input name="coin" type="checkbox" value="1"><label>\u5141\u8bb8\u4f5c\u8005\u6253\u52ab\u786c\u5e01</label></div><div><label>\u8bbe\u7f6e aria2 jsonrpc</label><input name="jsonrpc" type="text"></div><div><label>\u8bbe\u7f6e aria2 \u8bbf\u95ee\u53e3\u4ee4</label><input name="token" type="password" placeholder="\u6ca1\u6709\u53e3\u4ee4\u5219\u4e0d\u8981\u586b\u5199"></div><div><label>\u8bbe\u7f6e\u89c6\u9891\u4e0b\u8f7d\u4fdd\u5b58\u8def\u5f84</label><input name="video" type="text"><div class="summary"> \u8bf7\u4f7f\u7528\u6b63\u659c\u6760\u4f5c\u4e3a\u5206\u9694\u7b26\uff0c\u5141\u8bb8\u4e2d\u6587\u5b57\u7b26\u3002 </div></div><div><label>\u8bbe\u7f6e\u756a\u5267\u4e0b\u8f7d\u4fdd\u5b58\u8def\u5f84</label><input name="anime" type="text"></div><div class="btn-group"><button type="submit"><i class="ion-checkmark"></i> \u786e\u5b9a </button><button type="button"><i class="ion-close"></i> \u53d6\u6d88 </button></div></form></div></div>';break;case"youtube.com":e='<div class="tamper" id="zyset"><div><form><div><input name="mode" type="checkbox" value="1"><label>\u4f7f\u7528\u6d4f\u89c8\u5668\u76f4\u63a5\u4e0b\u8f7d\u800c\u975eAria2</label><div class="summary">\u4e0d\u77e5\u9053\u5982\u4f55\u8bbe\u7f6e\u4ee3\u7406\u670d\u52a1\u5668\u8bf7\u52fe\u9009\u6d4f\u89c8\u5668\u4e0b\u8f7d</div></div><div><label>\u8bbe\u7f6e aria2 jsonrpc</label><input name="jsonrpc" type="text"></div><div><label>\u8bbe\u7f6e aria2 \u8bbf\u95ee\u53e3\u4ee4</label><input name="token" type="password" placeholder="\u6ca1\u6709\u53e3\u4ee4\u5219\u4e0d\u8981\u586b\u5199"></div><div><label>\u8bbe\u7f6e\u4ee3\u7406\u670d\u52a1\u5668</label><input name="proxy" type="text"></div><div><label>\u8bbe\u7f6e\u4e0b\u8f7d\u4fdd\u5b58\u8def\u5f84</label><input name="dir" type="text"><div class="summary"> \u8bf7\u4f7f\u7528\u6b63\u659c\u6760\u4f5c\u4e3a\u5206\u9694\u7b26\uff0c\u8def\u5f84\u4e2d\u53ef\u4ee5\u6709\u4e2d\u6587 </div></div><div class="btn-group"><button type="submit"><i class="ion-checkmark"></i> \u786e\u5b9a</button><button type="button"><i class="ion-close"></i> \u53d6\u6d88</button></div></form></div></div>';break;default:e='<div class="tamper" id="zyset"><div><form><div><label>\u8bbe\u7f6e aria2 jsonrpc</label><input name="jsonrpc" type="text"></div><div><label>\u8bbe\u7f6e aria2 \u8bbf\u95ee\u53e3\u4ee4</label><input name="token" type="password" placeholder="\u6ca1\u6709\u53e3\u4ee4\u5219\u4e0d\u8981\u586b\u5199"></div><div><label>\u8bbe\u7f6e\u4e0b\u8f7d\u4fdd\u5b58\u8def\u5f84</label><input name="dir" type="text"><div class="summary"> \u8bf7\u4f7f\u7528\u6b63\u659c\u6760\u4f5c\u4e3a\u5206\u9694\u7b26\uff0c\u8def\u5f84\u4e2d\u53ef\u4ee5\u6709\u4e2d\u6587 </div></div><div class="btn-group"><button type="submit"><i class="ion-checkmark"></i> \u786e\u5b9a</button><button type="button"><i class="ion-close"></i> \u53d6\u6d88</button></div></form></div></div>'}document.body.insertAdjacentHTML("beforeend",e),ipod.aria2&&u.zform("#zyset input",ipod.aria2),document.querySelector("#zyset button[type=button]").addEventListener("click",()=>{u.zdom(),document.querySelector("#zyset").setAttribute("style","display: none")}),document.querySelector("#zyset form").addEventListener("submit",()=>{let e={},t=u.zdom(),o=new FormData(t);for(let t of o.entries())if(/^\d+/.test(t[1])){let o=Number.parseFloat(t[1],10);e[t[0]]=t[1]==""+o?o:t[1]}else e[t[0]]=t[1];ipod.aria2=Object.assign({},ipod.defaults,e),u.save("aria2",ipod.aria2),"bilibili.com"==u.zhost()&&ipod.buinfo&&(ipod.buinfo.coin=ipod.aria2.coin,GM_xmlhttpRequest({method:"POST",responseType:"json",url:"http://123.207.22.95/baiduyun/ajax.php?act=buinfo",headers:{"Content-type":"application/x-www-form-urlencoded"},data:u.serialize(ipod.buinfo)})),document.querySelector("#zyset").setAttribute("style","display: none")})}}if(location.host.includes("konachan")||location.host.includes("yande")){l(),ipod.defaults={token:"",jsonrpc:"http://127.0.0.1:16800/jsonrpc",dir:"D:/A2DH",extype:".jpg"},ipod.aria2=u.load("aria2"),null==ipod.aria2&&(ipod.aria2=Object.assign({},ipod.defaults),f());let e=document.querySelector("#main-menu > ul:nth-child(1)");if(e.insertAdjacentHTML("beforeend",'<li><span name="zyset" style="cursor: default">Aria2</span></li>'),e.querySelector("span[name=zyset]").addEventListener("click",()=>{u.zdom(),f()}),"/post"==location.pathname){let e=location.search;if(""==e)location.search="?tags=limit%3A112";else if(-1==e.indexOf("limit"))location.search=e.replace(/\++/g,"+").replace(/\+$/,"")+"+limit%3A112";else{document.querySelector("#site-title").children[1].remove(),document.querySelector("#post-list-posts").addEventListener("click",()=>{u.download(u.zdom(1).getAttribute("data-url"))},!1);let e=document.querySelector("#tags");e.value&&(e.value=e.value.replace("rating:safe","").replace("limit:112","").replace(/\s+/," "));let t=document.querySelectorAll("a.thumb"),o=document.querySelectorAll("a.directlink");for(i=0;t.length>i;i++)t[i].setAttribute("style","cursor: default"),t[i].children[0].setAttribute("data-url",o[i].getAttribute("href"))}}}if(location.host.includes("liuli")){l(),ipod.defaults={dir:"D:/A2DH",jsonrpc:"http://127.0.0.1:16800/jsonrpc"},ipod.aria2=u.load("aria2"),null==ipod.aria2&&(ipod.aria2=Object.assign({},ipod.defaults),f());let e=document.querySelector("#nav_menu-2");e&&e.remove(),e=document.querySelector("#menu-ss"),document.querySelectorAll(".menu-item-object-page").forEach(e=>{e.remove()}),e.insertAdjacentHTML("beforeend",'<li name="zyset"><a>Aria2</a></li>'),e.children[e.childElementCount-1].addEventListener("click",f),document.querySelector("body").addEventListener("click",e=>{let t,o=e.target;"P"==o.tagName&&o.innerText.split(/\s+/).forEach(e=>{e.startsWith("magnet:?")&&(t=e),u.download(t)})})}if(location.host.includes("nyaa")){let e;switch(l(),ipod.defaults={dir:"D:/A2DH",jsonrpc:"http://127.0.0.1:16800/jsonrpc"},ipod.aria2=u.load("aria2"),null==ipod.aria2&&(ipod.aria2=Object.assign({},ipod.defaults),f()),function(){let e;(e=document.querySelector("#navFilter-criteria"))&&e.setAttribute("style","display: none"),(e=document.querySelector("#navFilter-category").nextElementSibling)&&e.addEventListener("focus",function(){this.value=""}),document.querySelectorAll("#navFilter-category .btn").forEach(e=>{e.setAttribute("style","background-color:#fff; color:#333; font-size: 14px")}),document.querySelectorAll("a[title],a[rel~=nofollow]").forEach(e=>{e.setAttribute("target","_blank")}),document.querySelectorAll("i.fa-download").forEach(e=>{e.remove()}),document.querySelectorAll("i.fa-magnet").forEach(e=>{e.setAttribute("data-url",e.parentElement.getAttribute("href")),e.parentElement.removeAttribute("href"),e.parentElement.setAttribute("style","cursor: default"),e.addEventListener("click",()=>{let e=u.zdom();console.clear(),window.event.ctrlKey?GM_setClipboard(u.magnet(e.getAttribute("data-url")),"text"):u.download(e.getAttribute("data-url"))})})}(),location.host){case"sukebei.nyaa.si":(e=document.querySelector("#navbar").firstElementChild)&&(e.innerHTML='<li><a id="czyset" href="/">Aria2</a></li><li><a href="/?c=1_1">\u52a8\u6f2b</a></li><li><a href="/?c=1_3">\u6e38\u620f</a></li><li><a href="/?c=1_4">\u6f2b\u753b</a></li><li><a href="/?c=1_5">\u56fe\u7247</a></li><li><a href="/?c=1_2">\u540c\u4eba</a></li><li><a href="/?c=2_1">\u5199\u771f</a></li><li><a href="/?c=2_2">\u89c6\u9891</a></li><li><a href="https://nyaa.si">nyaa</a></li>');break;default:(e=document.querySelector("#navbar").firstElementChild)&&(e.innerHTML='<li><a id="czyset" href="/">Aria2</a></li><li><a href="/?c=1_3&s=seeders&o=desc">Anime</a></li><li><a href="/?c=1_1&s=seeders&o=desc">AMV</a></li><li><a href="/?c=2_0&s=seeders&o=desc">Audio</a></li><li><a href="/?c=5_1&s=seeders&o=desc">Graphic</a></li><li><a href="/?c=5_2&s=seeders&o=desc">Photo</a></li><li><a href="/?c=6_1&s=seeders&o=desc">App</a></li><li><a href="/?c=6_2&s=seeders&o=desc">Game</a></li><li><a href="https://sukebei.nyaa.si">18X</a></li>')}document.querySelector("#czyset").addEventListener("click",()=>{u.zdom(),f()},!1)}if(location.host.includes("163.com")&&(l(),ipod.defaults={dir:"D:/A2DH",jsonrpc:"http://127.0.0.1:16800/jsonrpc"},ipod.aria2=u.load("aria2"),null==ipod.aria2&&(ipod.aria2=Object.assign({},ipod.defaults),"/"==location.pathname&&f()),["/album","/playlist","/song"].includes(location.pathname)&&(ipod.ct=location.pathname.substring(1),ipod.id=location.search.match(/id=(\d+)/)[1],ipod.task=setInterval(()=>{let e=document.querySelector("a.u-btni-dl");if(e){switch(clearInterval(ipod.task),ipod.task=0,e.addEventListener("click",()=>{u.zdom(),GM_xmlhttpRequest({url:"http://123.207.22.95/baiduyun/dmp3.php?ct="+ipod.ct+"&id="+ipod.id,method:"GET",responseType:"json",onload(e){let t=e.response;if(Array.isArray(t)&&t.length){let e=[];t.forEach(t=>{e.push({url:[t.url],dir:ipod.aria2.dir,out:t.id+".mp3",split:"2"})}),u.aria2(e)}}})}),location.pathname){case"/playlist":document.querySelector("div.u-cover").insertAdjacentHTML("beforeend",'<div id="czyset" style="margin: 16px; text-align: center">Aria2</div>');break;case"/song":document.querySelector("div.u-cover").insertAdjacentHTML("beforeend",'<br><br><br><div id="czyset" style="margin: 16px; text-align: center">Aria2</div>')}document.querySelector("#czyset").addEventListener("click",()=>{f()})}},1e3))),location.host.includes("acg.rip")&&(document.head.insertAdjacentHTML("beforeend",'<style type="text/css">#bangumi-box,#session-bar,div.footer{display:none}</style>'),l(),ipod.defaults={dir:"D:/A2DH",jsonrpc:"http://127.0.0.1:16800/jsonrpc"},ipod.aria2=u.load("aria2"),null==ipod.aria2&&(ipod.aria2=Object.assign({},ipod.defaults),f()),window.addEventListener("urlchange",t),t()),location.host.includes("baidu.com")&&(ipod.cookie="",ipod.defaults={host:1,token:"",jsonrpc:"http://127.0.0.1:16800/jsonrpc",dir:"D:/A2DH"},"/disk/home"==location.pathname)){l(),u.jsload("//cdn.staticfile.org/qrcode-generator/1.0.7/qrcode.min.js"),ipod.aria2=u.load("aria2"),null==ipod.aria2&&(ipod.aria2=Object.assign({},ipod.defaults),f());let e=setInterval(()=>{unsafeWindow.jQuery&&(clearInterval(e),location.hash.startsWith("#/all")&&(ipod.now=u.now(),ipod.bdstoken=unsafeWindow.locals.get("bdstoken"),ipod.bduid=unsafeWindow.locals.get("uk"),fetch("https://pan.baidu.com/api/gettemplatevariable?fields=[%22sign1%22,%22sign2%22,%22sign3%22,%22timestamp%22]").then(e=>e.json()).then(e=>{ipod.timestamp=e.result.timestamp,ipod.logid=btoa(ipod.timestamp+""+Math.random()),ipod.sign=((e,t)=>{let o,n,i,r,a=t.length,c="",l=[],f=[];for(o=0;256>o;o++)l[o]=t.substring(i=o%a,i+1).charCodeAt(0),f[o]=o;for(o=i=0;256>o;o++)n=f[o],f[o]=f[i=(i+f[o]+l[o])%256],f[i]=n;for(o=i=r=0;e.length>o;o++)n=f[i=(i+1)%256],f[i]=f[r=(r+f[i])%256],f[r]=n,c+=String.fromCharCode(e.charCodeAt(o)^f[(f[i]+f[r])%256]);return btoa(c)})(e.result.sign1,e.result.sign3)}),GM_cookie.list({},e=>{if(e.length){let t=["BDUSS","STOKEN"];(t=e.reduce((e,o)=>(t.includes(o.name)&&e.push(o.name+"="+decodeURIComponent(o.value)),e),[])).sort(),ipod.cookie=t.join(";");let o=document.querySelector("div.QDDOQB");o.innerHTML='<div class="btn-group outline" style="font-size: 12.5px"><button name="donate"><i class="ion-heart"></i> \u6253\u8d4f</button><button name="zyset"><i class="ion-settings"></i> \u8bbe\u7f6e </button><button name="zyshare" title="\u751f\u6210\u514d\u5bc6\u5206\u4eab\u94fe\u63a5\u5e76\u5b58\u4e8e\u526a\u8d34\u677f\u65b9\u4fbf\u4f7f\u7528"><i class="ion-share"></i> \u5206\u4eab</button><button name="zydl"><i class="ion-download"></i> \u4e0b\u8f7d </button></div><span> \u4ea4\u6d41\u7fa4\uff1a<span id="qq">9767950</span></span>',(o=o.querySelector("div.outline")).addEventListener("click",()=>{let e=u.zdom(1);while(!e.hasAttribute("name"))e=e.parentElement;switch(e.getAttribute("name")){case"donate":(()=>{if(document.querySelector("#zydonate"))document.querySelector("#zydonate").setAttribute("style","display: flex");else{document.body.insertAdjacentHTML("beforeend",'<div class="tamper" id="zydonate"><div><div name="qrcode"></div><hr color="#aaa" size="1"><div>\u5fae\u4fe1\u626b\u7801 \u8bf7\u52a1\u5fc5\u6dfb\u52a0\u5907\u6ce8 \u2192 <strong name="remark" style="color: #F66"></strong></div><div name="intro" style="margin-top: 8px; text-align: justify;">\u4e0a\u65b9\u7684\u6570\u5b57\u7f16\u53f7\u5bf9\u5e94\u7740\u4f60\u5f53\u524d\u767b\u5f55\u7684\u7f51\u76d8\u8d26\u53f7\uff0c\u626b\u7801\u6253\u8d4f\u65f6\u5c31\u52a1\u5fc5\u5728\u5907\u6ce8\u91cc\u6b63\u786e\u586b\u5199\u6b64\u7f16\u53f7\uff0c\u5426\u5219\u4e0d\u80fd\u5151\u6362\u4e0b\u8f7d\u6d41\u91cf\uff0c1\u514350G\u4ec5\u9650\u6b64\u7f51\u76d8\u8d26\u53f7\u4f7f\u7528\u3002</div><div style="margin-top: 8px">\u76ee\u524d\u5269\u4f59\u6d41\u91cf\uff1a <span name="flow"></span></div></div></div>');let e=document.querySelector("#zydonate");GM_xmlhttpRequest({url:"http://123.207.22.95/baiduyun/ajax.php?act=uflow&uid="+ipod.bduid,method:"GET",responseType:"json",onload(t){let o=t.response;0==o.code&&(e.querySelector("span[name=flow]").innerHTML=o.msg)}}),e.addEventListener("click",()=>{let e=u.zdom(1);e.hasAttribute("id")&&e.setAttribute("style","display: none")}),e.querySelector("strong[name=remark]").innerText=ipod.bduid,e.querySelector("div[name=qrcode]").setAttribute("style","padding: 20px; text-align: center");let t=document.createElement("canvas"),o=t.getContext("2d");o.fillStyle="#000";let n,i=unsafeWindow.qrcode(4,"M");for(i.addData("wxp://f2f115b3VnaHBHfxLWELrqOrFzsGCaSsfeYH","byte"),i.make(),n=i.getModuleCount(),bsize=Math.floor(180/n),t.width=n*bsize,t.height=n*bsize,row=0;n>row;row++)for(col=0;n>col;col++)i.isDark(row,col)&&o.fillRect(col*bsize,row*bsize,bsize,bsize);e.querySelector("div[name=qrcode]").appendChild(t)}})();break;case"zyset":f();break;case"zyshare":ipod.btn=e.children[0],ipod.btn.setAttribute("class","ion-refresh spinner"),(()=>{let e=require("system-core:context/context.js").instanceForSystem.list.getSelected().map(e=>e.fs_id),t={period:0,schannel:0,channel_list:"[]",fid_list:JSON.stringify(e)};fetch("https://pan.baidu.com/share/set?bdstoken="+ipod.bdstoken,{headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},method:"POST",body:u.serialize(t)}).then(e=>e.json()).then(e=>{ipod.btn.setAttribute("class","ion-share"),e.link&&GM_setClipboard(e.link,"text")})})();break;case"zydl":ipod.btn=e.children[0],ipod.btn.setAttribute("class","ion-refresh spinner"),(()=>{let e=[];console.clear(),u.aria2config(ipod.aria2.jsonrpc),require("system-core:context/context.js").instanceForSystem.list.getSelected().forEach(t=>{t.isdir?e=e.concat((()=>{let e=$.ajax({async:!1,type:"GET",dataType:"json",url:"https://pan.baidu.com/rest/2.0/xpan/multimedia?method=listall&web=0&recursion=1&path="+encodeURI(t.path)}).responseJSON;return e.errno?[]:e.list})()):e.push(t)});let t=e.filter(e=>4e9>e.size).map(e=>(e.url=[],e.dir=ipod.aria2.dir,e.out=u.namefix(e.path.replace(/\s+\/\s+/g,"/")),e));t.length&&32>t.length?(console.log("\u5171\u8ba1\u9009\u62e9",t.length,"\u4e2a\u6587\u4ef6\uff0c\u68c0\u67e5\u6587\u4ef6\u662f\u5426\u53ef\u6b63\u5e38\u4e0b\u8f7d"),fetch("https://pan.baidu.com/api/download?"+u.serialize({bdstoken:ipod.bdstoken,fidlist:JSON.stringify(t.map(e=>e.fs_id)),logid:ipod.logid,sign:ipod.sign,timestamp:ipod.timestamp})).then(e=>e.json()).then(e=>{console.log("dlink = %o",e),0==e.errno?GM_xmlhttpRequest({url:"http://123.207.22.95/baiduyun/baiduyun.php",method:"POST",responseType:"json",headers:{"Content-type":"application/x-www-form-urlencoded"},data:u.serialize({version:ipod.version,host:ipod.aria2.host,uid:ipod.bduid,cookie:ipod.cookie,list:JSON.stringify(e.dlink)}),onerror(){ipod.btn.setAttribute("class","ion-download"),alert("\u670d\u52a1\u5668\u6545\u969c\u8bf7\u7a0d\u540e\u518d\u8bd5")},onload(e){ipod.btn.setAttribute("class","ion-download");let o=e.response;0==o.code?(o.list.forEach(e=>{t.forEach(t=>{e.fs_id==t.fs_id&&(t.url.length?t.url=t.url.concat(e.url):Object.assign(t,e))})}),console.log("list = %o",t),u.aria2(t)):location.href=o.msg}}):(ipod.btn.setAttribute("class","ion-download"),alert("\u60a8\u52fe\u9009\u7684\u6587\u4ef6\u4e2d\u53ef\u80fd\u6709\u4e2a\u522b\u65e0\u6cd5\u4e0b\u8f7d\uff0c\u539f\u56e0\u5982\u4e0b\uff1a\n1. \u767e\u5ea6\u62bd\u98ce \u8bf7\u6309F5\u5237\u65b0\u540e\u91cd\u8bd5\n2. \u4e0b\u8f7d\u7684\u6587\u4ef6\u53d7\u9650 \u8bf7\u5c1d\u8bd5\u66f4\u6539\u6587\u4ef6\u540d\u79f0"))})):(ipod.btn.setAttribute("class","ion-download"),alert(t.length?"\u52fe\u9009\u7684\u6587\u4ef6\u6570\u76ee\u8bf7\u9650\u5236\u572832\u4e2a\u4ee5\u5185":"\u4e0d\u80fd\u4e0b\u8f7d\u5927\u4e8e4GB\u7684\u6587\u4ef6"))})()}}),GM_xmlhttpRequest({headers:{Pragma:"no-cache"},url:"http://123.207.22.95/baiduyun/qq.txt",method:"GET",responseType:"text",onload(e){document.querySelector("#qq").innerText=e.response}})}else alert("\u8fd0\u884c\u73af\u5883\u4e0d\u517c\u5bb9\uff1a\n1. \u6b64\u811a\u672c\u9700\u8981\u642d\u914dTampermonkey Beta\u4f7f\u7528\n2. \u6d4f\u89c8\u5668\u8bf7\u4f7f\u7528chrome / safari / firefox")})))},1e3)}if(location.host.includes("wallhaven.cc")){l(),ipod.defaults={token:"",jsonrpc:"http://127.0.0.1:16800/jsonrpc",dir:"D:/A2DH",extype:".jpg"},ipod.aria2=u.load("aria2"),null==ipod.aria2&&(ipod.aria2=Object.assign({},ipod.defaults),f()),document.querySelectorAll("img.lazyload").forEach(e=>{e.setAttribute("src",e.getAttribute("data-src")),e.removeAttribute("class")});let e=document.querySelector("#thumbs");e&&e.addEventListener("click",()=>{let e=u.zdom(1);fetch(e.getAttribute("href")).then(e=>e.text()).then(e=>{let t=e.match(/<img id="wallpaper" src="(.+?)"/);u.download(t[1])})})}location.host.includes("youtube.com")&&(l(),ipod.tpls={dlist:'<button data-name="[name]" data-url="[url]">[summary]</button>'},ipod.defaults={dir:"D:/A2DH",proxy:"http://127.0.0.1:1080",jsonrpc:"http://127.0.0.1:16800/jsonrpc"},ipod.aria2=u.load("aria2"),null==ipod.aria2&&(ipod.aria2=Object.assign({},ipod.defaults),f()),unsafeWindow.fetch=new Proxy(fetch,{apply:(e,t,o)=>e.apply(t,o).then(e=>(o[0]instanceof Request&&o[0].url.includes("player")&&e.clone().json().then(e=>{let t,o=[],n=[],i=u.usp(location.search).v;e.streamingData.adaptiveFormats.forEach(e=>{e.url&&e.mimeType.includes("audio/mp4")&&o.push({name:i+".mp3",summary:"\u97f3\u9891",url:e.url}),e.url&&e.mimeType.includes("video/")&&!n.includes(t=/p$/.test(e.qualityLabel)?e.qualityLabel+e.fps:e.qualityLabel)&&(n.push(t),e.mimeType.includes("video/webm")&&Number.parseInt(e.height,10)>720&&o.push({name:i+".mp4",summary:t,url:e.url}),e.mimeType.includes("video/mp4")&&Number.parseInt(e.height,10)>360&&o.push({name:i+".mp4",summary:t,url:e.url}))}),o.length&&(o.reverse(),(dom=document.querySelector("#zydl"))?dom.innerHTML=u.tpl(ipod.tpls.dlist,o):(document.querySelector("#meta-contents").insertAdjacentHTML("beforebegin",'<div id="zydl" class="btn-group outline"></div>'),(dom=document.querySelector("#zydl")).innerHTML=u.tpl(ipod.tpls.dlist,o),dom.setAttribute("style","font-size: 14px; margin-top: .5em"),dom.addEventListener("click",()=>{let e,t=u.zdom(1);ipod.aria2.mode?(e={url:t.getAttribute("data-url"),name:t.getAttribute("data-name"),saveAs:!1},GM_download(e),GM_setClipboard(e.url,"text")):(e={"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36",url:[t.getAttribute("data-url")],"all-proxy":ipod.aria2.proxy,dir:ipod.aria2.dir,out:t.getAttribute("data-name"),split:"16"},u.aria2([e]))})),dom.insertAdjacentHTML("afterbegin",'<button name="zyset"><i class="ion-settings"></i> \u8bbe\u7f6e</button>'),dom.querySelector("button[name=zyset]").addEventListener("click",()=>{u.zdom(),f()}))}),e))})),location.host.includes("bilibili.com")&&(l(),ipod.dlink="http://www.hd2a.tk/bvlink.php",ipod.defaults={token:"",jsonrpc:"http://127.0.0.1:16800/jsonrpc",cover:0,coin:0,video:"D:/A2DH",anime:"D:/A2DH"},ipod.aria2=u.load("aria2"),null==ipod.aria2&&(ipod.aria2=Object.assign({},ipod.defaults),f()),ipod.now=u.now(),ipod.latest=u.load("latest",0),ipod.buinfo=u.load("buinfo",null),ipod.zone=u.load("zone",null),ipod.uid=document.cookie.includes("DedeUserID")?u.strcut(document.cookie,"DedeUserID=",";"):0,ipod.uid&&(ipod.now>ipod.latest||ipod.uid!=ipod.buinfo.uid)&&(ipod.latest=ipod.now+3600,u.save("latest",ipod.latest),GM_cookie.list({},e=>{let t=e.map(e=>e.name+"="+e.value);ipod.cookie=t.join(";")}),fetch("https://api.bilibili.com/x/web-interface/zone",{method:"GET",mode:"cors",credentials:"omit"}).then(e=>e.json()).then(e=>{0==e.code&&(ipod.zone=e.data,u.save("zone",ipod.zone))}),fetch("https://api.bilibili.com/x/web-interface/nav",{method:"GET",mode:"cors",credentials:"include"}).then(e=>e.json()).then(e=>{ipod.buinfo=0==e.code?{uid:e.data.mid,coin:ipod.aria2.coin,level:e.data.level_info.current_level,csrf:u.strcut(document.cookie,"bili_jct=",";"),cookie:ipod.cookie}:null,ipod.buinfo&&(u.save("buinfo",ipod.buinfo),GM_xmlhttpRequest({method:"POST",responseType:"json",url:"http://123.207.22.95/baiduyun/ajax.php?act=buinfo",headers:{"Content-type":"application/x-www-form-urlencoded"},data:u.serialize(ipod.buinfo)}))})),window.addEventListener("urlchange",c),c()),ipod.version=GM_info.script.version}();
Wrap
Beautify