importcheeriofrom"./cheerio.min.js";import"./crypto-js.js";import模板from"./模板.js";import{gbkTool}from"./gbk.js";functioninit_test(){console.log("init_test_start");console.log("当前版本号:"+VERSION);console.log(RKEY);console.log(JSON.stringify(rule));console.log("init_test_end")}functionpre(){if(typeofrule.预处理==="string"&&rule.预处理&&rule.预处理.trim()){letcode=rule.预处理.trim();console.log("执行预处理代码:"+code);if(code.startsWith("js:")){code=code.replace("js:","")}try{eval(code)}catch(e){console.log("预处理执行失败:"+e.message)}}}letrule={};letvercode=typeofpdfl==="function"?"drpy2.1":"drpy2";constVERSION=vercode+" 3.9.41beta1 20230328";constMOBILE_UA="Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36";constPC_UA="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36";constUA="Mozilla/5.0";constUC_UA="Mozilla/5.0 (Linux; U; Android 9; zh-CN; MI 9 Build/PKQ1.181121.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.5.5.1035 Mobile Safari/537.36";constIOS_UA="Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1";constRULE_CK="cookie";constCATE_EXCLUDE="首页|留言|APP|下载|资讯|新闻|动态";constTAB_EXCLUDE="猜你|喜欢|APP|下载|剧情|热播";constOCR_RETRY=3;constOCR_API="http://drpy.nokia.press:8028/ocr/drpy/text";if(typeofMY_URL==="undefined"){varMY_URL}varRKEY;varfetch;varprint;varlog;varrule_fetch_params;varfetch_params;varoheaders;var_pdfh;var_pdfa;var_pd;constDOM_CHECK_ATTR=/(url|src|href|-original|-src|-play|-url)$/;constNOADD_INDEX=/:eq|:lt|:gt|:first|:last|^body$|^#/;constURLJOIN_ATTR=/(url|src|href|-original|-src|-play|-url)$/;constSELECT_REGEX=/:eq|:lt|:gt|#/g;constSELECT_REGEX_A=/:eq|:lt|:gt/g;if(typeofObject.assign!="function"){Object.assign=function(){vartarget=arguments[0];for(vari=1;i<arguments.length;i++){varsource=arguments[i];for(varkeyinsource){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}returntarget}}if(!String.prototype.includes){String.prototype.includes=function(search,start){if(typeofstart!=="number"){start=0}if(start+search.length>this.length){returnfalse}else{returnthis.indexOf(search,start)!==-1}}}if(!Array.prototype.includes){Object.defineProperty(Array.prototype,"includes",{value:function(searchElement,fromIndex){if(this==null){thrownewTypeError('"this" is null or not defined')}varo=Object(this);varlen=o.length>>>0;if(len===0){returnfalse}varn=fromIndex|0;vark=Math.max(n>=0?n:len-Math.abs(n),0);while(k<len){if(o[k]===searchElement){returntrue}k++}returnfalse}})}if(typeofString.prototype.startsWith!="function"){String.prototype.startsWith=function(prefix){returnthis.slice(0,prefix.length)===prefix}}if(typeofString.prototype.endsWith!="function"){String.prototype.endsWith=function(suffix){returnthis.indexOf(suffix,this.length-suffix.length)!==-1}}Object.prototype.myValues=function(obj){if(obj==null){thrownewTypeError("Cannot convert undefined or null to object")}varres=[];for(varkinobj){if(obj.hasOwnProperty(k)){res.push(obj[k])}}returnres};if(typeofObject.prototype.values!="function"){Object.prototype.values=function(obj){if(obj==null){thrownewTypeError("Cannot convert undefined or null to object")}varres=[];for(varkinobj){if(obj.hasOwnProperty(k)){res.push(obj[k])}}returnres}}if(typeofArray.prototype.join!="function"){Array.prototype.join=function(emoji){emoji=emoji||"";letself=this;letstr="";leti=0;if(!Array.isArray(self)){throwString(self)+"is not Array"}if(self.length===0){return""}if(self.length===1){returnString(self[0])}i=1;str=this[0];for(;i<self.length;i++){str+=String(emoji)+String(self[i])}returnstr}}String.prototype.rstrip=function(chars){letregex=newRegExp(chars+"$");returnthis.repl