From 3b88155a9ae60447f150505736b478d644c8ea76 Mon Sep 17 00:00:00 2001 From: techmovie Date: Sun, 21 Mar 2021 00:59:40 +0800 Subject: [PATCH] feat(new version): 1.0.7 --- dist/easy-seed.user.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/easy-seed.user.js b/dist/easy-seed.user.js index bb7abcac..669909cb 100644 --- a/dist/easy-seed.user.js +++ b/dist/easy-seed.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name easy-seed PT一键转种 // @namespace https://github.com/techmovie/easy-seed -// @version 1.0.6 +// @version 1.0.7 // @description easy seeding for different trackers // @author birdplane // @require https://cdn.bootcss.com/jquery/1.7.1/jquery.min.js @@ -37,14 +37,14 @@ `);break}}let{textAlign:n,fontWeight:i,fontStyle:d,textDecoration:h,color:g}=e.style;if(n)switch(n.toUpperCase()){case"LEFT":{r("[left]","[/left]");break}case"RIGHT":{r("[right]","[/right]");break}case"CENTER":{r("[center]","[/center]");break}}(i==="bold"||~~i>=600)&&r("[b]","[/b]"),d==="italic"&&r("[i]","[/i]"),h==="underline"&&r("[u]","[/u]"),g&&g.trim()!==""&&r(`[color=${Te(g)}]`,"[/color]");break}case 3:return e.textContent.match(/引用|Quote|代码|代碼|Show|Hide|Hidden text|\[show\]|Spoiler/)?"":e.textContent;default:return null}return e.childNodes.forEach((n,i)=>{let d=ve(n);d&&o.push(d)}),a.concat(o).concat(s).join("")},R=e=>{let o={};return e.match(/diy/i)&&(o.DIY=!0),e.match(/国配|国语/i)&&(o.chineseAudio=!0),e.match(/Atoms|杜比全景声/i)&&(o.atoms=!0),e.match(/HDR/i)&&(e.match(/HDR10\+/i)?o["HDR10+"]=!0:o.HDR=!0),e.match(/DoVi|(Dolby\s*Vision)|杜比视界/i)&&(o.DolbyVision=!0),e.match(/粤/i)&&(o.cantoneseAudio=!0),e.match(/简|繁|中字/i)&&(o.chineseSubtitle=!0),e.match(/Criterion|CC标准/i)&&(o.CC=!0),o},U=e=>{if(!e)return"";let o=e.match(/\[quote\](.|\n)+?\[\/quote\]/g),a="";return o&&o.length>0&&o.forEach(s=>{s.match(/Disc\s*Size/i)&&(a+=s.replace(/\[(\/)?quote\]/g,"")+` `)}),a||(a=e.match(/Disc\s+(Title|Label)[^[]+/i)?.[0]??""),a};var xe=e=>{console.log(e),l==="PTSBAO"&&localStorage.getItem("autosave")&&localStorage.removeItem("autosave");let o=W(e.imdbUrl),a=e.videoType.match(/bluray/i),{screenshots:s=[]}=e;if($(u.imdb.selector).val(e.imdbUrl),l==="HDBits"){let c=e.title.replace(/([^\d]+)\s+([12][90]\d{2})/,(p,m,f)=>`${e.movieName||e.movieAkaName} ${f}`);e.videoType==="remux"&&(c=c.replace(/\s+(bluray|blu-ray)/ig,"")),e.title=c}if(u.name){let{title:c,subtitle:p}=e,m=c;l==="TTG"?m+=`[${p}]`:l==="SSD"&&(m=c.replace(/\s/ig,".")),$(u.name.selector).val(m)}Oe(),["subtitle","douban","area","audioCodec"].forEach(c=>{let p=u[c];if(p&&p.selector){let m=e[c];c==="douban"?m=e.doubanUrl:(c==="area"||c==="audioCodec")&&(m=p.map[e[c]]),$(p.selector).val(m)}});let n=e.mediaInfo,i="";if(e.description)if(i=e.description,te(u.siteType)&&l!=="SSD"){let{doubanInfo:c}=e;c&&(i=c+i)}else{let{sourceSiteType:c}=e;te(c)&&(i=Ke(e))}if(u.mediaInfo&&(a&&l.match(/HDBits|Blutopia/)||($(u.mediaInfo.selector).val(n),i=i.replace(n.trim(),"").replace(/\[quote\]\[\/quote\]/g,""))),u.screenshots&&s.forEach(c=>{i.includes(c)&&(i=i.replace(c,""),c.match(/\[url=.+?\[url]/)||(i=i.replace(/\[img\]\[\/img\]\n*/g,"")))}),l==="SSD"&&($(u.imdb.selector).val(e.doubanUrl||e.imdbUrl),$(u.screenshots.selector).val(s.join(` `)),(e.category==="tvPack"||e.title.match(/Trilogy|Collection/i)||e.subTitle&&e.subTitle.match(/合集/))&&$('input[name="pack"]').attr("checked",!0)),l==="HDAI"&&($(u.imdb.selector).val(e.doubanUrl||e.imdbUrl),$(u.screenshots.selector).val(s.join(` -`)),a&&$('input[type="checkbox"][name="tag[o]"]').attr("checked",!0)),u.poster){let c=(e.description+e.doubanInfo).match(/\[img\](http.+?poster.+?)\[\/img\]/);c&&c[1]&&$(u.poster).val(c[1])}if($(u.description.selector).val(Le(e)+i.trim()),l.match(/BeyondHD|Blutopia/)){let c=l==="Blutopia"?o.replace("tt",""):o;if($(u.imdb.selector).val(c),be(o).then(p=>{$(u.tmdb.selector).val(p)}),l==="BeyondHD"){let{category:p,videoType:m}=e;if(e.category=m,e.videoType=p,a){let f=fe(e.size);m==="uhdbluray"&&f==="BD50"&&(f="uhd50"),e.category=f}}}let d=u.category.map[e.category],h=["videoCodec","videoType","resolution","source","area"],g=[];if(Array.isArray(d)?(g=[...d],h.forEach(c=>{g=De(u,e,c,g),g.length===1&&$(u.category.selector).val(g[0])})):[...h,"category"].forEach(c=>{De(u,e,c,g)}),l.match(/HDHome|PTHome/i)&&$(u.category.selector).change(),u.anonymous){let{selector:c,value:p=""}=u.anonymous;p?$(c).val(p):$(c).attr("checked",!0)}if(u.tags&&Object.keys(e.tags).forEach(c=>{e.tags[c]&&u.tags[c]&&$(u.tags[c]).attr("checked",!0)}),Me(e),l.match(/PTHome|HDSky|LemonHD/i)&&e.tags.DIY){let c="";if(l==="PTHome")c=e.videoType==="bluray"?"14":"13";else if(l==="HDSky")c=e.videoType==="bluray"?"12":"14";else if(l==="LemonHD"){$('select[name="tag_diy"]').val("yes");return}$(u.videoType.selector).val(c)}if(l.match(/HDU/)){let c="",{resolution:p,videoType:m,category:f}=e,y=f.match(/tv/);m==="remux"&&(p==="2160p"?c=y?"16":"15":c=y?"12":"3"),y&&(m==="encode"?c="14":m==="web"&&(c="13")),c&&$(u.videoType.selector).val(c),m.match(/bluray/)&&$(u.category.selector).val("424")}},De=(e,o,a,s)=>{let r=e[a]?e[a].map[o[a]]:void 0;return Array.isArray(r)&&s?(e[a].selector&&$(e[a].selector).val(r.shift()),s.length>1&&(s=s.filter(n=>r.includes(n)))):e[a]&&e[a].selector&&$(e[a].selector).val(r),s},Me=e=>{let o=e.title.match(/-([^-]+)$/),a=u.team,s=o?.[1]?.replaceAll("-","")?.split("@")??"";if(s){if(s=s.length>1?s[1]:s[0],le.includes(s)&&l==="BTSCHOOL"){$(a.selector).val(a.map.hdbint);return}}else s="other";if(s&&a){let r=a.map[s.toLowerCase()],n=r||a.map.other;if(l==="HDAI"&&!r){$('input[name="team"]').val(s);return}$(a.selector).val(n.toLowerCase())}},Oe=()=>{let e=u.name.selector;if(e.match(/^#\w+/)){let o=$(e).clone().attr("name","").hide();$(e).attr("id","").after(o)}},Ke=e=>{let{description:o,screenshots:a=[]}=e,s="",r=o.match(/\[quote\](.|\n)+?\[\/quote\]/g);r&&r.length>0&&r.forEach(i=>{i.match(/[\u4e00-\u9fa5]+/i)||(s+=i+` +`)),a&&$('input[type="checkbox"][name="tag[o]"]').attr("checked",!0)),u.poster){let c=(e.description+e.doubanInfo).match(/\[img\](http.+?poster.+?)\[\/img\]/);c&&c[1]&&$(u.poster).val(c[1])}if($(u.description.selector).val(Le(e)+i.trim()),l.match(/BeyondHD|Blutopia/)){let c=l==="Blutopia"?o.replace("tt",""):o;if($(u.imdb.selector).val(c),be(o).then(p=>{$(u.tmdb.selector).val(p)}),l==="BeyondHD"){let{category:p,videoType:m}=e;if(e.category=m,e.videoType=p,a){let f=fe(e.size);m==="uhdbluray"&&f==="BD50"&&(f="uhd50"),e.category=f}}}let d=u.category.map[e.category],h=["videoCodec","videoType","resolution","source","area"],g=[];if(Array.isArray(d)?(g=[...d],h.forEach(c=>{g=De(u,e,c,g),g.length===1&&$(u.category.selector).val(g[0])})):[...h,"category"].forEach(c=>{De(u,e,c,g)}),l.match(/HDHome|PTHome/i)&&$(u.category.selector).change(),u.anonymous){let{selector:c,value:p=""}=u.anonymous;p?$(c).val(p):$(c).attr("checked",!0)}if(u.tags&&Object.keys(e.tags).forEach(c=>{e.tags[c]&&u.tags[c]&&$(u.tags[c]).attr("checked",!0)}),Me(e),l.match(/PTHome|HDSky|LemonHD/i)&&e.tags.DIY){let c="";if(l==="PTHome")c=e.videoType==="bluray"?"14":"13";else if(l==="HDSky")c=e.videoType==="bluray"?"12":"14";else if(l==="LemonHD"){$('select[name="tag_diy"]').val("yes");return}$(u.videoType.selector).val(c)}if(l.match(/HDU/)){let c="",{resolution:p,videoType:m,category:f}=e,y=f.match(/tv/);m==="remux"&&(p==="2160p"?c=y?"16":"15":c=y?"12":"3"),y&&(m==="encode"?c="14":m==="web"&&(c="13")),c&&$(u.videoType.selector).val(c),m.match(/bluray/)&&$(u.category.selector).val("424")}},De=(e,o,a,s)=>{let r=e[a]?e[a].map[o[a]]:void 0;return Array.isArray(r)&&s?(e[a].selector&&$(e[a].selector).val(r.shift()),s.length>1&&(s=s.filter(n=>r.includes(n)))):e[a]&&e[a].selector&&$(e[a].selector).val(r),s},Me=e=>{let o=e.title.match(/-([^-]+)$/),a=u.team,s=o?.[1]?.replaceAll("-","")?.split("@")??"";if(s){if(s=s.length>1?s[1]:s[0],le.includes(s)&&l==="BTSCHOOL"){$(a.selector).val(a.map.hdbint);return}}else s="other";if(s&&a){let r=a.map[s.toLowerCase()],n=r||a.map.other;if(l==="HDAI"&&!r){$('input[name="team"]').val(s);return}$(a.selector).val(n.toLowerCase())}},Oe=()=>{let e=u.name?.selector??"";if(e.match(/^#\w+/)){let o=$(e).clone().attr("name","").hide();$(e).attr("id","").after(o)}},Ke=e=>{let{description:o,screenshots:a=[]}=e,s="",r=o.match(/\[quote\](.|\n)+?\[\/quote\]/g);r&&r.length>0&&r.forEach(i=>{i.match(/[\u4e00-\u9fa5]+/i)||(s+=i+` `)});let n=a.map(i=>i.match(/\[url=.+\]/i)?i:`[img]${i}[/img]`);return s+` `+n},Le=e=>{let o=te(u.siteType),a=`\u8F6C\u53D1\u81EA[b]${e.sourceSite}[/b]\uFF0C\u611F\u8C22\u539F\u53D1\u5E03\u8005\uFF01`;return o||(a=`Torrent from [b]${e.sourceSite}[/b]. All thanks to the original uploader\uFF01`),`[quote]${a}[/quote] `},te=e=>e.match(/NexusPHP|TTG/);var _e=()=>{let e=z("torrentid");if(!e)return!1;t.sourceSite=l,t.sourceSiteType=u.siteType;let o=$(`#torrent_${e}`),a=$(".page__title").text().match(/]?([^[]+)/)[1]?.trim(),[s,r=""]=a.split(" AKA ");t.mediaInfo=`${o.find(".mediainfo.mediainfo--in-release-description").next("blockquote:contains(Unique ID)").text()}`,t.movieName=s,t.movieAkaName=r,t.imdbUrl=$("#imdb-title-link")?.attr("href")??"",t.year=$(".page__title").text().match(/\[(\d+)\]/)[2];let n=$(`#group_torrent_header_${e}`);t.category=Ve();let i=S(o.find(".bbcode-table-guard")[0]);t.category==="concert"&&(i=$("#synopsis").text()+i);let{comparisonData:d,screenshots:h}=ze(o);if(d){let V=[];Object.keys(d).forEach(J=>{V=V.concat(d[J]),i=i.replace(J+":",""),i+=` [b]`+J+`:[/b] -`+d[J].map(re=>`[img]${re}[/img]`).join("")}),t.comparisonImgs=V}t.description=i;let g=n.find("#PermaLinkedTorrentToggler").text().replace(/ /g,"").split("/"),[c,p,m,...f]=g,y=f.includes("Remux");t.videoType=m==="WEB"?"web":Ge(p,y,c,m);let D=U(i),T=t.videoType.match(/bluray/i),C=T?B:w,x=T?D:t.mediaInfo;t.mediaInfo=x;let{videoCodec:v,audioCodec:b,fileName:_="",resolution:I,mediaTags:N}=C(x);t.videoCodec=v,t.audioCodec=b,t.resolution=I,t.tags=N;let E=_||n.data("releasename");E=H(E),t.title=E,t.source=qe(m,c,I),t.size=n.find(".nobr span").attr("title").replace(/[^\d]/g,""),t.screenshots=h;let K=[],L=$("#movieinfo div").text().match(/Country:\s+([^\n]+)/);return L&&L.length>0&&(K=L?.[1].replace(/(,)\s+/g,"$1").split(",")),t.area=k(K?.[0]),t},Ve=()=>{let e={"Feature Film":"movie","Short Film":"movie","Stand-up Comedy":"other",Miniseries:"tvPack","Live Performance":"concert","Movie Collection":"movie"},o=$("#torrent-table .basic-movie-list__torrent-edition__main").eq(0).text();return e[o]},ze=()=>{let e=[],o={},a=$(".movie-page__torrent__panel"),s=a.find("a:contains(Show comparison)");for(let n=0;no.match(/BD100|BD66/i)||e.match(/Blu-ray/i)&&a.match(/2160P|4K/i)?"uhdbluray":e.replace(/-/g,"").toLowerCase(),Ge=(e,o,a,s)=>{let r="";return o?r="remux":a.match(/BD50|BD25/ig)?r="bluray":a.match(/BD66|BD100/ig)?r="uhdbluray":s.match(/DVD/ig)&&e.match(/MKV|AVI/ig)?r="dvdrip":a.match(/DVD5|DVD9/ig)&&e.match(/VOB|ISO/ig)?r="dvd":e.match(/MKV|MP4/i)&&(r="encode"),r};var Ce=()=>{t.sourceSite=l,t.sourceSiteType=u.siteType;let{Category:e,Name:o,Source:a,Type:s,Size:r}=je();t.size=F(r),t.title=H(o);let n=R(t.title),i=$(".movie-heading a:last").text(),d=$(".movie-heading a:first").text();if(i)t.year=i;else{let _=t.title.match(/\s([12][90]\d{2})/);t.year=_?_[0]:""}let h=$(".panel-heading:contains(Description)").next(".panel-body").find(".forced-nfo"),g=S(h[0]);t.description=g;let{category:c,countries:p,imdbUrl:m}=Je();t.movieName=d;let f=e.toLowerCase().replace(/s/,"");f=c==="Animation"?"cartoon":f,t.category=A(t,f),t.source=Ye(a,s),t.area=k(p),t.videoType=Qe(s);let y=t.videoType.match(/bluray/i),D=$("#stats-full code").text();t.mediaInfo=D;let T=y?B:w,{videoCodec:C,audioCodec:x,resolution:v,mediaTags:b}=T(D);return t.videoCodec=C,t.audioCodec=x,t.resolution=v,t.tags={...n,...b},t.imdbUrl=m,t.screenshots=We(),t},je=()=>{let e={};return $(".dotborder").each((o,a)=>{let s=$(a).find("td:first").text(),r=$(a).find("td:last").text();e[s]=r.replace(/\n/g,"").trim()}),console.log(e),e},Je=()=>{let e=$(".movie-details a"),o={};return e.each((a,s)=>{let r=$(s).attr("href").replace(/.+\?/g,"").split("=");if(r.length>1){let n=decodeURI(r[0]),i=r[1];n==="g[]"&&(n="category"),o[n]=i}else r?.[0].match(/tt\d+/)&&(o.imdbUrl=r[0])}),o},We=()=>t.description.match(/\[url=.+?\]\[img\].+?\[\/img\]\[\/url]/g)??[],Ye=(e,o)=>o.match(/BD100|BD66/i)||e.match(/Blu-ray/i)&&o.match(/UHD/i)?"uhdbluray":e.match(/WEB|WEB-DL/i)?"web":e.replace(/-/g,"").toLowerCase(),Qe=e=>(e=e.replace(/\s/g,""),e.match(/Remux/i)?"remux":e.match(/BD50|BD25/i)?"bluray":e.match(/UHD50|UHD66|UHD100/i)?"uhdbluray":e.match(/DVD5|DVD9/i)?"dvd":e.match(/\d{3,4}p/i)?"encode":e);var Pe=()=>{let e=z("id");t.sourceSite=l,t.sourceSiteType=u.siteType;let o=$("#details tr").has("a:contains(Edit torrent)"),a=o.length>0?o.prev():$("#details tr").has(".js-tagcontent").prev(),s=S(a.find(">td")[0]);s=s.match(/\[quote\]((.|\n)+)\[\/quote\]/)?.[1]??"",t.description=s;let{size:r,category:n,videoType:i}=Ze(),d=$("h1").eq(0).text();t.title=H(d);let h=R(d),g=$(".contentlayout h1").length>0,c=g?$(".contentlayout h1"):$("#details .showlinks li").eq(1);if(g){let y=c.prop("lastChild").nodeValue.replace(/\s|\(|\)/g,""),D=c.find("a").text();if(t.movieName=D,y)t.year=y;else{let T=t.title.match(/\s([12][90]\d{2})/);t.year=T?T[0]:""}}t.imdbUrl=c.find("a").attr("href"),t.category=A(t,n),t.source=O(t.title),t.videoType=i;let p=t.videoType.match(/bluray/i),m=p?B:w,f=U(s);if(!p)t.bdinfo=f,Xe(e).then(y=>{if(y){t.mediaInfo=y;let{videoCodec:D,audioCodec:T,resolution:C,mediaTags:x}=m(t.mediaInfo);t.videoCodec=D,t.audioCodec=T,t.resolution=C,t.tags={...h,...x}}});else{t.mediaInfo=f;let{videoCodec:y,audioCodec:D,resolution:T,mediaTags:C}=m(f||s);t.videoCodec=y,t.audioCodec=D,t.resolution=T,t.tags={...h,...C}}t.size=r,t.screenshots=et(a)},Ze=()=>{let e={"Blu-ray/HD DVD":"bluray",Capture:"hdtv",Encode:"encode",Remux:"remux","WEB-DL":"web"},o=$("th:contains(Category)").next().text(),a=$("th:contains(Size)").eq(0).next().text(),s=o.split("("),r=s[0].trim().toLowerCase(),n=s[1].split(",")[0].toLowerCase().replace(/\./g,""),i=s[1].split(",")[1].replace(/\)/g,"").trim();return{size:F(a),category:r,videoCodec:n,videoType:e[i]}},Xe=e=>new Promise((o,a)=>{GM_xmlhttpRequest({method:"GET",url:`https://hdbits.org/details/mediainfo?id=${e}`,onload(s){let r=s.responseText;(s.status!==200||!r)&&a(new Error("\u8BF7\u6C42\u5931\u8D25")),o(r)}})}),et=e=>t.description.match(/\[url=.+?\]\[img\].+?\[\/img\]\[\/url]/g)??[];var Se=()=>{t.sourceSite=l,t.sourceSiteType=u.siteType;let e=$("#main_table h1").eq(0).text(),o=e.match(/[^[]+/)?.[0];t.title=H(o),t.subtitle=e.replace(o,"").replace(/\[|\]/g,"");let a=R(t.subtitle+t.title),s=oe("\u7C7B\u578B").text(),{category:r,area:n,videoType:i}=tt(s);t.area=n,t.videoType=rt(o,i);let d=t.title.match(/(18|19|20)\d{2}/g);t.year=d?d.pop():"",t.imdbUrl=oe("IMDB").find("a").attr("href"),t.source=O(t.title);let h=oe("\u5C3A\u5BF8").text().match(/\(((\d|,)+)\s*字节\)/i)?.[1];t.size=h.replaceAll(",","");let g=t.videoType.match(/bluray/i),c=g?B:w;window.onload=()=>{let p=$("#kt_d"),m=S(p[0]),f=m.match(/\[color=\w+\]本种子.+?\[\/color\]/)?.[0]??"";m.match&&(m=m.replace(f,"")),t.description=m;let y=m.match(/https:\/\/(movie\.)?douban.com\/subject\/\d+/)?.[0];y&&(t.doubanUrl=y);let D=m.match(/(产\s+地|国\s+家)\s+(.+)/)?.[2];D&&(t.area=k(D)),r?t.category=A(t,r):t.category=st(m);let{bdinfo:T,mediaInfo:C}=ot(m),x=g?T:C;if(x){t.mediaInfo=x;let{videoCodec:v,audioCodec:b,resolution:_,mediaTags:I}=c(x);t.videoCodec=v,t.audioCodec=b,t.resolution=_,t.tags={...a,...I}}else{let v=t.title.match(/\d{3,4}(p|i)/i)?.[0];if(!v&&v.match(/4k|uhd/i)&&(v="2160p"),t.resolution=v,t.audioCodec=q(t.title),m.match(/VIDEO(\.| )*CODEC/i)){let b=m.match(/VIDEO(\.| )*CODEC\.*:?\s*([^\s_:]+)?/i)?.[2];if(b)t.videoCodec=b.replace(/\.|-/g,"").toLowerCase();else{let{title:_}=t;t.videoCodec=Q(_)}}if(m.match(/AUDIO\s*CODEC/i)){let b=m.match(/AUDIO\s*CODEC\.*:?\s*(.+)/i)?.[1];b&&(t.audioCodec=q(b))}}t.screenshots=at(m),console.log(t)}},tt=e=>{let o="",a="",s="";return e.match(/电影/)?o="movie":e.match(/剧包/)?o="tvPack":e.match(/剧/)?o="tv":e.match(/纪录/)?o="documentary":e.match(/综艺/)?o="variety":e.match(/体育/)?o="sport":e.match(/演唱会/)?o="concert":e.match(/动漫/)&&(o="cartoon"),e.match(/韩/)?a="KR":e.match(/日/)?a="JP":e.match(/华/)?a="CN":e.match(/欧/)&&(a="US"),e.match(/UHD原盘/i)?s="uhdbluray":e.match(/bluray原盘/i)?s="bluray":e.match(/DVD/i)&&(s="dvd"),{category:o,area:a,videoType:s}},ot=e=>{let o=e.match(/\[quote\](.|\n)+?\[\/quote\]/g),a="",s="";for(let r=0;re.replace(/\[(.+)\]?/g,"").replaceAll("\u200D",""),at=e=>{if(e.match(/More\.Screens/i)){let o=e.match(/\.More\.Screens\[\/u\]\[\/color\]\n((.|\n)+\[\/(url|img)\])/)?.[1];return Y(o)}else return Y(e)},rt=(e,o)=>e.match(/HDTV/i)?"hdtv":e.match(/web(-)*(dl|rip)/i)?"web":e.match(/remux/i)?"remux":e.match(/dvdrip/i)?"dvdrip":e.match(/x264|x265/i)?"encode":o,oe=e=>$(`#main_table td.heading:contains(${e})`).next(),st=e=>{let o="movie",{title:a,subtitle:s}=t;return a.match(/s0?\d{1,2}/i)||e.match(/集\s*数/)?a.match(/s0?\d{1,2}e0\d{1,2}/i)||s.match(/第[^\s]集/)?o="tv":o="tvPack":e.match(/动画/)?o="cartoon":e.match(/纪录/)&&(o="documentary"),o};var Ie=()=>{t.sourceSite=l,t.sourceSiteType=u.siteType;let{Category:e,Name:o,Type:a,Size:s,Resolution:r}=it();t.size=F(s),t.title=H(o);let n=R(t.title),i=$(".movie-heading span:last").text(),d=$(".movie-heading span:first").text();if(i)t.year=i.replace(/\(|\)|\s/g,"");else{let b=t.title.match(/(19|20)\d{2}/g);t.year=b?.pop()??""}t.resolution=r;let h=$(".panel-heading:contains(Description)+div .panel-body"),g=S(h[0]);t.description=g;let c=$(".movie-details a:contains(IMDB)").attr("href");t.imdbUrl=c,t.movieName=d;let p=nt(e);t.category=A(t,p),t.source=O(t.title),t.videoType=dt(a,r);let m=t.videoType.match(/bluray/i),f=$(".decoda-code code").text(),y=U(g),D=m?B:w,T=m?y:f,{videoCodec:C,audioCodec:x,mediaTags:v}=D(T);return t.mediaInfo=T,t.videoCodec=C,t.audioCodec=x,t.tags={...n,...v},t.screenshots=t.description.match(/\[url=.+?\]\[img\].+?\[\/img\]\[\/url]/g)??[],t},it=()=>{let e={};return $("#vue+.panel table tr").each((o,a)=>{let s=$(a).find("td:first").text().replace(/\s|\n/g,""),r=$(a).find("td:last").text();e[s]=r.replace(/\n/g,"").trim()}),e},nt=e=>({Movie:"movie","TV Show":"tv"})[e],dt=(e,o)=>(e=e.replace(/\s/g,""),e.match(/FullDisc/)?o.match(/2160p/i)?"uhdbluray":o.match(/1080/)?"bluray":"dvd":e.match(/Encode/i)?"encode":e.match(/web/i)?"web":e.match(/HDTV/i)?"hdtv":e);var we=()=>{let e=$("#top").text().split(/\s{3,}/)?.[0]?.trim(),o=$("td.rowhead:contains('\u57FA\u672C\u4FE1\u606F'), td.rowhead:contains('\u57FA\u672C\u8CC7\u8A0A')").next().text().replace(/:/g,":"),a=$("td.rowhead:contains('\u526F\u6807\u9898'), td.rowhead:contains('\u526F\u6A19\u984C')").next().text(),s=$("#kimdb>a").attr("href"),r=S($("#kdescr")[0]);if(l==="HDArea"&&(e=$("h1#top").text().split(/\s{3,}/)?.[0]?.trim()),l==="TJUPT"&&(e=(e.match(/\[((\w|\.|\d|-)+)\]/g).filter(I=>I.match(/\.| /))?.[0]??"").replace(/\[|\]/g,"")),l==="PTer"&&(r=$("#descrcopyandpaster").val()),l==="LemonHD"&&(r=r.replace(/\[b\]\[color=\w+\][^[]+?网上搜集[^[]+?\[\/color\]\[\/b\]/,"")),l==="HDChina"){let b=[];$("li:contains('\u57FA\u672C\u4FE1\u606F'):last").next("li").children("i").each(function(){b.push($(this).text().replace("\uFF1A",":"))}),o=b.join("\xA0\xA0\xA0"),a=$("#top").next("h3").text()}if(l==="OurBits"&&(s=$(".imdbnew2 a:first").attr("href"),t.doubanUrl=$("#doubaninfo .doubannew a").attr("href"),t.doubanUrl)){let b=S($(".doubannew2 .doubaninfo")?.[0]),_=`[img]${$("#doubaninfo .doubannew a img").attr("src")}[/img] +`+d[J].map(re=>`[img]${re}[/img]`).join("")}),t.comparisonImgs=V}t.description=i;let g=n.find("#PermaLinkedTorrentToggler").text().replace(/ /g,"").split("/"),[c,p,m,...f]=g,y=f.includes("Remux");t.videoType=m==="WEB"?"web":Ge(p,y,c,m);let D=U(i),T=t.videoType.match(/bluray/i),C=T?B:w,x=T?D:t.mediaInfo;t.mediaInfo=x;let{videoCodec:v,audioCodec:b,fileName:_="",resolution:I,mediaTags:N}=C(x);t.videoCodec=v,t.audioCodec=b,t.resolution=I,t.tags=N;let E=_||n.data("releasename");E=H(E),t.title=E,t.source=qe(m,c,I),t.size=n.find(".nobr span").attr("title").replace(/[^\d]/g,""),t.screenshots=h;let K=[],L=$("#movieinfo div").text().match(/Country:\s+([^\n]+)/);return L&&L.length>0&&(K=L?.[1].replace(/(,)\s+/g,"$1").split(",")),t.area=k(K?.[0]),t},Ve=()=>{let e={"Feature Film":"movie","Short Film":"movie","Stand-up Comedy":"other",Miniseries:"tvPack","Live Performance":"concert","Movie Collection":"movie"},o=$("#torrent-table .basic-movie-list__torrent-edition__main").eq(0).text();return e[o]},ze=()=>{let e=[],o={},a=$(".movie-page__torrent__panel"),s=a.find("a:contains(Show comparison)");for(let n=0;no.match(/BD100|BD66/i)||e.match(/Blu-ray/i)&&a.match(/2160P|4K/i)?"uhdbluray":e.replace(/-/g,"").toLowerCase(),Ge=(e,o,a,s)=>{let r="";return o?r="remux":a.match(/BD50|BD25/ig)?r="bluray":a.match(/BD66|BD100/ig)?r="uhdbluray":s.match(/DVD/ig)&&e.match(/MKV|AVI/ig)?r="dvdrip":a.match(/DVD5|DVD9/ig)&&e.match(/VOB|ISO/ig)?r="dvd":e.match(/MKV|MP4/i)&&(r="encode"),r};var Ce=()=>{t.sourceSite=l,t.sourceSiteType=u.siteType;let{Category:e,Name:o,Source:a,Type:s,Size:r}=je();t.size=F(r),t.title=H(o);let n=R(t.title),i=$(".movie-heading a:last").text(),d=$(".movie-heading a:first").text();if(i)t.year=i;else{let _=t.title.match(/\s([12][90]\d{2})/);t.year=_?_[0]:""}let h=$(".panel-heading:contains(Description)").next(".panel-body").find(".forced-nfo"),g=S(h[0]);t.description=g;let{category:c,countries:p,imdbUrl:m}=Je();t.movieName=d;let f=e.toLowerCase().replace(/s/,"");f=c==="Animation"?"cartoon":f,t.category=A(t,f),t.source=Ye(a,s),t.area=k(p),t.videoType=Qe(s);let y=t.videoType.match(/bluray/i),D=$("#stats-full code").text();t.mediaInfo=D;let T=y?B:w,{videoCodec:C,audioCodec:x,resolution:v,mediaTags:b}=T(D);return t.videoCodec=C,t.audioCodec=x,t.resolution=v,t.tags={...n,...b},t.imdbUrl=m,t.screenshots=We(),t},je=()=>{let e={};return $(".dotborder").each((o,a)=>{let s=$(a).find("td:first").text(),r=$(a).find("td:last").text();e[s]=r.replace(/\n/g,"").trim()}),console.log(e),e},Je=()=>{let e=$(".movie-details a"),o={};return e.each((a,s)=>{let r=$(s).attr("href").replace(/.+\?/g,"").split("=");if(r.length>1){let n=decodeURI(r[0]),i=r[1];n==="g[]"&&(n="category"),o[n]=i}else r?.[0].match(/tt\d+/)&&(o.imdbUrl=r[0])}),o},We=()=>t.description.match(/\[url=.+?\]\[img\].+?\[\/img\]\[\/url]/g)??[],Ye=(e,o)=>o.match(/BD100|BD66/i)||e.match(/Blu-ray/i)&&o.match(/UHD/i)?"uhdbluray":e.match(/WEB|WEB-DL/i)?"web":e.replace(/-/g,"").toLowerCase(),Qe=e=>(e=e.replace(/\s/g,""),e.match(/Remux/i)?"remux":e.match(/BD50|BD25/i)?"bluray":e.match(/UHD50|UHD66|UHD100/i)?"uhdbluray":e.match(/DVD5|DVD9/i)?"dvd":e.match(/\d{3,4}p/i)?"encode":e);var Pe=()=>{let e=z("id");t.sourceSite=l,t.sourceSiteType=u.siteType;let o=$("#details tr").has("a:contains(Edit torrent)"),a=o.length>0?o.prev():$("#details tr").has(".js-tagcontent").prev(),s=S(a.find(">td")[0]);s=s.match(/\[quote\]((.|\n)+)\[\/quote\]/)?.[1]??"",t.description=s;let{size:r,category:n,videoType:i}=Ze(),d=$("h1").eq(0).text();t.title=H(d);let h=R(d),g=$(".contentlayout h1").length>0,c=g?$(".contentlayout h1"):$("#details .showlinks li").eq(1);if(g){let y=c.prop("lastChild").nodeValue.replace(/\s|\(|\)/g,""),D=c.find("a").text();if(t.movieName=D,y)t.year=y;else{let T=t.title.match(/\s([12][90]\d{2})/);t.year=T?T[0]:""}}t.imdbUrl=c.find("a").attr("href"),t.category=A(t,n),t.source=O(t.title),t.videoType=i;let p=t.videoType.match(/bluray/i),m=p?B:w,f=U(s);if(!p)t.bdinfo=f,Xe(e).then(y=>{if(y){t.mediaInfo=y;let{videoCodec:D,audioCodec:T,resolution:C,mediaTags:x}=m(t.mediaInfo);t.videoCodec=D,t.audioCodec=T,t.resolution=C,t.tags={...h,...x}}});else{t.mediaInfo=f;let{videoCodec:y,audioCodec:D,resolution:T,mediaTags:C}=m(f||s);t.videoCodec=y,t.audioCodec=D,t.resolution=T,t.tags={...h,...C}}t.size=r,t.screenshots=et(a)},Ze=()=>{let e={"Blu-ray/HD DVD":"bluray",Capture:"hdtv",Encode:"encode",Remux:"remux","WEB-DL":"web"},o=$("th:contains(Category)").next().text(),a=$("th:contains(Size)").eq(0).next().text(),s=o.split("("),r=s[0].trim().toLowerCase(),n=s[1].split(",")[0].toLowerCase().replace(/\./g,""),i=s[1].split(",")[1].replace(/\)/g,"").trim();return{size:F(a),category:r,videoCodec:n,videoType:e[i]}},Xe=e=>new Promise((o,a)=>{GM_xmlhttpRequest({method:"GET",url:`https://hdbits.org/details/mediainfo?id=${e}`,onload(s){let r=s.responseText;(s.status!==200||!r)&&a(new Error("\u8BF7\u6C42\u5931\u8D25")),o(r)}})}),et=e=>t.description.match(/\[url=.+?\]\[img\].+?\[\/img\]\[\/url]/g)??[];var Se=()=>{t.sourceSite=l,t.sourceSiteType=u.siteType;let e=$("#main_table h1").eq(0).text(),o=e.match(/[^[]+/)?.[0];t.title=H(o),t.subtitle=e.replace(o,"").replace(/\[|\]/g,"");let a=R(t.subtitle+t.title),s=oe("\u7C7B\u578B").text(),{category:r,area:n,videoType:i}=tt(s);t.area=n,t.videoType=rt(o,i);let d=t.title.match(/(18|19|20)\d{2}/g);t.year=d?d.pop():"",t.imdbUrl=oe("IMDB").find("a").attr("href"),t.source=O(t.title);let h=oe("\u5C3A\u5BF8").text().match(/\(((\d|,)+)\s*字节\)/i)?.[1];t.size=h.replaceAll(",","");let g=t.videoType.match(/bluray/i),c=g?B:w;window.onload=()=>{let p=$("#kt_d"),m=S(p[0]),f=m.match(/\[color=\w+\]本种子.+?\[\/color\]/)?.[0]??"";m.match&&(m=m.replace(f,"")),t.description=m;let y=m.match(/https:\/\/(movie\.)?douban.com\/subject\/\d+/)?.[0];y&&(t.doubanUrl=y);let D=m.match(/(产\s+地|国\s+家)\s+(.+)/)?.[2];D&&(t.area=k(D)),r?t.category=A(t,r):t.category=st(m);let{bdinfo:T,mediaInfo:C}=ot(m),x=g?T:C;if(x){t.mediaInfo=x;let{videoCodec:v,audioCodec:b,resolution:_,mediaTags:I}=c(x);t.videoCodec=v,t.audioCodec=b,t.resolution=_,t.tags={...a,...I}}else{let v=t.title.match(/\d{3,4}(p|i)/i)?.[0];if(!v&&v.match(/4k|uhd/i)&&(v="2160p"),t.resolution=v,t.audioCodec=q(t.title),m.match(/VIDEO(\.| )*CODEC/i)){let b=m.match(/VIDEO(\.| )*CODEC\.*:?\s*([^\s_:]+)?/i)?.[2];if(b)t.videoCodec=b.replace(/\.|-/g,"").toLowerCase();else{let{title:_}=t;t.videoCodec=Q(_)}}if(m.match(/AUDIO\s*CODEC/i)){let b=m.match(/AUDIO\s*CODEC\.*:?\s*(.+)/i)?.[1];b&&(t.audioCodec=q(b))}}t.screenshots=at(m),console.log(t)}},tt=e=>{let o="",a="",s="";return e.match(/电影/)?o="movie":e.match(/剧包/)?o="tvPack":e.match(/剧/)?o="tv":e.match(/纪录/)?o="documentary":e.match(/综艺/)?o="variety":e.match(/体育/)?o="sport":e.match(/演唱会/)?o="concert":e.match(/动漫/)&&(o="cartoon"),e.match(/韩/)?a="KR":e.match(/日/)?a="JP":e.match(/华/)?a="CN":e.match(/欧/)&&(a="US"),e.match(/UHD原盘/i)?s="uhdbluray":e.match(/bluray原盘/i)?s="bluray":e.match(/DVD/i)&&(s="dvd"),{category:o,area:a,videoType:s}},ot=e=>{let o=e.match(/\[quote\](.|\n)+?\[\/quote\]/g),a="",s="";for(let r=0;re.replace(/\[(.+)\]?/g,"").replaceAll("\u200D",""),at=e=>{if(e.match(/More\.Screens/i)){let o=e.match(/\.More\.Screens\[\/u\]\[\/color\]\n((.|\n)+\[\/(url|img)\])/)?.[1];return Y(o)}else return Y(e)},rt=(e,o)=>e.match(/HDTV/i)?"hdtv":e.match(/web(-)*(dl|rip)/i)?"web":e.match(/remux/i)?"remux":e.match(/dvdrip/i)?"dvdrip":e.match(/x264|x265/i)?"encode":o,oe=e=>$(`#main_table td.heading:contains(${e})`).next(),st=e=>{let o="movie",{title:a,subtitle:s}=t;return a.match(/s0?\d{1,2}/i)||e.match(/集\s*数/)?a.match(/s0?\d{1,2}e0\d{1,2}/i)||s.match(/第[^\s]集/)?o="tv":o="tvPack":e.match(/动画/)?o="cartoon":e.match(/纪录/)&&(o="documentary"),o};var Ie=()=>{t.sourceSite=l,t.sourceSiteType=u.siteType;let{Category:e,Name:o,Type:a,Size:s,Resolution:r}=it();t.size=F(s),t.title=H(o);let n=R(t.title),i=$(".movie-heading span:last").text(),d=$(".movie-heading span:first").text();if(i)t.year=i.replace(/\(|\)|\s/g,"");else{let b=t.title.match(/(19|20)\d{2}/g);t.year=b?.pop()??""}t.resolution=r;let h=$(".panel-heading:contains(Description)+div .panel-body"),g=S(h[0]);t.description=g;let c=$(".movie-details a:contains(IMDB)").attr("href");t.imdbUrl=c,t.movieName=d;let p=nt(e);t.category=A(t,p),t.source=O(t.title),t.videoType=dt(a,r);let m=t.videoType.match(/bluray/i),f=$(".decoda-code code").text(),y=U(g),D=m?B:w,T=m?y:f,{videoCodec:C,audioCodec:x,mediaTags:v}=D(T);return t.mediaInfo=T,t.videoCodec=C,t.audioCodec=x,t.tags={...n,...v},t.screenshots=t.description.match(/\[url=.+?\]\[img\].+?\[\/img\]\[\/url]/g)??[],t},it=()=>{let e={};return $("#vue+.panel table tr").each((o,a)=>{let s=$(a).find("td:first").text().replace(/\s|\n/g,""),r=$(a).find("td:last").text();e[s]=r.replace(/\n/g,"").trim()}),e},nt=e=>({Movie:"movie","TV Show":"tv"})[e],dt=(e,o)=>(e=e.replace(/\s/g,""),e.match(/FullDisc/)?o.match(/2160p/i)?"uhdbluray":o.match(/1080/)?"bluray":"dvd":e.match(/Encode/i)?"encode":e.match(/web/i)?"web":e.match(/HDTV/i)?"hdtv":e);var we=()=>{let e=$("#top").text().split(/\s{3,}/)?.[0]?.trim(),o=$("td.rowhead:contains('\u57FA\u672C\u4FE1\u606F'), td.rowhead:contains('\u57FA\u672C\u8CC7\u8A0A')").next().text().replace(/:/g,":"),a=$("td.rowhead:contains('\u526F\u6807\u9898'), td.rowhead:contains('\u526F\u6A19\u984C')").next().text(),s=$("#kimdb>a").attr("href"),r=S($("#kdescr")[0]);if(l==="HDArea"&&(e=$("h1#top").text().split(/\s{3,}/)?.[0]?.trim()),l==="TJUPT"&&(e=(e.match(/\[((\w|\.|\d|-)+)\]/g).filter(I=>I.match(/\.| /))?.[0]??"").replace(/\[|\]/g,"")),l==="PTer"&&(r=$("#descrcopyandpaster").val().replace(/hide(=(MediaInfo|BDInfo))?\]/ig,"quote]")),l==="LemonHD"&&(r=r.replace(/\[b\]\[color=\w+\][^[]+?网上搜集[^[]+?\[\/color\]\[\/b\]/,"")),l==="HDChina"){let b=[];$("li:contains('\u57FA\u672C\u4FE1\u606F'):last").next("li").children("i").each(function(){b.push($(this).text().replace("\uFF1A",":"))}),o=b.join("\xA0\xA0\xA0"),a=$("#top").next("h3").text()}if(l==="OurBits"&&(s=$(".imdbnew2 a:first").attr("href"),t.doubanUrl=$("#doubaninfo .doubannew a").attr("href"),t.doubanUrl)){let b=S($(".doubannew2 .doubaninfo")?.[0]),_=`[img]${$("#doubaninfo .doubannew a img").attr("src")}[/img] `;t.doubanInfo=_+b}if(l==="KEEPFRDS"&&([e,a]=[a,e]),l==="SSD"){t.doubanUrl=$(".douban_info a:contains('://movie.douban.com/subject/')").attr("href");let b=S($(".douban-info artical")?.[0]),_=$("#kposter").find("img")?.attr("src")??"",I=_?`[img]${_} [/img] `:"";if(t.doubanInfo=I+b.replace(/\n{2,}/g,` `),r===""||r===void 0){let N=S($(".torrent-extra-text-container .extra-text")?.[0]);N=N?`