M3u8

解析 或 破解 vip影视 的时候,使用的 《在线播放器》 和 《在线VIP解析接口》 和 《第三方影视野鸡网站》 全局通用 拦截和过滤 (解析资源/采集资源) 的 插播广告切片

  1. // ==UserScript==
  2. // @name M3u8
  3. // @description:en 不推荐手机浏览器使用,特别是没有安装 猴子 的 那种套壳浏览器
  4. // @description 解析 或 破解 vip影视 的时候,使用的 《在线播放器》 和 《在线VIP解析接口》 和 《第三方影视野鸡网站》 全局通用 拦截和过滤 (解析资源/采集资源) 的 插播广告切片
  5. // @version 20250428
  6. // @author 江小白
  7. // @include /\.php\?vod_id=\d+?$/
  8. // @include /\/\?id=[a-zA-Z\d]+?$/
  9. // @include /\/[pP]lay(?:er)?(?:\/|\?id=\d)/
  10. // @include /(?:lay|ideo).*?\.html/
  11. // @include /\.m3u8(?:\?(?!.+?&)|$)/
  12. // @include /^https?:\/\/[^\/]+?\/$/
  13. // @include /^https?:\/\/(?:movie\.douban\.com\/subject|m\.douban\.com\/movie)\//
  14. // @include /^https?:\/\/.+?(?<!(?:refer(?:rer)?|ori(?:gin)?))[&#=\?]https?(?::\/\/|:\\\/\\\/|%3A%2F%2F)/
  15. // @include /^https?:\/\/(?!.+?https?(?::\/\/|:\\\/\\\/|%3A%2F%2F)).+?[\?&](?:url|rul)=(?!http).{5,}/
  16. // @include /^https?:\/\/[^\/]+?\/(?:play|share)\/[a-z0-9]+?\/?\s*?$/
  17. // @include /^https?:\/\/[^\/]+?\/vod(?:\/[^\/]+?(?:\/\d[^\/]+?\d)?\.html|detail\/\d[^\/]+?\d\.html)/
  18. // @include /^https?:\/\/(?!.+?https?(?::\/\/|:\\\/\\\/|%3A%2F%2F)).+?\/(?:index\.php\/vod\/detail\/id\/\d+?|p\/\d[^\.]+?\d)\.html/
  19. // @exclude /^https?:\/\/(?:[^\/]+?\.)?(?:(?:ggpht|qpic|gstatic|[yg]timg|youtu|google|cloudflare)|(?:roajsdl|vvvdj|bing|jd|tmall|taobao|meizu|asus|nike|vmall|fliggy|adidas|gome|\w*?suning|liangxinyao|xiaomiyoupin|mmstat|\w*?video\w*?\.qq)\.)/
  20. // @exclude /^https?:\/\/(?:.+?\]|(?:[^\/]+?\/(?!api)){1,}\w+?\?\w*?id=.+?(?<!&key=.+?)[&#=\?]https?(?::\/\/|:\\\/\\\/|%3A%2F%2F)|(?:[^\/]+?\/(?:proxyhttp|[a-zA-Z]*?kv\?)|.+?\.\w+?\/\d+?)$)/
  21. // @exclude /(?:^https?:\/\/(?!.+?https?(?::\/\/|:\\\/\\\/|%3A%2F%2F)).+?\.(?:ts|vob|3gp|rmvb|flac|[fh]lv|og[gv]|m(?:3u8|p[34]|kv|4a|ov|pg|idi|peg)|w(?:[am]v|ma|ebm)|a(?:ac|pe|vi|lac))|\.(?:js(?:on)?|rb|swf|png|xml|bmp|pac|gif|apk|exe|zip|txt|aspx|docx?|jpe?g|p(?:y|df|ng)|i(?:co|dx|mage)|r(?:ss|ar|[0-9]{2,2})|s(?:h|vg|rt|ub)|(?:c|le)ss|w(?:ebp|off2)))(?:#|\?|\\|&|$)|\/0\/(?:\d+?_){1,}\d+?\/0$/
  22. // @run-at document-start
  23. // @namespace https://greasyfork.org/users/769699
  24. // ==/UserScript==
  25.  
  26. (function() {
  27. try {
  28. if (typeof location['m3u8去插播广告'] === 'undefined') {
  29. try {
  30. Object.defineProperty(location, 'm3u8去插播广告', {
  31. value: 'm3u8去插播广告',
  32. writable: false,
  33. enumerable: false,
  34. configurable: false
  35. });
  36. } catch (e) {}
  37. try {
  38. if (typeof Proxy === 'function') {
  39. let m3u8wz, wzm3u8, mp4wz, flvwz, tswz, playsharewz, urlFromArgBy, ggbmd, shouldStopExecution, 打印开关, spbfurl, gggzdp, gggzpd, ggsjgg, ggzlhx, ggljbmd, ggljdmb, hhzz, bhhzz, dypd, m3u8gglj, m3u8ggljdypd, m3u8bflj;
  40. m3u8gglj = '';
  41. m3u8bflj = '';
  42. hhzz = '[\\n\\r\\u0085\\u2028\\u2029]';
  43. bhhzz = '[^\\n\\r\\u0085\\u2028\\u2029]';
  44. wzm3u8 = /\.m3u8(?:\?(?!.+?&)|$)/i;
  45. m3u8wz = /\.(?:m3u8|png|css)(?:#|\?|\\|&|$)|(?<!thread|forum|read)\.php(?!(?:[a-z0-9\/]|\?\w+?=.+?\.(?:m(?:p4|kv)|flv|ts)(?:#|\?|\\|&|$)))|\/(?!.+?\.m(?:3u8|p4)(?:#|\?|\\|&|$)).+?(?<![a-z0-9])m(?:3u8|p4)(?![a-z0-9])/i;
  46. mp4wz = /\.m(?:p4|kv)(?:#|\?|\\|&|$)|^https?:\/\/(?:[^\/]+?\.)?pstatp.+?\/obj\/[^\.]+?$|type=video_mp4&(?!.+\.[a-z]{2,5}(?:#|\?|\\|&|$))|\.php\?\w+?=.+?\.mp4/i;
  47. flvwz = /\.flv(?:#|\?|\\|&|$)/i;
  48. tswz = /\.ts(?:#|\?|\\|&|$)/i;
  49. playsharewz = /^https?:\/\/[^\/]+?\/{1,}(?:play|share)\/{1,}[a-zA-Z0-9]+?(?:\/{1,})?$/i;
  50. dypd = /^\s*?(?:0{1,}|(?<!开\s*?)关(?:\s*?[闭掉])?)\s*?$/;
  51. 打印开关 = '关';
  52. ggsjgg = '4|20';
  53. ggzlhx = 'ts|png|jpe?g|txt';
  54. ggljbmd = /&(?:[a-z]*?(?:sign|token|version)|[a-z]+?_?key)=/i;
  55. ggbmd = /(?:\.php|\_(?:ts|mp4)\/.+?\.m3u8)(?:#|\?|\\|&|$)/i;
  56. ggljdmb = new RegExp('\\.(?:' + ggzlhx + ')' + hhzz + '+?#EXTINF','i');
  57. shouldStopExecution = false;
  58. try {
  59. if (!shouldStopExecution) {
  60. /*以下是 M3U8 插播广告 过滤核心代码 不懂勿动*/
  61. const tyad0 = '#EXTINF'
  62. , tyad1 = tyad0 + '\\s*?:\\s*?'
  63. , tyad2 = '#EXT-X-DISCONTINUITY'
  64. , tyad3 = tyad2 + hhzz
  65. , tyad4 = '(?:' + ggzlhx + ')'
  66. , tyad5 = '\\.' + tyad4
  67. , tyad6 = tyad5 + hhzz + '+'
  68. , tyad7 = '#EXT-X-ENDLIST'
  69. , tyad8 = '(?:[a-z\\d]+?(?:\\s*?[\\_\\-]\\s*?)?)?\\d+?'
  70. , tyad9 = '#EXT-X-TARGETDURATION'
  71. , tyad10 = new RegExp('^\\s*?(?:(?!.*?0{3,})[a-z\\d]+?|' + tyad8 + '|https?:\\\/\\\/' + bhhzz + '+?0{3,}\\d+?)\\s*?$','i')
  72. , tyad11 = new RegExp('^' + tyad0,'i')
  73. , tyad12 = new RegExp('^\\s*?' + tyad1,'i')
  74. , tyad13 = '[\\S\\s]+?'
  75. , tyad14 = new RegExp(tyad8 + tyad5,'i')
  76. , tyad15 = '#EXT-X-PLAYLIST-TYPE'
  77. , tyada = bhhzz + '+?' + tyad6
  78. , tyadb = tyad1 + '\\d+?(?:\\.\\d+?)?\\s*?,' + hhzz + '+?'
  79. , tyadc = tyad3 + '+'
  80. , tyadd = tyadc + '?' + tyadb
  81. , tyade = tyada + '?[\\s\\S]*?' + tyadc
  82. , tyadf = '(?<=' + tyad9 + '\\s*?:\\s*?'
  83. , tyadg = ')(?:\\.0{1,})?\\s*?,'
  84. , tyadh = '(?:#EXT-X-[^:]+?:\\s*?'
  85. , tyadi = tyad1 + '\\d+?\\.\\d+?'
  86. , tyad100 = ggsjgg + tyadg
  87. , tyad101 = hhzz + '+?' + tyadh + bhhzz
  88. , tyad102 = tyad1 + '(?:' + tyad100 + hhzz
  89. , tyad103 = tyad101 + '+?' + hhzz
  90. , tyad104 = tyad1 + '\\d+?(?:\\.\\d+?)?,'
  91. , tyad105 = 'https?:\\\/\\\/'
  92. , tyad106 = '+?\\\/\\d+?_\\w{1,10}\\.ts'
  93. , tyad107 = new RegExp('^((?:' + bhhzz + '+?|\\s*?))(?=0{3}\\d+?' + tyad5 + ')','i')
  94. , tyad108 = '[a-z\\d]{10,}0{2}\\d+?\\.'
  95. , tyad109 = '(?:(?=' + tyad7 + ')|' + tyad3 + ')'
  96. , tyad1010 = '^\\s*?#EXTM3U\\s*?'
  97. , tyad1011 = hhzz + '+?' + bhhzz + '+?'
  98. , tyad1012 = tyad1011 + hhzz + '+?'
  99. , tyad1013 = tyad104 + tyad1012 + ')'
  100. , tyad1014 = tyad3 + '+?'
  101. , tyad1015 = tyad104 + hhzz + '+?'
  102. , tyad1016 = tyad6 + '?'
  103. , tyad1017 = bhhzz + '+?' + hhzz + '+?'
  104. , tyad1018 = '0{3}'
  105. , tyad1019 = tyad1011 + hhzz + '+?'
  106. , tyad1020 = tyad104 + tyad1019
  107. , tyad1021 = '#EXT-X-KEY\\s*?:\\s*?METHOD\\s*?='
  108. , tyad1022 = bhhzz + '+?' + tyad5
  109. , tyad1023 = '(?<=' + hhzz + '+)' + tyad1022
  110. , tyad1024 = tyad105 + bhhzz
  111. , tyad1025 = tyad1022 + hhzz + '+?'
  112. , tyad1026 = '(?<=' + hhzz + '+)' + tyad1014 + tyad1
  113. , tyad1027 = hhzz + '+?' + tyad105
  114. , tyad1028 = tyad1027 + tyad1017
  115. , tyad1029 = tyad1011 + tyad1016
  116. , tyad1030 = tyad1015 + tyad1024 + tyad106 + hhzz
  117. , tyad1031 = tyad1010 + hhzz + '+?'
  118. , tyad1032 = tyad1031 + '(?:#EXT-X-' + tyad1017 + '){1,}('
  119. , tyad1033 = tyad1011 + '(?<!' + tyad1018 + bhhzz + '+?)'
  120. , tyad1034 = tyad1033 + hhzz + '+?'
  121. , tyad1035 = tyad1033 + tyad5 + hhzz + '+?'
  122. , tyad1036 = tyadb + tyad1025
  123. , tyad1037 = tyad1028 + '(?:' + tyad1
  124. , tyad1038 = hhzz + '+?' + tyad1024 + '+?' + hhzz + '+?'
  125. , tyad1039 = tyadb + tyad1024 + '+?'
  126. , tyad1040 = tyad1029 + tyad1
  127. , tyad1041 = tyad1 + '\\d+?(?:\\.0{1,})?,'
  128. , tyad1042 = '(?:' + tyad1041 + tyad1038 + ')'
  129. , tyad1043 = tyadi + '\\s*?,' + hhzz
  130. , tyad1044 = '+?[a-z\\d]+?' + tyad6 + '?'
  131. , tyad1045 = tyad1043 + tyad1044 + '){'
  132. , tyad1046 = '\\s*?,' + hhzz + tyad1044
  133. , tyad1047 = '(?=#EXT-X-)'
  134. , tyad1048 = '){0,}'
  135. , tyad1049 = tyad1048 + tyad1 + '\\d+?\\.3{3,}\\s*?,'
  136. , tyad1050 = tyad1046 + '(?:' + tyad1043 + tyad1044 + tyad1048 + ')'
  137. , tyad1051 = new RegExp(tyad1010 + tyad13 + tyad5 + '(?:\\?' + bhhzz + '+?)?' + hhzz + '+?' + tyad1 + tyad13 + tyad7 + '\\s*?$','i')
  138. , tyad1052 = tyadb + tyad1017
  139. , itemts = new RegExp(tyad5,'i')
  140. , itemm3u8 = new RegExp(tyad1010 + '#EXT-X-','i')
  141. , itemsdpgza = tyad1026 + '(?<!0)(3)\\.\\1(?:((?<!0)\\d)\\2){2,}\\d+?,' + tyad1028 + '(?:' + tyad104 + tyad1028 + tyad1048 + tyad109
  142. , itemspdgza = '(?:' + tyad1015 + '[a-z\\d]{10,}0{2}\\d+?' + tyad1016 + '){5,}'
  143. , itemstygza = '(?<=(?:' + tyad1015 + tyad108 + tyad4 + hhzz + '+?){1,})' + tyad1014 + '(?:' + tyad1015 + '(?!' + tyad108 + tyad4 + ')' + tyada + '?){1,}' + tyad109
  144. , itemstygza1 = '(?<=' + tyad1020 + ')' + tyad1014 + tyad1052 + tyad1 + '3\\.3{3,}\\s*?,' + tyad1034 + '(?:' + tyad1052 + tyad1049 + tyad1034 + tyad109
  145. , itemstygza2 = new RegExp(tyad1032 + tyadb + '(\\\/' + bhhzz + '+?\\\/)[^\\\/]+?' + tyad1016 + '(?:' + tyadb + '\\2[^\\\/]+?' + tyad1016 + '){3,})' + tyad1014 + '#EXT-X-KEY\\s*?:\\s*?METHOD=NONE' + hhzz + '+?' + tyad1039 + tyad1016,'i')
  146. , itemstygza3 = new RegExp(tyad1039 + tyad6,'igm')
  147. , itemstygza4 = new RegExp(tyad1032 + '?:' + tyadb + '(?<!' + tyad105 + ')[a-z0-9\\\/]+?' + tyad6 + '?){3,}' + tyad1014 + '(?:' + tyad1039 + tyad6 + '){3,}','i')
  148. , itemstygza5 = new RegExp('(?<=(?<=' + hhzz + '+)' + tyad1014 + tyadi + tyad1018 + tyad1050 + tyad2 + '(?:' + hhzz + '+?' + tyad1045 + '1,}(?:' + tyadi + '3{5}' + tyad1050 + '{2,}' + tyad1047,'gi')
  149. , itemstygza6 = new RegExp('(?<=' + hhzz + '+)' + tyad1014 + '(?:#EXT-X-' + bhhzz + '+' + hhzz + '+){1,}(?=(?:' + tyad7 + '|' + tyad1 + '\\d))','gim')
  150. , itemstygza7 = new RegExp('(?<=' + tyad1052 + ')(?:#EXT-X-(?!(?:DISCONTINUITY|ENDLIST))' + tyad1017 + '){1,}(?=(?:' + tyad2 + '|#EXT-X-|' + tyad1 + '\\d))','gim')
  151. , itemstygza8 = new RegExp(tyad1014 + tyad1036 + tyad1 + '3\\.3{3,}\\s*?,' + tyad1035 + '(?:' + tyad1036 + tyad1049 + tyad1035 + '(?:' + tyad1036 + tyad1048 + tyad109,'gim')
  152. , itemstygpc1 = new RegExp(itemstygza1,'gim')
  153. , itemstygpc2 = new RegExp('(?:' + tyad1052 + '){7,}','gim')
  154. , itemstygpc3 = new RegExp('(?:' + tyad1052 + '){15,}','gim')
  155. , itemsPaichu = [/*动态排除指定资源 正规则表达式,以达到智能删除插播广告的效果*/
  156. new RegExp(tyad1031 + '(?![\\S\\s]*?(?:' + tyad1015 + '[a-z\\d]{10,}0{2}\\d+?' + tyad1016 + '){2,})[\\S\\s]*?' + tyad1014 + '(?:' + tyad1015 + '(?:[a-z]+?\\d+?|\\d+?[a-z]+?){10,}' + tyad1016 + '){2,}','i')]
  157. , itemsHandle = [{
  158. reUrl: wzm3u8,
  159. reAds: [new RegExp(itemsdpgza,'gim'), new RegExp(itemstygza,'gim'), itemstygpc1, itemstygza8, new RegExp('(?<=' + tyad1031 + '(?:#EXT-X-(?!KEY)' + tyad1017 + '){1,})(?:' + tyad1021 + tyad1017 + '(?:' + tyad1014 + ')?){1,}(?=' + tyad1021 + ')','gim'), /*动态拼接采集资源 正规则表达式,以达到智能删除插播广告的效果*/
  160. new RegExp(tyad1026 + '((?<!0)\\d\\.([1-9])(?!\\2)\\d{4,5}(?<!\\2)\\2),' + tyad1037 + '\\1,' + tyad1028 + '){2,6}' + tyad109,'gim'), new RegExp('(?<=' + tyad1030 + '+?(?:' + tyad1014 + tyad1048 + ')' + tyad1014 + '(?:' + tyad104 + hhzz + tyad1024 + '+?\\\/\\w{50,}\\.ts' + hhzz + '+?){1,}' + tyad1014 + '(?=' + tyad1030 + ')','gim'), new RegExp(tyadf + '(?:' + tyad100 + '?' + bhhzz + '+?' + tyad103 + '+?' + tyad1048 + ')' + tyad102 + '+?' + bhhzz + '+?-' + bhhzz + '+?\\d' + tyad1016 + '(?=' + tyad1 + ')','gim'), new RegExp(tyadf + bhhzz + '+?' + tyad103 + '+' + tyad1048 + ')(?:' + tyad1014 + ')?' + tyad102 + '+?[a-z\\d]+?0{4,}' + tyad1016 + '[\\s\\S]+?' + hhzz + '+[a-z\\d]+?0{2,}\\d' + tyad1016 + '(?<![\\s\\S]+?10' + tyad5 + '\\n*?[\\s\\S]*?' + hhzz + '+)(?=(?:' + tyad3 + '+|' + tyad1 + '\\d+(?:\\.\\d+)?\\s*?,' + hhzz + '+?[a-z\\d]+?10' + tyad1016 + '))','gi'), ],
  161. }]
  162. , itemsHandleby = [/*播放黑木耳采集资源的时候,额外增加该数组规则,避免其他的误杀*/
  163. {
  164. reUrl: /^https?:\/\/(?:[^\/]+?\.)?(?:hmr|heimuer)/i,
  165. reAds: [new RegExp('(\\n' + tyad2 + ')\\n.+\\n.+\\1','i'), new RegExp('(\\n' + tyad2 + ')(\\n.+\\n).+\\2.+\\2.+(\\2.+)?\\1','gi'), new RegExp('(?<=' + tyad1014 + ')' + tyad1039 + tyad5 + tyad1017 + tyad1047,'gim'), new RegExp(tyad1026 + '((?<!0)\\d\\.(?!0)\\d{4,5}[1-9]),' + tyad1037 + '\\1,' + tyad1028 + '){2,6}' + tyad109,'gim'), new RegExp(tyad1026 + '(\\d+?(?:\\.(?!0{1,},)\\d+?)?),' + tyad1037 + '\\1,' + tyad1028 + '){1,}' + tyad109,'gim'), ]
  166. }, /*播放华为采集资源的时候,额外增加该数组规则,避免其他资源误杀*/
  167. {
  168. reUrl: /^https?:\/\/(?:[^\/]+?\.)?nikanba/i,
  169. reAds: [new RegExp('(?<=' + tyad2 + ')' + hhzz + '+?' + tyad1 + '10,' + tyad1027 + tyada + '?' + tyad2 + '(?=' + hhzz + ')','gim'), new RegExp(tyad1014 + tyad1 + '2,' + tyad1040 + '3,' + tyad1040 + '1,' + tyad1029 + '(?:' + tyad104 + tyad1011 + tyad6 + '?' + tyad1048 + tyad3 + '+','gim'), ]
  170. }, ];
  171. const logysa = '%c[江小白-'
  172. , logysb = '-已经发现] ✂\n%c对比'
  173. , logysc = '-已经发现] ✂\n%c已经生效的广告正则:\n%c'
  174. , logysd = "的广告正则:\n%c"
  175. , logyse = '\n%c已经删除的广告内容:\n'
  176. , logysf = 'border-left:5px solid #A0B;color:#A0B;padding:3px'
  177. , logysg = 'color:blue;'
  178. , logysh = 'color:red;'
  179. , logysi = 'color:black;'
  180. , logysj = '广告标识'
  181. , logysk = '额外删除-具体内容] ✂%c'
  182. , logysl = '时间差异-具体内容] ✂\n%c'
  183. , logysm = '长度差异-具体内容] ✂\n%c'
  184. , logysn = '长短差异-具体内容] ✂\n%c'
  185. , logyso = '时间标识'
  186. , logysq = '名称差异-具体内容] ✂\n%c';
  187. /*以上是 M3U8 插播广告 过滤核心代码 不懂勿动*/
  188. const urlFromArg = arg=>typeof arg === 'string' ? arg : arg instanceof Request ? arg.url : String(arg);
  189. const isValidM3U8Url = url=>{
  190. return (wzm3u8.test(url) && m3u8wz.test(url) && !mp4wz.test(url) && !flvwz.test(url) && !tswz.test(url) && !playsharewz.test(url));
  191. }
  192. ;
  193. const matchM3u = url=>{
  194. try {
  195. if (isValidM3U8Url(url)) {
  196. spbfurl = url;
  197. const matchedItem = itemsHandle.find(item=>item.reUrl.test(url) && isValidM3U8Url(url) && !ggbmd.test(url));
  198. itemsHandleby.forEach(byItem=>byItem.reUrl.test(url) && isValidM3U8Url(url) && byItem.reAds.forEach(newReAd=>matchedItem.reAds.find(ad=>ad.source === newReAd.source && ad.flags === newReAd.flags) || matchedItem.reAds.push(newReAd)));
  199. return matchedItem;
  200. } else {
  201. return null;
  202. }
  203. } catch (e) {
  204. return null;
  205. }
  206. }
  207. ;
  208. const M3umatch = text=>{
  209. try {
  210. if (!text || !itemts.test(text) || !itemm3u8.test(text)) {
  211. return true;
  212. } else {
  213. return false;
  214. }
  215. } catch (e) {
  216. return false;
  217. }
  218. }
  219. ;
  220. const M3umatchu3M = (array,regExp)=>{
  221. return array.some(function(item) {
  222. return item.toString() === regExp.toString();
  223. });
  224. }
  225. ;
  226. const m3u8text = (text)=>{
  227. try {
  228. const regex = /^[a-z\d]{20,}/i;
  229. const lines = text.split('\n');
  230. let count = 0;
  231. for (let line of lines) {
  232. const trimmedLine = line.trim();
  233. if (itemts.test(trimmedLine)) {
  234. const match = trimmedLine.match(itemts);
  235. if (match) {
  236. const extension = match[0];
  237. const fileName = trimmedLine.slice(0, -extension.length);
  238. if (!regex.test(fileName)) {
  239. return false;
  240. }
  241. }
  242. }
  243. if (/0{2,}\d+$/.test(trimmedLine)) {
  244. count++;
  245. if (count >= 20) {
  246. return false;
  247. }
  248. }
  249. }
  250. return true;
  251. } catch (e) {
  252. return false;
  253. }
  254. }
  255. ;
  256. const endlist = (text)=>{
  257. try {
  258. if (!itemm3u8.test(text)) {
  259. return text;
  260. } else {
  261. if (ggljbmd.test(text)) {
  262. return text;
  263. } else {
  264. if (!new RegExp(tyad5,'i').test(text)) {
  265. return text;
  266. } else {
  267. const lines = text.trim().split('\n');
  268. const lastLine = lines[lines.length - 1];
  269. if (lastLine.trim() !== tyad7) {
  270. lines.push(tyad7);
  271. }
  272. return lines.join('\n');
  273. }
  274. }
  275. }
  276. } catch (e) {
  277. return text;
  278. }
  279. }
  280. ;
  281. const deleteAbnormalTs = (text,jxbgza,jxbgzb,jxbgzc,jxbgzd,jxbgze)=>{
  282. try {
  283. if (!shouldStopExecution) {
  284. if (text) {
  285. if (!itemm3u8.test(text)) {
  286. return text;
  287. } else {
  288. if (ggljbmd.test(text)) {
  289. shouldStopExecution = true;
  290. return text;
  291. } else {
  292. if (ggljdmb.test(text)) {
  293. if (new RegExp(tyad1023,'i').test(text)) {
  294. if (!new RegExp(tyad5 + '\\?','i').test(text)) {
  295. if (new RegExp(tyad5 + hhzz,'i').test(text)) {
  296. if (!jxbgzd) {
  297. jxbgzd = new RegExp('^\\s*?' + tyad8 + '\\s*?$','i');
  298. } else if (jxbgzd == '空') {
  299. jxbgzd = /^\s*?空\s*?$/;
  300. }
  301. try {
  302. const rgtya = tyad1015
  303. , rgtyb = jxbgza + tyad1016
  304. , regex = '(?<=' + rgtya + ')(' + jxbgzb + ')(?=' + rgtyb + ')'
  305. , regexx = new RegExp(regex,'gi')
  306. , tsPaths = text.match(new RegExp('(?:(?<=' + tyad1015 + '))?' + bhhzz + '+?(?=' + tyad1016 + ')','gi'))
  307. , matches = text.match(regexx)
  308. , paths = {};
  309. try {
  310. if (!jxbgze || jxbgze == '空' || (Number.isInteger(Number(jxbgze)) && tsPaths && tsPaths.length < jxbgze)) {
  311. if (matches && Array.isArray(matches)) {
  312. for (let i = 0; i < matches.length; i++) {
  313. const path = matches[i];
  314. if (!paths[path]) {
  315. paths[path] = [];
  316. }
  317. paths[path].push(path);
  318. }
  319. let maxCount = 0
  320. , maxPath = '';
  321. for (const path in paths) {
  322. if (paths[path].length > maxCount) {
  323. maxCount = paths[path].length;
  324. maxPath = path;
  325. }
  326. }
  327. if (maxCount > matches.length * 0.66 && Object.keys(paths).length < matches.length * 0.66) {
  328. let deleteCount = 0;
  329. for (const path in paths) {
  330. if (path !== maxPath) {
  331. deleteCount += paths[path].length;
  332. }
  333. }
  334. if (deleteCount <= maxCount) {
  335. for (const path in paths) {
  336. if (path !== maxPath) {
  337. paths[path].forEach(p=>{
  338. /*console.log("排除测试:\n"+p);*/
  339. if (!jxbgzd.test(p)) {
  340. text = text.replace(new RegExp(rgtya + p + rgtyb,'gi'), (match)=>{
  341. if (!dypd.test(打印开关)) {
  342. try {
  343. console.log(logysa + "广告资源" + logysb + jxbgzc + logysd + regexx + logyse + "%c" + match.replace(new RegExp(tyad1023,'gi'), tsLink=>{
  344. if (!tsLink.startsWith('http')) {
  345. if (m3u8gglj) {
  346. return new URL(tsLink,m3u8gglj).href;
  347. } else {
  348. return tsLink;
  349. }
  350. } else {
  351. return tsLink;
  352. }
  353. }
  354. ), logysf, logysg, logysh, logysg, logysi);
  355. } catch (e) {
  356. try {
  357. console.log(logysa + "广告资源" + logysb + jxbgzc + logysd + regexx + logyse + "%c" + match, logysf, logysg, logysh, logysg, logysi);
  358. } catch (e) {}
  359. }
  360. }
  361. return '';
  362. }
  363. );
  364. }
  365. }
  366. );
  367. }
  368. }
  369. } else {
  370. return text;
  371. }
  372. }
  373. } else {
  374. return text;
  375. }
  376. }
  377. } catch (e) {
  378. return text;
  379. }
  380. } catch (e) {
  381. return text;
  382. }
  383. }
  384. }
  385. }
  386. return endlist(text);
  387. } else {
  388. return text;
  389. }
  390. }
  391. }
  392. } else {
  393. return text;
  394. }
  395. } else {
  396. return text;
  397. }
  398. } catch (e) {
  399. return text;
  400. }
  401. }
  402. ;
  403. const durationtaragt = (text)=>{
  404. try {
  405. if (!itemm3u8.test(text)) {
  406. return text;
  407. } else {
  408. const lines = text.split('\n');
  409. const outputLines = [];
  410. let extinfCount = 0;
  411. let tsCount = 0;
  412. let lastExtinf = null;
  413. for (let i = 0; i < lines.length; i++) {
  414. const line = lines[i].trim();
  415. if (tyad12.test(line)) {
  416. const durationPart = line.split(',', 1)[0].replace(tyad12, '').trim();
  417. if (!isNaN(durationPart) && durationPart.trim() !== '') {
  418. extinfCount++;
  419. lastExtinf = line;
  420. } else {
  421. lastExtinf = null;
  422. }
  423. } else if (itemts.test(line)) {
  424. tsCount++;
  425. if (lastExtinf) {
  426. outputLines.push(lastExtinf);
  427. outputLines.push(line);
  428. lastExtinf = null;
  429. } else {
  430. outputLines.push(line);
  431. }
  432. } else if (line) {
  433. outputLines.push(line);
  434. }
  435. }
  436. if (extinfCount > tsCount) {
  437. const finalLines = [];
  438. let shouldKeepTs = false;
  439. for (let i = 0; i < outputLines.length; i++) {
  440. const line = outputLines[i];
  441. if (tyad12.test(line)) {
  442. shouldKeepTs = true;
  443. finalLines.push(line);
  444. } else if (itemts.test(line)) {
  445. if (shouldKeepTs) {
  446. finalLines.push(line);
  447. shouldKeepTs = false;
  448. }
  449. } else {
  450. finalLines.push(line);
  451. }
  452. }
  453. return finalLines.join('\n').trim();
  454. } else {
  455. return outputLines.join('\n').trim();
  456. }
  457. }
  458. } catch (e) {
  459. return text;
  460. }
  461. }
  462. ;
  463. const taragtduration = (text)=>{
  464. try {
  465. if (!itemm3u8.test(text)) {
  466. return text;
  467. } else {
  468. var lines = text.split('\n');
  469. var maxDuration = 0;
  470. var minDuration = Infinity;
  471. var targetDurationLineIndex = -1;
  472. var originalTargetDuration = 0;
  473. for (var i = 0; i < lines.length; i++) {
  474. if (lines[i].match(tyad12)) {
  475. var duration = parseFloat(lines[i].split(',')[0].split(':')[1]);
  476. if (duration > maxDuration) {
  477. maxDuration = duration;
  478. }
  479. if (duration < minDuration) {
  480. minDuration = duration;
  481. }
  482. } else if (lines[i].match(new RegExp('^\\s*?' + tyad9 + '\\s*?:','i'))) {
  483. targetDurationLineIndex = i;
  484. originalTargetDuration = parseInt(lines[i].split(':')[1], 10);
  485. }
  486. }
  487. if (targetDurationLineIndex === -1) {
  488. return text;
  489. } else {
  490. var newTargetDuration;
  491. if (maxDuration === minDuration) {
  492. var multiplier = maxDuration < 10 ? 1.5 : 1.23;
  493. newTargetDuration = Math.ceil(maxDuration * multiplier);
  494. } else {
  495. newTargetDuration = Math.ceil(maxDuration + minDuration);
  496. }
  497. if (newTargetDuration === originalTargetDuration) {
  498. var multiplier = maxDuration < 10 ? 1.5 : 1.23;
  499. newTargetDuration = Math.ceil(maxDuration * multiplier);
  500. }
  501. if (newTargetDuration === originalTargetDuration) {
  502. var multiplier = originalTargetDuration < 10 ? 1.5 : 1.23;
  503. newTargetDuration = Math.ceil(originalTargetDuration * multiplier);
  504. }
  505. if (newTargetDuration !== originalTargetDuration) {
  506. lines[targetDurationLineIndex] = tyad9 + ':' + newTargetDuration;
  507. try {
  508. if (!dypd.test(打印开关)) {
  509. console.log(logysa + logyso + "-已经发现] ✂" + '已经把《' + tyad9 + '》数值从原来的值<' + originalTargetDuration + '>修改成<' + newTargetDuration + '>', logysf);
  510. }
  511. } catch (e) {}
  512. return lines.join('\n');
  513. } else {
  514. return text;
  515. }
  516. }
  517. }
  518. } catch (e) {
  519. return text;
  520. }
  521. }
  522. ;
  523. const proqca = (text,item)=>{
  524. try {
  525. if (!shouldStopExecution) {
  526. if (text) {
  527. if (!itemm3u8.test(text)) {
  528. return text;
  529. } else {
  530. if (ggljbmd.test(text)) {
  531. shouldStopExecution = true;
  532. return text;
  533. } else {
  534. try {
  535. if ((!(new RegExp(itemsdpgza,'i').test(text) && ggljdmb.test(text))) && !new RegExp(tyad1014 + tyad1021,'i').test(text)) {
  536. gggzdp = true;
  537. } else {
  538. try {
  539. itemsHandle.forEach(item=>{
  540. item.reAds = item.reAds.filter(re=>re.source !== itemsdpgza);
  541. }
  542. );
  543. } catch (e) {}
  544. gggzdp = false;
  545. }
  546. } catch (e) {
  547. gggzdp = false;
  548. }
  549. if (ggljdmb.test(text) || !!gggzdp) {
  550. try {
  551. if (!gggzpd) {
  552. gggzpd = true;
  553. try {
  554. if (new RegExp(itemspdgza,'i').test(text) && new RegExp(itemstygza1,'i').test(text)) {
  555. itemsHandle.forEach(item=>{
  556. item.reAds = item.reAds.filter(re=>re.source !== itemstygza1);
  557. }
  558. );
  559. }
  560. } catch (e) {}
  561. try {
  562. if (!(new RegExp(itemspdgza,'i').test(text) && new RegExp(itemstygza,'i').test(text))) {
  563. itemsHandle.forEach(item=>{
  564. item.reAds = item.reAds.filter(re=>re.source !== itemstygza);
  565. }
  566. );
  567. }
  568. } catch (e) {}
  569. if (!dypd.test(打印开关)) {
  570. console.table(itemsPaichu);
  571. console.table(itemsHandle);
  572. }
  573. }
  574. } catch (e) {}
  575. let modifiedText;
  576. try {
  577. if (itemsPaichu.some(regex=>regex.test(text))) {
  578. try {
  579. if (!M3umatchu3M(itemsHandle[0].reAds, itemstygza5)) {
  580. itemsHandle[0].reAds.push(itemstygza5);
  581. }
  582. } catch (e) {}
  583. modifiedText = text;
  584. } else {
  585. if (new RegExp(tyadb + bhhzz + '+?\\.(?:' + ggzlhx + ')\\?' + tyad1017,'i').test(text)) {
  586. modifiedText = text;
  587. } else {
  588. if (m3u8text(text)) {
  589. modifiedText = text;
  590. } else {
  591. try {
  592. if (text.match(itemstygza2)) {
  593. const matchessc = text.match(itemstygza3);
  594. if (matchessc) {
  595. try {
  596. if (!dypd.test(打印开关)) {
  597. console.log(logysa + "资源广告" + logysc + itemstygza3 + logyse, logysf, logysg, logysh, logysg);
  598. matchessc.forEach(match=>{
  599. console.log(match);
  600. }
  601. );
  602. }
  603. } catch (e) {}
  604. modifiedText = text.replace(itemstygza3, '');
  605. } else {
  606. modifiedText = deleteAbnormalTs(text, '[^\\.]+?', '(?:' + bhhzz + '+\\\/|\\b)', '路径');
  607. }
  608. } else {
  609. modifiedText = deleteAbnormalTs(text, '[^\\.]+?', '(?:' + bhhzz + '+\\\/|\\b)', '路径');
  610. }
  611. } catch (e) {
  612. modifiedText = text;
  613. }
  614. try {
  615. if (!text.match(itemstygza4)) {
  616. modifiedText = deleteAbnormalTs(modifiedText, '(?:\\d+?|[a-z]+?)', '\\w+?(?:[^\\d]\\d{2})?', '名称');
  617. }
  618. } catch (e) {}
  619. try {
  620. modifiedText = deleteAbnormalTs(modifiedText, '\\d+?', '\\w+(?=\\d{3})', '名称', '空', 100);
  621. } catch (e) {}
  622. try {
  623. modifiedText = deleteAbnormalTs(modifiedText, '\\d+?', '\\w+(?=\\d{4})', '名称', '空');
  624. } catch (e) {}
  625. try {
  626. modifiedText = deleteAbnormalTs(modifiedText, '\\d+?', '[^0]\\d+[^0]0{2,}\\d0', '名称', /(?<=[^0]0{3,})\d+$/);
  627. } catch (e) {}
  628. }
  629. }
  630. }
  631. } catch (e) {
  632. modifiedText = text;
  633. }
  634. try {
  635. for (const reAd of item.reAds) {
  636. try {
  637. modifiedText = modifiedText.replace(reAd, function(match) {
  638. try {
  639. if (((reAd === itemstygpc1 || reAd === itemstygza5 || reAd === itemstygza8) && match.match(itemstygpc2)) || match.match(itemstygpc3)) {
  640. return match;
  641. } else {
  642. try {
  643. if (!dypd.test(打印开关)) {
  644. try {
  645. console.log(logysa + "资源广告" + logysc + reAd + logyse + "%c" + match.replace(new RegExp(tyad1023,'gi'), tsLink=>{
  646. if (!tsLink.startsWith('http')) {
  647. if (m3u8gglj) {
  648. return new URL(tsLink,m3u8gglj).href;
  649. } else {
  650. return tsLink;
  651. }
  652. } else {
  653. return tsLink;
  654. }
  655. }
  656. ), logysf, logysg, logysh, logysg, logysi);
  657. } catch (e) {
  658. try {
  659. console.log(logysa + "资源广告" + logysc + reAd + logyse + "%c" + match, logysf, logysg, logysh, logysg, logysi);
  660. } catch (e) {}
  661. }
  662. }
  663. } catch (e) {}
  664. return "";
  665. }
  666. } catch (e) {
  667. return match;
  668. }
  669. });
  670. } catch (e) {
  671. continue;
  672. }
  673. }
  674. } catch (e) {}
  675. if (modifiedText.length < text.length) {
  676. return endlist(modifiedText);
  677. } else {
  678. return text;
  679. }
  680. } else {
  681. return text;
  682. }
  683. }
  684. }
  685. } else {
  686. return text;
  687. }
  688. } else {
  689. return text;
  690. }
  691. } catch (e) {
  692. return text;
  693. }
  694. }
  695. ;
  696. const proqcb = (text)=>{
  697. try {
  698. if (!shouldStopExecution) {
  699. if (text) {
  700. if (!itemm3u8.test(text)) {
  701. return text;
  702. } else {
  703. if (ggljbmd.test(text)) {
  704. shouldStopExecution = true;
  705. return text;
  706. } else {
  707. if (!shouldStopExecution) {
  708. const lines = text.split('\n');
  709. const tsLines = lines.filter(line=>line.trim().match(tyad5));
  710. const tsLinesWith00 = tsLines.filter(line=>line.includes('00'));
  711. const totalTsLines = tsLines.length;
  712. const tsLinesWith00Count = tsLinesWith00.length;
  713. if (tsLinesWith00Count / totalTsLines >= 0.666) {
  714. const prefixes = tsLinesWith00.map(line=>{
  715. const index = line.indexOf('00');
  716. return line.substring(0, index + 2);
  717. }
  718. );
  719. let commonPrefix = prefixes[0];
  720. const backupArray = [];
  721. for (let i = 1; i < prefixes.length; i++) {
  722. let currentPrefix = '';
  723. for (let j = 0; j < Math.min(commonPrefix.length, prefixes[i].length); j++) {
  724. if (commonPrefix[j] === prefixes[i][j]) {
  725. currentPrefix += commonPrefix[j];
  726. backupArray.push(currentPrefix);
  727. } else {
  728. break;
  729. }
  730. }
  731. commonPrefix = currentPrefix;
  732. if (commonPrefix === '') {
  733. break;
  734. }
  735. }
  736. const uniqueBackupArray = Array.from(new Set(backupArray));
  737. let longestItem = '';
  738. for (const item of uniqueBackupArray) {
  739. if (item.length > longestItem.length) {
  740. longestItem = item;
  741. }
  742. }
  743. const tsLinesToDelete = tsLines.filter(line=>!line.startsWith(longestItem));
  744. const tsLinesToDeleteCount = tsLinesToDelete.length;
  745. if (tsLinesToDeleteCount / totalTsLines > 0.666) {
  746. return text;
  747. } else {
  748. const deletedLines = [];
  749. const newLines = [];
  750. let i = 0;
  751. while (i < lines.length) {
  752. if (lines[i].includes(tyad0) && i + 1 < lines.length && lines[i + 1].trim().match(tyad5)) {
  753. const tsLine = lines[i + 1];
  754. const fileName = tsLine.split('/').pop();
  755. if (tyad14.test(fileName)) {
  756. newLines.push(lines[i], lines[i + 1]);
  757. i += 2;
  758. } else if (!tsLine.startsWith(longestItem)) {
  759. deletedLines.push(lines[i], lines[i + 1]);
  760. i += 2;
  761. } else {
  762. newLines.push(lines[i], lines[i + 1]);
  763. i += 2;
  764. }
  765. } else {
  766. newLines.push(lines[i]);
  767. i += 1;
  768. }
  769. }
  770. try {
  771. if (!dypd.test(打印开关)) {
  772. if (deletedLines.length > 0) {
  773. try {
  774. console.log(logysa + logysq + deletedLines.reverse().map(line=>{
  775. return line.replace(new RegExp(tyad1022,'gi'), tsLink=>{
  776. if (!tsLink.startsWith('http')) {
  777. if (m3u8gglj) {
  778. return new URL(tsLink,m3u8gglj).href;
  779. } else {
  780. return tsLink;
  781. }
  782. } else {
  783. return tsLink;
  784. }
  785. }
  786. );
  787. }
  788. ).join('\n'), logysf, logysi);
  789. } catch (e) {}
  790. }
  791. }
  792. } catch (e) {}
  793. return endlist(newLines.join('\n'));
  794. }
  795. } else {
  796. return text;
  797. }
  798. } else {
  799. return text;
  800. }
  801. }
  802. }
  803. } else {
  804. return text;
  805. }
  806. } else {
  807. return text;
  808. }
  809. } catch (e) {
  810. return text;
  811. }
  812. }
  813. ;
  814. const proqcc = (text)=>{
  815. try {
  816. if (!shouldStopExecution) {
  817. if (text) {
  818. if (!itemm3u8.test(text)) {
  819. return text;
  820. } else {
  821. if (ggljbmd.test(text)) {
  822. shouldStopExecution = true;
  823. return text;
  824. } else {
  825. if (!shouldStopExecution) {
  826. let tsFileNameLength = 0;
  827. let tsFileNameLengthTolerance = 1;
  828. let firstExtInfRow = '';
  829. let extInfJudgeRowCounter = 0;
  830. let sameExtInfNameCounter = 0;
  831. let extInfBenchmarkCounter = 5;
  832. let previousTsNameIndex = -1;
  833. let firstTsNameIndex = -1;
  834. let tsType = 0;
  835. let extXMode = 0;
  836. let violentFilterModeFlag = false;
  837. let result = [];
  838. let deletedLines = [];
  839. const numberBeforeTsRegex = new RegExp('(\\d+)' + tyad5,'i');
  840. const tsExtensionRegex = new RegExp(tyad5,'i');
  841. const lines = text.split('\n');
  842. function extractNumberBeforeTs(str) {
  843. const match = numberBeforeTsRegex.exec(str);
  844. if (match) {
  845. return parseInt(match[1], 10);
  846. }
  847. return null;
  848. }
  849. ;function getTsIndex(str) {
  850. const match = tsExtensionRegex.exec(str);
  851. if (match) {
  852. return match.index;
  853. }
  854. return -1;
  855. }
  856. ;if (violentFilterModeFlag) {
  857. tsType = 2;
  858. } else {
  859. let normalIntTsCounter = 0;
  860. let diffIntTsCounter = 0;
  861. let lastTsNameLength = 0;
  862. for (let i = 0; i < lines.length; i++) {
  863. const line = lines[i];
  864. if (extInfJudgeRowCounter === 0 && line.startsWith(tyad0)) {
  865. firstExtInfRow = line;
  866. extInfJudgeRowCounter++;
  867. } else if (extInfJudgeRowCounter === 1 && line.startsWith(tyad0)) {
  868. if (line !== firstExtInfRow) {
  869. firstExtInfRow = '';
  870. }
  871. extInfJudgeRowCounter++;
  872. }
  873. let currentTsNameLength = getTsIndex(line);
  874. if (currentTsNameLength > 0) {
  875. if (extInfJudgeRowCounter === 1) {
  876. tsFileNameLength = currentTsNameLength;
  877. }
  878. lastTsNameLength = currentTsNameLength;
  879. let tsNameIndex = extractNumberBeforeTs(line);
  880. if (tsNameIndex === null) {
  881. if (extInfJudgeRowCounter === 1) {
  882. tsType = 1;
  883. } else if (extInfJudgeRowCounter === 2 && (tsType === 1 || currentTsNameLength === tsFileNameLength)) {
  884. tsType = 1;
  885. break;
  886. } else {
  887. diffIntTsCounter++;
  888. }
  889. } else {
  890. if (normalIntTsCounter === 0) {
  891. previousTsNameIndex = tsNameIndex;
  892. firstTsNameIndex = tsNameIndex;
  893. previousTsNameIndex = firstTsNameIndex - 1;
  894. }
  895. if (currentTsNameLength !== tsFileNameLength) {
  896. if (currentTsNameLength === lastTsNameLength + 1 && tsNameIndex === previousTsNameIndex + 1) {
  897. if (diffIntTsCounter) {
  898. if (tsNameIndex === previousTsNameIndex + 1) {
  899. tsType = 0;
  900. previousTsNameIndex = firstTsNameIndex - 1;
  901. break;
  902. } else {
  903. tsType = 2;
  904. break;
  905. }
  906. }
  907. normalIntTsCounter++;
  908. previousTsNameIndex = tsNameIndex;
  909. } else {
  910. diffIntTsCounter++;
  911. }
  912. } else {
  913. if (diffIntTsCounter) {
  914. if (tsNameIndex === previousTsNameIndex + 1) {
  915. tsType = 0;
  916. previousTsNameIndex = firstTsNameIndex - 1;
  917. break;
  918. } else {
  919. tsType = 2;
  920. break;
  921. }
  922. }
  923. normalIntTsCounter++;
  924. previousTsNameIndex = tsNameIndex;
  925. }
  926. }
  927. }
  928. if (i === lines.length - 1) {
  929. tsType = 2;
  930. }
  931. }
  932. }
  933. for (let i = 0; i < lines.length; i++) {
  934. const line = lines[i];
  935. if (tsType === 0) {
  936. if (line.startsWith(tyad2) && lines[i + 1] && lines[i + 2]) {
  937. if (i > 0 && lines[i - 1].startsWith(tyad15)) {
  938. result.push(line);
  939. continue;
  940. } else {
  941. let currentTsNameLength = getTsIndex(lines[i + 2]);
  942. if (currentTsNameLength > 0) {
  943. if (currentTsNameLength - tsFileNameLength > tsFileNameLengthTolerance) {
  944. if (lines[i + 3] && lines[i + 3].startsWith(tyad2)) {
  945. deletedLines.push(lines[i], lines[i + 1], lines[i + 2], lines[i + 3]);
  946. i += 3;
  947. } else {
  948. deletedLines.push(lines[i], lines[i + 1], lines[i + 2]);
  949. i += 2;
  950. }
  951. continue;
  952. } else {
  953. tsFileNameLength = currentTsNameLength;
  954. }
  955. let currentTsNameIndex = extractNumberBeforeTs(lines[i + 2]);
  956. if (currentTsNameIndex !== previousTsNameIndex + 1) {
  957. if (lines[i + 3] && lines[i + 3].startsWith(tyad2)) {
  958. deletedLines.push(lines[i], lines[i + 1], lines[i + 2], lines[i + 3]);
  959. i += 3;
  960. } else {
  961. deletedLines.push(lines[i], lines[i + 1], lines[i + 2]);
  962. i += 2;
  963. }
  964. continue;
  965. }
  966. }
  967. }
  968. }
  969. if (line.startsWith(tyad0) && lines[i + 1]) {
  970. let currentTsNameLength = getTsIndex(lines[i + 1]);
  971. if (currentTsNameLength > 0) {
  972. if (currentTsNameLength - tsFileNameLength > tsFileNameLengthTolerance) {
  973. if (lines[i + 2] && lines[i + 2].startsWith(tyad2)) {
  974. deletedLines.push(lines[i], lines[i + 1], lines[i + 2]);
  975. i += 2;
  976. } else {
  977. deletedLines.push(lines[i], lines[i + 1]);
  978. i += 1;
  979. }
  980. continue;
  981. } else {
  982. tsFileNameLength = currentTsNameLength;
  983. }
  984. let currentTsNameIndex = extractNumberBeforeTs(lines[i + 1]);
  985. if (currentTsNameIndex === previousTsNameIndex + 1) {
  986. previousTsNameIndex++;
  987. } else {
  988. if (lines[i + 2].startsWith(tyad2)) {
  989. deletedLines.push(lines[i], lines[i + 1], lines[i + 2]);
  990. i += 2;
  991. } else {
  992. deletedLines.push(lines[i], lines[i + 1]);
  993. i += 1;
  994. }
  995. continue;
  996. }
  997. }
  998. }
  999. } else if (tsType === 1) {
  1000. if (line.startsWith(tyad0)) {
  1001. if (line === firstExtInfRow && sameExtInfNameCounter <= extInfBenchmarkCounter && extXMode === 0) {
  1002. sameExtInfNameCounter++;
  1003. } else {
  1004. extXMode = 1;
  1005. }
  1006. if (sameExtInfNameCounter > extInfBenchmarkCounter) {
  1007. extXMode = 1;
  1008. }
  1009. }
  1010. if (line.startsWith(tyad2)) {
  1011. if (i > 0 && lines[i - 1].startsWith(tyad15)) {
  1012. result.push(line);
  1013. continue;
  1014. } else {
  1015. if (lines[i + 1] && lines[i + 1].startsWith(tyad0) && lines[i + 2] && getTsIndex(lines[i + 2]) > 0) {
  1016. let extXDiscontinuityConditionFlag = false;
  1017. if (extXMode === 1) {
  1018. extXDiscontinuityConditionFlag = lines[i + 1] !== firstExtInfRow && sameExtInfNameCounter > extInfBenchmarkCounter;
  1019. }
  1020. if (lines[i + 3] && lines[i + 3].startsWith(tyad2) && extXDiscontinuityConditionFlag) {
  1021. deletedLines.push(lines[i], lines[i + 1], lines[i + 2], lines[i + 3]);
  1022. i += 3;
  1023. }
  1024. continue;
  1025. }
  1026. }
  1027. }
  1028. } else {
  1029. if (line.startsWith(tyad2)) {
  1030. if (i > 0 && lines[i - 1].startsWith(tyad15)) {
  1031. result.push(line);
  1032. continue;
  1033. } else {
  1034. continue;
  1035. }
  1036. }
  1037. }
  1038. result.push(line);
  1039. }
  1040. try {
  1041. if (!dypd.test(打印开关)) {
  1042. if (deletedLines.length > 0) {
  1043. try {
  1044. console.log(logysa + logysq + deletedLines.reverse().map(line=>{
  1045. return line.replace(new RegExp(tyad1022,'gi'), tsLink=>{
  1046. if (!tsLink.startsWith('http')) {
  1047. if (m3u8gglj) {
  1048. return new URL(tsLink,m3u8gglj).href;
  1049. } else {
  1050. return tsLink;
  1051. }
  1052. } else {
  1053. return tsLink;
  1054. }
  1055. }
  1056. );
  1057. }
  1058. ).join('\n'), logysf, logysi);
  1059. } catch (e) {}
  1060. }
  1061. }
  1062. } catch (e) {}
  1063. return endlist(result.join('\n'));
  1064. } else {
  1065. return text;
  1066. }
  1067. }
  1068. }
  1069. } else {
  1070. return text;
  1071. }
  1072. } else {
  1073. return text;
  1074. }
  1075. } catch (e) {
  1076. return text;
  1077. }
  1078. }
  1079. ;
  1080. const removeprunerm3u8a = (text)=>{
  1081. try {
  1082. if (!shouldStopExecution) {
  1083. if (text) {
  1084. if (!itemm3u8.test(text)) {
  1085. return text;
  1086. } else {
  1087. if (ggljbmd.test(text)) {
  1088. shouldStopExecution = true;
  1089. return text;
  1090. } else {
  1091. let deletedContent = '';
  1092. text = text.replace(itemstygza6, (match)=>{
  1093. deletedContent += match + '\n';
  1094. return '';
  1095. }
  1096. );
  1097. try {
  1098. if (deletedContent.trim() !== '') {
  1099. if (!dypd.test(打印开关)) {
  1100. console.log(logysa + logysk + deletedContent, logysf, logysi);
  1101. }
  1102. }
  1103. } catch (e) {}
  1104. return endlist(text);
  1105. }
  1106. }
  1107. } else {
  1108. return text;
  1109. }
  1110. } else {
  1111. return text;
  1112. }
  1113. } catch (e) {
  1114. return text;
  1115. }
  1116. }
  1117. ;
  1118. const removeprunerm3u8b = (text)=>{
  1119. try {
  1120. if (!shouldStopExecution) {
  1121. if (text) {
  1122. if (!itemm3u8.test(text)) {
  1123. return text;
  1124. } else {
  1125. if (ggljbmd.test(text)) {
  1126. shouldStopExecution = true;
  1127. return text;
  1128. } else {
  1129. let deletedContent = '';
  1130. let addedMatches = new Set();
  1131. text = text.replace(itemstygza7, (match)=>{
  1132. match = match.trim();
  1133. if (!addedMatches.has(match) && match !== '') {
  1134. deletedContent += match + '\n';
  1135. addedMatches.add(match);
  1136. }
  1137. return '';
  1138. }
  1139. );
  1140. try {
  1141. if (deletedContent.trim() !== '') {
  1142. if (!dypd.test(打印开关)) {
  1143. console.log(logysa + logysk + deletedContent, logysf, logysi);
  1144. }
  1145. }
  1146. } catch (e) {}
  1147. return endlist(text);
  1148. }
  1149. }
  1150. } else {
  1151. return text;
  1152. }
  1153. } else {
  1154. return text;
  1155. }
  1156. } catch (e) {
  1157. return text;
  1158. }
  1159. }
  1160. ;
  1161. const removeprunerm3u8c = (text)=>{
  1162. try {
  1163. if (!shouldStopExecution) {
  1164. if (text) {
  1165. if (!itemm3u8.test(text)) {
  1166. return text;
  1167. } else {
  1168. if (ggljbmd.test(text)) {
  1169. shouldStopExecution = true;
  1170. return text;
  1171. } else {
  1172. const lines = text.split('\n');
  1173. const extinfLines = lines.filter(line=>tyad11.test(line));
  1174. const extinfValues = extinfLines.map(line=>parseFloat(line.split(':')[1].split(',')[0]));
  1175. const valueCounts = extinfValues.reduce((acc,value)=>{
  1176. acc[value] = (acc[value] || 0) + 1;
  1177. return acc;
  1178. }
  1179. , {});
  1180. const maxCount = Math.max(...Object.values(valueCounts));
  1181. const maxValue = Object.keys(valueCounts).find(key=>valueCounts[key] === maxCount);
  1182. const maxValueRatio = maxCount / extinfValues.length;
  1183. let deletedLines = [];
  1184. if (maxValueRatio > 0.987) {
  1185. const newLines = [];
  1186. let skipNextTs = false;
  1187. for (let i = 0; i < lines.length; i++) {
  1188. if (tyad11.test(lines[i])) {
  1189. if (firstExtinf) {
  1190. firstExtinf = false;
  1191. newLines.push(lines[i]);
  1192. skipNextTs = false;
  1193. } else if (i === lines.length - 1 || !tyad11.test(lines[i + 1])) {
  1194. lastExtinf = true;
  1195. newLines.push(lines[i]);
  1196. skipNextTs = false;
  1197. } else {
  1198. const value = parseFloat(lines[i].split(':')[1].split(',')[0]);
  1199. if (value != maxValue) {
  1200. deletedLines.push(lines[i], lines[i + 1]);
  1201. skipNextTs = true;
  1202. } else {
  1203. newLines.push(lines[i]);
  1204. skipNextTs = false;
  1205. }
  1206. }
  1207. } else if (skipNextTs) {
  1208. skipNextTs = false;
  1209. } else {
  1210. newLines.push(lines[i]);
  1211. }
  1212. }
  1213. if (deleteCount > maxValueRatio * extinfValues.length) {
  1214. return text;
  1215. } else {
  1216. text = endlist(newLines.join('\n'));
  1217. }
  1218. }
  1219. try {
  1220. if (deletedLines.length > 0) {
  1221. if (!dypd.test(打印开关)) {
  1222. console.log(logysa + logysl + deletedLines.map(line=>{
  1223. return line.replace(new RegExp(tyad1022,'gi'), tsLink=>{
  1224. if (!tsLink.startsWith('http')) {
  1225. if (m3u8gglj) {
  1226. return new URL(tsLink,m3u8gglj).href;
  1227. } else {
  1228. return tsLink;
  1229. }
  1230. } else {
  1231. return tsLink;
  1232. }
  1233. }
  1234. );
  1235. }
  1236. ).join('\n'), logysf, logysi);
  1237. }
  1238. }
  1239. } catch (e) {}
  1240. return text;
  1241. }
  1242. }
  1243. } else {
  1244. return text;
  1245. }
  1246. } else {
  1247. return text;
  1248. }
  1249. } catch (e) {
  1250. return text;
  1251. }
  1252. }
  1253. ;
  1254. const removeprunerm3u8d = (text)=>{
  1255. try {
  1256. if (!shouldStopExecution) {
  1257. if (text) {
  1258. if (!itemm3u8.test(text)) {
  1259. return text;
  1260. } else {
  1261. if (ggljbmd.test(text)) {
  1262. shouldStopExecution = true;
  1263. return text;
  1264. } else {
  1265. const lines = text.split('\n');
  1266. const urlLengths = [];
  1267. const urlsWithIndex = [];
  1268. lines.forEach((line,index)=>{
  1269. const match = line.match(new RegExp(tyad5 + '\\s*?$','i'));
  1270. if (match) {
  1271. urlsWithIndex.push({
  1272. url: line,
  1273. index
  1274. });
  1275. urlLengths.push(line.length);
  1276. }
  1277. }
  1278. );
  1279. const lengthCounts = urlLengths.reduce((acc,length)=>{
  1280. acc[length] = (acc[length] || 0) + 1;
  1281. return acc;
  1282. }
  1283. , {});
  1284. const total = urlLengths.length;
  1285. let dominantLength = null;
  1286. for (const length in lengthCounts) {
  1287. if (lengthCounts[length] / total >= 0.789) {
  1288. dominantLength = parseInt(length);
  1289. break;
  1290. }
  1291. }
  1292. let deletedUrls = [];
  1293. if (dominantLength !== null) {
  1294. urlsWithIndex.forEach(({url, index})=>{
  1295. if (url.length !== dominantLength && !tyad14.test(url)) {
  1296. deletedUrls.push(url);
  1297. }
  1298. }
  1299. );
  1300. if (deletedUrls.length > lengthCounts[dominantLength]) {
  1301. return text;
  1302. } else {
  1303. deletedUrls.forEach((url)=>{
  1304. const {index} = urlsWithIndex.find(u=>u.url === url);
  1305. if (index >= 0) {
  1306. lines.splice(index, 1);
  1307. if (index - 1 >= 0 && !new RegExp(tyad7,'i').test(lines[index - 1])) {
  1308. lines.splice(index - 1, 1);
  1309. }
  1310. }
  1311. }
  1312. );
  1313. }
  1314. }
  1315. if (deletedUrls.length > 0) {
  1316. if (!dypd.test(打印开关)) {
  1317. console.log(logysa + logysm + deletedUrls.map(line=>{
  1318. return line.replace(new RegExp(tyad1022,'gi'), tsLink=>{
  1319. if (!tsLink.startsWith('http')) {
  1320. if (m3u8gglj) {
  1321. return new URL(tsLink,m3u8gglj).href;
  1322. } else {
  1323. return tsLink;
  1324. }
  1325. } else {
  1326. return tsLink;
  1327. }
  1328. }
  1329. );
  1330. }
  1331. ).join('\n'), logysf, logysi);
  1332. }
  1333. }
  1334. return endlist(lines.join('\n'));
  1335. }
  1336. }
  1337. } else {
  1338. return text;
  1339. }
  1340. } else {
  1341. return text;
  1342. }
  1343. } catch (e) {
  1344. return text
  1345. }
  1346. }
  1347. ;
  1348. const removeprunerm3u8e = (text)=>{
  1349. try {
  1350. if (!shouldStopExecution) {
  1351. if (text) {
  1352. if (!itemm3u8.test(text)) {
  1353. return text;
  1354. } else {
  1355. if (ggljbmd.test(text)) {
  1356. shouldStopExecution = true;
  1357. return text;
  1358. } else {
  1359. const lines = text.split('\n');
  1360. const matchedLines = [];
  1361. const allLines = lines.map((line,index)=>({
  1362. line,
  1363. index
  1364. }));
  1365. allLines.forEach(item=>{
  1366. const match = item.line.match(tyad107);
  1367. if (match) {
  1368. matchedLines.push({
  1369. ...item,
  1370. matchedGroup: match[1]
  1371. });
  1372. }
  1373. }
  1374. );
  1375. if (matchedLines.length === 0) {
  1376. return text;
  1377. } else {
  1378. const matchedGroupCounts = {};
  1379. matchedLines.forEach(item=>{
  1380. matchedGroupCounts[item.matchedGroup] = (matchedGroupCounts[item.matchedGroup] || 0) + 1;
  1381. }
  1382. );
  1383. const minCount = Math.min(...Object.values(matchedGroupCounts));
  1384. const lessFrequentMatchedGroups = Object.keys(matchedGroupCounts).filter(group=>matchedGroupCounts[group] === minCount);
  1385. let filteredMatchedGroups = lessFrequentMatchedGroups.map(group=>{
  1386. const lastSlashIndex = group.lastIndexOf('/');
  1387. if (lastSlashIndex !== -1) {
  1388. group = group.substring(0, lastSlashIndex + 1);
  1389. }
  1390. if (!group.match(/^https?:\/\//) && !group.startsWith('/')) {
  1391. return null;
  1392. }
  1393. return group;
  1394. }
  1395. ).filter(group=>group !== null);
  1396. const totalMatched = matchedLines.length;
  1397. let dominantMatchedGroup;
  1398. for (const matchedGroup in matchedGroupCounts) {
  1399. if (matchedGroupCounts[matchedGroup] / totalMatched > 0.66) {
  1400. dominantMatchedGroup = matchedGroup;
  1401. break;
  1402. }
  1403. }
  1404. if (!dominantMatchedGroup) {
  1405. return text;
  1406. } else {
  1407. let diffCount = 0;
  1408. for (let i = allLines.length - 1; i >= 0; i--) {
  1409. if (allLines[i].line.startsWith(tyad0)) {
  1410. const nextLineIndex = i + 1;
  1411. let nextLine;
  1412. if (nextLineIndex < allLines.length) {
  1413. nextLine = allLines[nextLineIndex].line;
  1414. } else {
  1415. nextLine = undefined;
  1416. }
  1417. let match;
  1418. if (nextLine) {
  1419. match = nextLine.match(tyad107);
  1420. } else {
  1421. match = undefined;
  1422. }
  1423. if (!match || match[1] !== dominantMatchedGroup) {
  1424. diffCount++;
  1425. }
  1426. }
  1427. }
  1428. if (diffCount / totalMatched > 0.66) {
  1429. return text;
  1430. } else {
  1431. const deletedLines = [];
  1432. if (filteredMatchedGroups.length > 0) {
  1433. for (let i = allLines.length - 1; i >= 0; i--) {
  1434. if (allLines[i].line.startsWith(tyad0)) {
  1435. const nextLineIndex = i + 1;
  1436. let nextLine;
  1437. if (nextLineIndex < allLines.length) {
  1438. nextLine = allLines[nextLineIndex].line;
  1439. } else {
  1440. nextLine = undefined;
  1441. }
  1442. const cleanedNextLine = nextLine ? nextLine.replace(new RegExp(tyad5 + '.*?$','i'), '') : '';
  1443. if (!tyad10.test(cleanedNextLine)) {
  1444. const isFilteredMatched = filteredMatchedGroups.some(group=>nextLine && nextLine.startsWith(group));
  1445. if (isFilteredMatched) {
  1446. deletedLines.push(nextLine);
  1447. deletedLines.push(allLines[i].line);
  1448. allLines.splice(i, 2);
  1449. }
  1450. }
  1451. }
  1452. }
  1453. } else {
  1454. for (let i = allLines.length - 1; i >= 0; i--) {
  1455. if (allLines[i].line.startsWith(tyad0)) {
  1456. const nextLineIndex = i + 1;
  1457. let nextLine;
  1458. if (nextLineIndex < allLines.length) {
  1459. nextLine = allLines[nextLineIndex].line;
  1460. } else {
  1461. nextLine = undefined;
  1462. }
  1463. const cleanedNextLine = nextLine ? nextLine.replace(new RegExp(tyad5 + '.*?$','i'), '') : '';
  1464. let match;
  1465. if (nextLine) {
  1466. match = nextLine.match(tyad107);
  1467. } else {
  1468. match = undefined;
  1469. }
  1470. if (!match || match[1] !== dominantMatchedGroup) {
  1471. if (!tyad10.test(cleanedNextLine)) {
  1472. deletedLines.push(nextLine);
  1473. deletedLines.push(allLines[i].line);
  1474. allLines.splice(i, 2);
  1475. }
  1476. }
  1477. }
  1478. }
  1479. }
  1480. const tsToDeleteCount = deletedLines.length / 2;
  1481. if (tsToDeleteCount > totalMatched) {
  1482. return text;
  1483. } else {
  1484. try {
  1485. if (deletedLines.length > 0) {
  1486. try {
  1487. if (!dypd.test(打印开关)) {
  1488. console.log(logysa + logysn + deletedLines.reverse().map(line=>{
  1489. return line.replace(new RegExp(tyad1022,'gi'), tsLink=>{
  1490. if (!tsLink.startsWith('http')) {
  1491. if (m3u8gglj) {
  1492. return new URL(tsLink,m3u8gglj).href;
  1493. } else {
  1494. return tsLink;
  1495. }
  1496. } else {
  1497. return tsLink;
  1498. }
  1499. }
  1500. );
  1501. }
  1502. ).join('\n'), logysf, logysi);
  1503. }
  1504. } catch (e) {}
  1505. }
  1506. } catch (e) {}
  1507. return endlist(allLines.map(item=>item.line).join('\n'));
  1508. }
  1509. }
  1510. }
  1511. }
  1512. }
  1513. }
  1514. } else {
  1515. return text;
  1516. }
  1517. } else {
  1518. return text;
  1519. }
  1520. } catch (e) {
  1521. return text;
  1522. }
  1523. }
  1524. ;
  1525. const prunerm3u8 = (text)=>{
  1526. try {
  1527. if (!shouldStopExecution) {
  1528. if (text) {
  1529. if (!itemm3u8.test(text)) {
  1530. return text;
  1531. } else {
  1532. if (ggljbmd.test(text)) {
  1533. shouldStopExecution = true;
  1534. return text;
  1535. } else {
  1536. if (!shouldStopExecution) {
  1537. const lines = text.split('\n');
  1538. const keyCount = lines.filter(line=>new RegExp(tyad1021,'i').test(line)).length;
  1539. if (keyCount >= 2) {
  1540. return text;
  1541. } else {
  1542. let discontinuityCount = 0;
  1543. const filteredLines = lines.filter(line=>{
  1544. if (new RegExp(tyad2,'i').test(line)) {
  1545. discontinuityCount++;
  1546. return false;
  1547. }
  1548. return true;
  1549. }
  1550. );
  1551. try {
  1552. if (!dypd.test(打印开关)) {
  1553. if (discontinuityCount > 1) {
  1554. console.log(logysa + logysj + "-已经发现] ✂" + '已删除《' + discontinuityCount + '》个' + tyad2 + logysj, logysf);
  1555. }
  1556. }
  1557. } catch (e) {}
  1558. return endlist(removeprunerm3u8a(filteredLines.join('\n')));
  1559. }
  1560. } else {
  1561. return text;
  1562. }
  1563. }
  1564. }
  1565. } else {
  1566. return text;
  1567. }
  1568. } else {
  1569. return text;
  1570. }
  1571. } catch (e) {
  1572. return text;
  1573. }
  1574. }
  1575. ;
  1576. let realFetch = self.fetch;
  1577. self.fetch = new Proxy(self.fetch,{
  1578. apply: function(target, thisArg, args) {
  1579. try {
  1580. let url = urlFromArg(args[0]);
  1581. let item = matchM3u(url);
  1582. if (item) {
  1583. if (ggljbmd.test(url) || shouldStopExecution) {
  1584. shouldStopExecution = true;
  1585. return Reflect.apply(target, thisArg, args);
  1586. } else {
  1587. m3u8gglj = url;
  1588. try {
  1589. if (isValidM3U8Url(m3u8gglj)) {
  1590. m3u8bflj = m3u8gglj;
  1591. try {
  1592. console.clear();
  1593. } catch (e) {}
  1594. console.log("播放链接:" + m3u8bflj);
  1595. }
  1596. } catch (e) {}
  1597. if (!shouldStopExecution) {
  1598. return realFetch.apply(thisArg, args).then(realResponse=>{
  1599. try {
  1600. if (!realResponse || !realResponse.ok) {
  1601. return realResponse;
  1602. } else {
  1603. return realResponse.text().then(textin=>{
  1604. try {
  1605. if (M3umatch(textin)) {
  1606. return realResponse;
  1607. } else {
  1608. if (!new RegExp(tyad5,'i').test(textin)) {
  1609. return realResponse;
  1610. } else {
  1611. if (!tyad1051.test(textin)) {
  1612. return realResponse;
  1613. } else {
  1614. let textout = proqca(textin, item);
  1615. try {
  1616. textout = proqcb(textout);
  1617. } catch (e) {}
  1618. try {
  1619. textout = proqcc(textout);
  1620. } catch (e) {}
  1621. try {
  1622. textout = prunerm3u8(textout);
  1623. } catch (e) {}
  1624. try {
  1625. textout = removeprunerm3u8e(textout);
  1626. } catch (e) {}
  1627. try {
  1628. textout = removeprunerm3u8b(textout);
  1629. } catch (e) {}
  1630. try {
  1631. textout = removeprunerm3u8c(textout);
  1632. } catch (e) {}
  1633. try {
  1634. textout = removeprunerm3u8d(textout);
  1635. } catch (e) {}
  1636. try {
  1637. textout = durationtaragt(textout);
  1638. } catch (e) {}
  1639. try {
  1640. textout = taragtduration(textout);
  1641. } catch (e) {}
  1642. try {
  1643. textout = endlist(textout);
  1644. } catch (e) {}
  1645. /*console.log("realFetch测试广告:\n"+textout);*/
  1646. try {
  1647. if (M3umatch(textout)) {
  1648. return realResponse;
  1649. }
  1650. } catch (e) {}
  1651. if (textout !== textin) {
  1652. return new Response(textout,{
  1653. status: realResponse.status,
  1654. statusText: realResponse.statusText,
  1655. headers: realResponse.headers
  1656. });
  1657. } else {
  1658. return realResponse;
  1659. }
  1660. }
  1661. }
  1662. }
  1663. } catch (e) {
  1664. return realResponse;
  1665. }
  1666. }
  1667. );
  1668. }
  1669. } catch (e) {
  1670. return realResponse;
  1671. }
  1672. }
  1673. );
  1674. } else {
  1675. return Reflect.apply(target, thisArg, args);
  1676. }
  1677. }
  1678. } else {
  1679. return Reflect.apply(target, thisArg, args);
  1680. }
  1681. } catch (e) {
  1682. return Reflect.apply(target, thisArg, args);
  1683. }
  1684. }
  1685. });
  1686. let originalOpen = self.XMLHttpRequest.prototype.open;
  1687. self.XMLHttpRequest.prototype.open = new Proxy(self.XMLHttpRequest.prototype.open,{
  1688. apply: async function(target, thisArg, args) {
  1689. try {
  1690. if (!shouldStopExecution) {
  1691. let url = urlFromArg(args[1]);
  1692. let item = matchM3u(url);
  1693. if (item) {
  1694. if (ggljbmd.test(url) || shouldStopExecution) {
  1695. shouldStopExecution = true;
  1696. return Reflect.apply(target, thisArg, args);
  1697. } else {
  1698. m3u8gglj = url;
  1699. try {
  1700. if (isValidM3U8Url(m3u8gglj)) {
  1701. m3u8bflj = m3u8gglj;
  1702. try {
  1703. console.clear();
  1704. } catch (e) {}
  1705. console.log("播放链接:" + m3u8bflj);
  1706. }
  1707. } catch (e) {}
  1708. try {
  1709. thisArg.addEventListener('readystatechange', async function() {
  1710. try {
  1711. if (thisArg.readyState !== 4) {
  1712. return;
  1713. } else {
  1714. const type = thisArg.responseType;
  1715. if (type !== '' && type !== 'text') {
  1716. return;
  1717. } else {
  1718. let textin = thisArg.responseText;
  1719. try {
  1720. if (M3umatch(textin)) {
  1721. return;
  1722. }
  1723. } catch (e) {}
  1724. if (!new RegExp(tyad5,'i').test(textin)) {
  1725. return;
  1726. } else {
  1727. if (!tyad1051.test(textin)) {
  1728. return;
  1729. } else {
  1730. let textout = proqca(textin, item);
  1731. try {
  1732. textout = proqcb(textout);
  1733. } catch (e) {}
  1734. try {
  1735. textout = proqcc(textout);
  1736. } catch (e) {}
  1737. try {
  1738. textout = prunerm3u8(textout);
  1739. } catch (e) {}
  1740. try {
  1741. textout = removeprunerm3u8e(textout);
  1742. } catch (e) {}
  1743. try {
  1744. textout = removeprunerm3u8b(textout);
  1745. } catch (e) {}
  1746. try {
  1747. textout = removeprunerm3u8c(textout);
  1748. } catch (e) {}
  1749. try {
  1750. textout = removeprunerm3u8d(textout);
  1751. } catch (e) {}
  1752. try {
  1753. textout = durationtaragt(textout);
  1754. } catch (e) {}
  1755. try {
  1756. textout = taragtduration(textout);
  1757. } catch (e) {}
  1758. try {
  1759. textout = endlist(textout);
  1760. } catch (e) {}
  1761. /*console.log("originalOpen测试广告:\n"+textout);*/
  1762. try {
  1763. if (M3umatch(textout)) {
  1764. return;
  1765. }
  1766. } catch (e) {}
  1767. if (textout !== textin) {
  1768. Reflect.defineProperty(thisArg, 'response', {
  1769. value: textout
  1770. });
  1771. Reflect.defineProperty(thisArg, 'responseText', {
  1772. value: textout
  1773. });
  1774. } else {
  1775. return;
  1776. }
  1777. }
  1778. }
  1779. }
  1780. }
  1781. } catch (e) {
  1782. return;
  1783. }
  1784. });
  1785. } catch (e) {}
  1786. return Reflect.apply(target, thisArg, args);
  1787. }
  1788. } else {
  1789. return Reflect.apply(target, thisArg, args);
  1790. }
  1791. } else {
  1792. return Reflect.apply(target, thisArg, args);
  1793. }
  1794. } catch (e) {
  1795. return Reflect.apply(target, thisArg, args);
  1796. }
  1797. }
  1798. });
  1799. }
  1800. } catch (e) {}
  1801. } else {
  1802. alert("当前浏览器不支持 Proxy,无法执行相关功能。");
  1803. }
  1804. } catch (e) {}
  1805. }
  1806. } catch (e) {}
  1807. }
  1808. )();