浏览代码

Perf: improve reject regex / regex sorting

SukkaW 1 年之前
父节点
当前提交
cbb22f3b16

+ 47 - 38
Build/build-mitm-hostname.js → Build/build-mitm-hostname.ts

@@ -1,16 +1,21 @@
-const fsPromises = require('fs').promises;
-const pathFn = require('path');
-const table = require('table');
-const listDir = require('@sukka/listdir');
-const { green, yellow } = require('picocolors');
+import { readFileByLine } from './lib/fetch-text-by-line';
+import fsPromises from 'fs/promises';
+import pathFn from 'path';
+import table from 'table';
+import listDir from '@sukka/listdir';
+import { green, yellow } from 'picocolors';
+import { processLineFromReadline } from './lib/process-line';
+import { getHostname } from 'tldts';
 
 const PRESET_MITM_HOSTNAMES = [
   // '*baidu.com',
-  '*ydstatic.com',
+  '*.ydstatic.com',
   // '*snssdk.com',
-  '*musical.com',
+  // '*musical.com',
   // '*musical.ly',
   // '*snssdk.ly',
+  'api.zhihu.com',
+  'www.zhihu.com',
   'api.chelaile.net.cn',
   'atrace.chelaile.net.cn',
   '*.meituan.net',
@@ -20,8 +25,15 @@ const PRESET_MITM_HOSTNAMES = [
   'ctrl.zmzapi.net',
   'api.zhuishushenqi.com',
   'b.zhuishushenqi.com',
-  '*.music.126.net',
-  '*.prod.hosts.ooklaserver.net'
+  'ggic.cmvideo.cn',
+  'ggic2.cmvideo.cn',
+  'mrobot.pcauto.com.cn',
+  'mrobot.pconline.com.cn',
+  'home.umetrip.com',
+  'discardrp.umetrip.com',
+  'startup.umetrip.com',
+  'dsp-x.jd.com',
+  'bdsp-x.jd.com'
 ];
 
 (async () => {
@@ -51,7 +63,7 @@ const PRESET_MITM_HOSTNAMES = [
       }))
   );
 
-  const bothWwwApexDomains = [];
+  const bothWwwApexDomains: Array<{ origin: string, processed: string }> = [];
   urlRegexPaths = urlRegexPaths.map(i => {
     if (!i.processed.includes('{www or not}')) return i;
 
@@ -70,10 +82,13 @@ const PRESET_MITM_HOSTNAMES = [
   urlRegexPaths.push(...bothWwwApexDomains);
 
   await Promise.all(rulesets.map(async file => {
-    const content = (await fsPromises.readFile(pathFn.join(folderListPath, file), { encoding: 'utf-8' })).split('\n');
+    const content = await processLineFromReadline(readFileByLine(pathFn.join(folderListPath, file)));
     urlRegexPaths.push(
       ...content
-        .filter(i => i.startsWith('URL-REGEX'))
+        .filter(i => (
+          i.startsWith('URL-REGEX')
+          && !i.includes('http://')
+        ))
         .map(i => i.split(',')[1])
         .map(i => ({
           origin: i,
@@ -81,6 +96,7 @@ const PRESET_MITM_HOSTNAMES = [
             .replaceAll('^https?://', '')
             .replaceAll('^https://', '')
             .replaceAll('^http://', '')
+            .split('/')[0]
             .replaceAll('\\.', '.')
             .replaceAll('.+', '*')
             .replaceAll('\\d', '*')
@@ -95,21 +111,21 @@ const PRESET_MITM_HOSTNAMES = [
   }));
 
   const mitmDomains = new Set(PRESET_MITM_HOSTNAMES); // Special case for parsed failed
-  const parsedFailures = [];
+  const parsedFailures = new Set();
 
   const dedupedUrlRegexPaths = [...new Set(urlRegexPaths)];
 
   dedupedUrlRegexPaths.forEach(i => {
-    const result = parseDomain(i.processed);
+    const result = getHostnameSafe(i.processed);
 
-    if (result.success) {
-      mitmDomains.add(result.hostname.trim());
+    if (result) {
+      mitmDomains.add(result);
     } else {
-      parsedFailures.add(i.origin);
+      parsedFailures.add(`${i.origin} ${i.processed} ${result}`);
     }
   });
 
-  const mitmDomainsRegExpArray = mitmDomains
+  const mitmDomainsRegExpArray = Array.from(mitmDomains)
     .slice()
     .filter(i => {
       return i.length > 3
@@ -128,21 +144,21 @@ const PRESET_MITM_HOSTNAMES = [
       );
     });
 
-  const parsedDomainsData = [];
+  const parsedDomainsData: Array<[string, string]> = [];
   dedupedUrlRegexPaths.forEach(i => {
-    const result = parseDomain(i.processed);
+    const result = getHostnameSafe(i.processed);
 
-    if (result.success) {
-      if (matchWithRegExpArray(result.hostname.trim(), mitmDomainsRegExpArray)) {
-        parsedDomainsData.push([green(result.hostname), i.origin]);
+    if (result) {
+      if (matchWithRegExpArray(result, mitmDomainsRegExpArray)) {
+        parsedDomainsData.push([green(result), i.origin]);
       } else {
-        parsedDomainsData.push([yellow(result.hostname), i.origin]);
+        parsedDomainsData.push([yellow(result), i.origin]);
       }
     }
   });
 
   console.log('Mitm Hostnames:');
-  console.log(`hostname = %APPEND% ${mitmDomains.join(', ')}`);
+  console.log(`hostname = %APPEND% ${Array.from(mitmDomains).join(', ')}`);
   console.log('--------------------');
   console.log('Parsed Sucessed:');
   console.log(table.table(parsedDomainsData, {
@@ -159,21 +175,14 @@ const PRESET_MITM_HOSTNAMES = [
 })();
 
 /** Util function */
-function parseDomain(input) {
-  try {
-    const url = new URL(`https://${input}`);
-    return {
-      success: true,
-      hostname: url.hostname
-    };
-  } catch {
-    return {
-      success: false
-    };
-  }
+
+function getHostnameSafe(input: string) {
+  const res = getHostname(input);
+  if (res && /[^\s\w*.-]/.test(res)) return null;
+  return res;
 }
 
-function matchWithRegExpArray(input, regexps = []) {
+function matchWithRegExpArray(input: string, regexps: RegExp[] = []) {
   for (const r of regexps) {
     if (r.test(input)) return true;
   }

+ 26 - 5
Build/lib/create-file.ts

@@ -115,16 +115,37 @@ const sortTypeOrder: Record<string | typeof defaultSortTypeOrder, number> = {
   'USER-AGENT': 30,
   'PROCESS-NAME': 40,
   [defaultSortTypeOrder]: 50, // default sort order for unknown type
-  AND: 100,
-  OR: 100,
-  'IP-CIDR': 200,
-  'IP-CIDR6': 200
+  'URL-REGEX': 100,
+  AND: 300,
+  OR: 300,
+  'IP-CIDR': 400,
+  'IP-CIDR6': 400
 };
 // sort DOMAIN-SUFFIX and DOMAIN first, then DOMAIN-KEYWORD, then IP-CIDR and IP-CIDR6 if any
 export const sortRuleSet = (ruleSet: string[]) => ruleSet
   .map((rule) => {
     const type = collectType(rule);
-    return [type ? (type in sortTypeOrder ? sortTypeOrder[type] : sortTypeOrder[defaultSortTypeOrder]) : 10, rule] as const;
+    if (!type) {
+      return [10, rule] as const;
+    }
+    if (!(type in sortTypeOrder)) {
+      return [sortTypeOrder[defaultSortTypeOrder], rule] as const;
+    }
+    if (type === 'URL-REGEX') {
+      let extraWeight = 0;
+      if (rule.includes('.+') || rule.includes('.*')) {
+        extraWeight += 10;
+      }
+      if (rule.includes('|')) {
+        extraWeight += 1;
+      }
+
+      return [
+        sortTypeOrder[type] + extraWeight,
+        rule
+      ] as const;
+    }
+    return [sortTypeOrder[type], rule] as const;
   })
   .sort((a, b) => a[0] - b[0])
   .map(c => c[1]);

文件差异内容过多而无法显示
+ 0 - 0
Modules/sukka_mitm_hostnames.sgmodule


+ 1 - 4
Modules/sukka_url_rewrite.sgmodule

@@ -53,10 +53,7 @@
 
 # Special AD Block Section
 
-# >> Kugou
-^https?://(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})(\.(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})){3}/EcomResourceServer/AdPlayPage/adinfo - reject
-^https?://(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})(\.(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})){3}/MobileAdServer/ - reject
 # >> eLong
-^https?://(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})(\.(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})){3}/(adgateway|adv)/ - reject
+^https?://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/(adgateway|adv)/ - reject
 # >> NOMO
 ^https?://nomo.dafork.com/api/v3/iap/ios_product_list https://ruleset.skk.moe/Mock/nomo.json 302

+ 0 - 1
Source/domainset/reject_sukka.conf

@@ -747,7 +747,6 @@ pixel.wp.com
 .cloudflareinsights.com
 .histats.com
 .appmetrica.yandex.net
-.crazyegg.com
 trace2.rtbasia.com
 inside.rtbasia.com
 .atom-data.io

+ 1 - 0
Source/non_ip/domestic.conf

@@ -542,6 +542,7 @@ DOMAIN-SUFFIX,qichacha.com
 DOMAIN-SUFFIX,qdaily.com
 DOMAIN-SUFFIX,qidian.com
 DOMAIN-SUFFIX,qiniu.com
+DOMAIN-SUFFIX,qingcdn.com
 DOMAIN-SUFFIX,qyer.com
 DOMAIN-SUFFIX,qyerstatic.com
 DOMAIN-SUFFIX,ronghub.com

+ 38 - 101
Source/non_ip/reject.conf

@@ -73,7 +73,7 @@ DOMAIN-SUFFIX,openx.net
 DOMAIN-SUFFIX,crazyegg.com
 # DOMAIN-SUFFIX,mmstat.com -- break the ali app
 DOMAIN-SUFFIX,amplitude.com
-DOMAIN-KEYWORD,advertising.com
+DOMAIN-SUFFIX,advertising.com
 DOMAIN-KEYWORD,.net.daraz.
 DOMAIN-KEYWORD,.zooplus.
 
@@ -109,27 +109,21 @@ URL-REGEX,^https?://premiumyva\.appspot\.com/vmclickstoadvertisersite
 # URL-REGEX,^https?://s\.youtube\.com/api/stats/qoe?.*adformat
 
 # >> 4gtv
-URL-REGEX,^https?://service\.4gtv\.tv/4gtv/Data/GetAD
-URL-REGEX,^https?://service\.4gtv\.tv/4gtv/Data/ADLog
+URL-REGEX,^https?://service\.4gtv\.tv/4gtv/Data/(GetAD|ADLog)
 
 # >> Baidu
 URL-REGEX,^https?://cover\.baidu\.com/cover/page/dspSwitchAds/
 URL-REGEX,^https?://c\.tieba\.baidu\.com/c/s/splashSchedule
 URL-REGEX,^https?://issuecdn\.baidupcs\.com/issue/netdisk/guanggao/
 URL-REGEX,^https?://update\.pan\.baidu\.com/statistics
-URL-REGEX,^https?://c\.tieba\.baidu\.com/c/s/splashSchedule$
 
 # >> Bilibili
-URL-REGEX,^https?://app\.bilibili\.com/x/v\d/splash/
-URL-REGEX,^https?://app\.bilibili\.com/x/v2/param
-URL-REGEX,^https?://api\.bilibili\.com/x/v2/dm/ad
+URL-REGEX,^https?://app\.bilibili\.com/x/v\d/(splash/|param|dm/ad|dataflow/report)
 URL-REGEX,^https?://app\.bilibili\.com/x/resource/abtest
-URL-REGEX,^https?://app\.bilibili\.com/x/v2/dataflow/report
-URL-REGEX,^https?://api\.bilibili\.com/pgc/season/app/related/recommend\?
+URL-REGEX,^https?://api\.bilibili\.com/pgc/season/(rank/cn|app/related/recommend)
 URL-REGEX,^https?://manga\.bilibili\.com/twirp/comic\.v\d\.comic/(flash|Flash|ListFlash)
-URL-REGEX,^https?://app\.bilibili\.com/x/v2/search/(defaultword|hot|recommend|resource)
-URL-REGEX,^https?://app\.bilibili\.com/x/v2/rank.*rid=(168|5)
-URL-REGEX,^https?://api\.bilibili\.com/pgc/season/rank/cn
+URL-REGEX,^https?://app\.bilibili\.com/x/v\d/search/(defaultword|hot|recommend|resource)
+URL-REGEX,^https?://app\.bilibili\.com/x/v\d/rank.*rid=(168|5)
 
 DOMAIN-KEYWORD,-tracker.biliapi.net
 
@@ -180,8 +174,6 @@ URL-REGEX,^https?://mobile-pic\.cache\.iciba\.com/feeds_ad/
 URL-REGEX,^https?://service\.iciba\.com/popo/open/screens/v\d\?adjson
 
 # >> Netease
-URL-REGEX,^http://iad.*mat\.[a-z]*\.126\.net/\w+.(jpg|mp4)$
-URL-REGEX,^http://iad.*mat\.[a-z]*\.127\.net/\w+.(jpg|mp4)$
 URL-REGEX,^https?://client\.mail\.163\.com/apptrack/confinfo/searchMultiAds
 URL-REGEX,^https?://c\.m\.163\.com/nc/gl/
 URL-REGEX,^https?://dsp-impr2\.youdao\.com/adload.s\?
@@ -209,64 +201,50 @@ URL-REGEX,^https?://wbapp\.uve\.weibo\.com/wbapplua/wbpullad\.lua
 URL-REGEX,^https?://api\.k\.sohu\.com/api/news/adsense
 URL-REGEX,^https?://api\.tv\.sohu\.com/agg/api/app/config/bootstrap
 URL-REGEX,^https?://hui\.sohu\.com/predownload2/\?
-URL-REGEX,^https?://pic\.k\.sohu\.com/img8/wb/tj/
 URL-REGEX,^https?://s1\.api\.tv\.itc\.cn/v\d/mobile/control/switch\.json
 
 # >> JD
-URL-REGEX,^https?://dsp-x\.jd\.com/adx/
-URL-REGEX,^https?://bdsp-x\.jd\.com/adx/
+URL-REGEX,^https?://b?dsp-x\.jd\.com/adx/
 URL-REGEX,^https?://api\.m\.jd\.com/client\.action\?functionId=start
 URL-REGEX,^https?://ms\.jr\.jd\.com/gw/generic/base/na/m/adInfo
 
-# >> TikTok (include China / Internation Version)
-# URL-REGEX,^https://[a-z]{2}\.snssdk\.com/api/ad/
-
 # >> UC
 URL-REGEX,^https?://huichuan\.sm\.cn/jsad
 URL-REGEX,^https?://iflow\.uczzd\.cn/log/
 
-# > WeChat
-URL-REGEX,^https://mp\.weixin\.qq\.com/mp/getappmsgad
-
 # >> XiGuaVideo
-DOMAIN-KEYWORD,ad.ixigua.com
+DOMAIN-WILDCARD,*ad.ixigua.com
 
 # >> XiMaLaYa
-URL-REGEX,^https?://adse\.ximalaya\.com/[a-z]{4}/loading\?appid=
-URL-REGEX,^https?://adse\.ximalaya\.com/ting/feed\?appid=
-URL-REGEX,^https?://adse\.ximalaya\.com/ting/loading\?appid=
+URL-REGEX,^https?://adse\.ximalaya\.com/[a-z]{4}/(feed|loading)\?appid=
 URL-REGEX,^https?://adse\.ximalaya\.com/ting\?appid=
-URL-REGEX,^https?://fdfs\.xmcdn\.com/group21/M03/E7/3F/
-URL-REGEX,^https?://fdfs\.xmcdn\.com/group21/M0A/95/3B/
-URL-REGEX,^https?://fdfs\.xmcdn\.com/group22/M00/92/FF/
-URL-REGEX,^https?://fdfs\.xmcdn\.com/group22/M05/66/67/
-URL-REGEX,^https?://fdfs\.xmcdn\.com/group22/M07/76/54/
-URL-REGEX,^https?://fdfs\.xmcdn\.com/group23/M01/63/F1/
-URL-REGEX,^https?://fdfs\.xmcdn\.com/group23/M04/E5/F6/
-URL-REGEX,^https?://fdfs\.xmcdn\.com/group23/M07/81/F6/
-URL-REGEX,^https?://fdfs\.xmcdn\.com/group23/M0A/75/AA/
-URL-REGEX,^https?://fdfs\.xmcdn\.com/group24/M03/E6/09/
-URL-REGEX,^https?://fdfs\.xmcdn\.com/group24/M07/C4/3D/
-URL-REGEX,^https?://fdfs\.xmcdn\.com/group25/M05/92/D1/
 
 # >> Zhihu
 URL-REGEX,^https?://www\.zhihu\.com/terms/privacy/confirm
-URL-REGEX,^https?://api\.zhihu\.com/market/popover
-URL-REGEX,^https?://api\.zhihu\.com/search/(top|tab|preset)
-URL-REGEX,^https?://api\.zhihu\.com/(launch|ad-style-service|app_config|real_time|ab/api)
-URL-REGEX,^https?://api\.zhihu\.com/commercial_api/(launch|real_time)
+URL-REGEX,^https?://api\.zhihu\.com/(market/popover|launch|ad-style-service|app_config|real_time|ab/api|commercial_api/launch|commercial_api/real_time|search/top|search/tab)
 URL-REGEX,^https?://(api|www)\.zhihu\.com/.*(featured-comment-ad|recommendations|community-ad)
 URL-REGEX,^https?://(api|www)\.zhihu\.com/(fringe|adx|commercial|ad-style-service|banners|mqtt)
 
 # >> 58
 URL-REGEX,^https?://.+\.58cdn\.com\.cn/brandads/
-URL-REGEX,^https?://app\.58\.com/api/home/(advertising|appadv)/
-URL-REGEX,^https?://app\.58\.com/api/home/invite/popupAdv
+URL-REGEX,^https?://app\.58\.com/api/home/(advertising/|appadv/|invite/popupAdv)
 URL-REGEX,^https?://app\.58\.com/api/log/
 
 # >> Acfun
 URL-REGEX,^https?://aes\.acfun\.cn/s\?adzones
 
+# >> Alibaba (Taobao Group)
+# KouBei
+URL-REGEX,^https?://acs\.m\.taobao\.com/gw/mtop\.o2o\.ad\.gateway\.get/
+# Fliggy
+URL-REGEX,^https?://acs\.m\.taobao\.com/gw/mtop\.trip\.activity\.querytmsresources/
+# Xian Yu
+URL-REGEX,^https?://acs\.m\.taobao\.com/gw/mtop\.taobao\.idle\.home\.welcome/
+# TaoPiaoPiao
+URL-REGEX,^https?://acs\.m\.taobao\.com/gw/mtop\.film\.mtopadvertiseapi\.queryadvertise/
+# Xiami music
+URL-REGEX,^https?://acs\.m\.taobao\.com/gw/mtop\.alimusic\.common\.mobileservice\.startinit/
+
 # >> ByteDance
 # URL-REGEX,^https?://.+.(musical|snssdk)\.(com|ly)/(api|motor)/ad/
 # URL-REGEX,^https?://.+\.pstatp\.com/img/ad
@@ -278,7 +256,7 @@ URL-REGEX,^https?://nnapp\.cloudbae\.cn/mc/api/advert/
 # >> Aihuishou
 URL-REGEX,^https?://gw\.aihuishou\.com/app-portal/home/getadvertisement
 # >> AMap
-URL-REGEX,^https?://m\d{1}\.amap\.com/ws/valueadded/alimama/splash_screen/
+URL-REGEX,^https?://m\d\.amap\.com/ws/valueadded/alimama/splash_screen/
 # >> Baicizhan
 URL-REGEX,^https?://7n\.bczcdn\.com/launchad/
 # >> Baobao
@@ -312,10 +290,6 @@ URL-REGEX,^https?://api\.daydaycook\.com\.cn/daydaycook/server/ad/
 URL-REGEX,^https?://cms\.daydaycook\.com\.cn/api/cms/advertisement/
 # >> eLong
 URL-REGEX,^https?://mobile-api2011\.elong\.com/(adgateway|adv)/
-# >> Facebook
-URL-REGEX,^https?://www\.facebook\.com/.+video_click_to_advertiser_site
-# >> Fliggy
-URL-REGEX,^https?://acs\.m\.taobao\.com/gw/mtop\.trip\.activity\.querytmsresources/
 # >> Flyer Tea
 URL-REGEX,^https?://www\.flyertea\.com/source/plugin/mobile/mobile\.php\?module=advis
 # >> Foodie
@@ -329,10 +303,7 @@ URL-REGEX,^https?://m\.ibuscloud\.com/v\d/app/getStartPage
 # >> Hangzhou Citizen Card
 URL-REGEX,^https?://smkmp\.96225\.com/smkcenter/ad/
 # >> Hupu
-URL-REGEX,^https?://games\.mobileapi\.hupu\.com/.+/(interfaceAdMonitor|interfaceAd)/
-URL-REGEX,^https?://games\.mobileapi\.hupu\.com/.+/status/init
-# >> Xian Yu
-URL-REGEX,^https?://acs\.m\.taobao\.com/gw/mtop\.taobao\.idle\.home\.welcome/
+URL-REGEX,^https?://games\.mobileapi\.hupu\.com/.+/(interfaceAdMonitor|interfaceAd|status/init)
 # >> iFlytek
 URL-REGEX,^https?://imeclient\.openspeech\.cn/adservice/
 # >> Jiemian
@@ -345,25 +316,17 @@ URL-REGEX,^https?://static1\.keepcdn\.com/.+\d{3}x\d{4}
 URL-REGEX,^https?://api\.gotokeep\.com/ads/
 # >> KFC
 URL-REGEX,^https?://res\.kfc\.com\.cn/advertisement/
-# >> KouBei
-URL-REGEX,^https?://acs\.m\.taobao\.com/gw/mtop\.o2o\.ad\.gateway\.get/
-URL-REGEX,^https?://render\.alipay\.com/p/s/h5data/prod/spring-festival-2019-h5data/popup-h5data\.json
 # >> Kuaikan Comic
 URL-REGEX,^https?://api\.kkmh\.com/.+(ad|advertisement)/
 
 # >> 首汽约车
-URL-REGEX,^https?://gw-passenger\.01zhuanche\.com/gw-passenger/car-rest/webservice/passenger/recommendADs
-URL-REGEX,^https?://gw-passenger\.01zhuanche\.com/gw-passenger/zhuanche-passenger-token/leachtoken/webservice/homepage/queryADs
+URL-REGEX,^https?://gw-passenger\.01zhuanche\.com/gw-passenger/(car-rest/webservice/passenger/recommendADs|zhuanche-passenger-token/leachtoken/webservice/homepage/queryADs)
 # >> SMZDM
 URL-REGEX,^https?://api\.smzdm\.com/v\d/util/loading
 # >> Snail Sleep
-URL-REGEX,^https?://snailsleep\.net/snail/v\d/adTask/
-URL-REGEX,^https?://snailsleep\.net/snail/v\d/screen/qn/get\?
+URL-REGEX,^https?://snailsleep\.net/snail/v\d/(adTask/|screen/qn/get)
 # >> StarFans
-URL-REGEX,^https?://a\.sfansclub\.com/business/t/ad/
-URL-REGEX,^https?://a\.sfansclub\.com/business/t/boot/screen/index
-# >> TaPiaoPiao
-URL-REGEX,^https?://acs\.m\.taobao\.com/gw/mtop\.film\.mtopadvertiseapi\.queryadvertise/
+URL-REGEX,^https?://a\.sfansclub\.com/business/t/(ad/|boot/screen/index)
 # >> Tencent Futu Securities
 URL-REGEX,^https?://api5\.futunn\.com/ad/
 # >> Tencent Game
@@ -400,30 +363,25 @@ URL-REGEX,^https?://static\.vuevideo\.net/styleAssets/advertisement/
 URL-REGEX,^https?://api\.wallstreetcn\.com/apiv\d/advertising/
 # >> WeDoctor
 URL-REGEX,^https?://app\.wy\.guahao\.com/json/white/dayquestion/getpopad
-# >> Weico
-URL-REGEX,^https?://overseas\.weico\.cc/portal\.php\?a=get_coopen_ads
 # >> WeiDian
 URL-REGEX,^https?://thor\.weidian\.com/ares/home\.splash/
 # >> WiFi Share Master
 URL-REGEX,^https?://nochange\.ggsafe\.com/ad/
 # >> WIFI8
-URL-REGEX,^https?://cmsapi\.wifi8\.com/v\d/emptyAd/info
-URL-REGEX,^https?://cmsapi\.wifi8\.com/v\d/adNew/config
+URL-REGEX,^https?://cmsapi\.wifi8\.com/v\d/(emptyAd/info|adNew/config)
 # >> Wuta Cam
 URL-REGEX,^https?://api-release\.wuta-cam\.com/ad_tree
 URL-REGEX,^https?://res-release\.wuta-cam\.com/json/ads_component_cache\.json
 # >> Xiachufang
 URL-REGEX,^https?://api\.xiachufang\.com/v\d/ad/
 # >> MaFengWo
-URL-REGEX,^https?://mapi\.mafengwo\.cn/ad/
-URL-REGEX,^https?://mapi\.mafengwo\.cn/travelguide/ad/
+URL-REGEX,^https?://mapi\.mafengwo\.cn/(travelguide/)?ad/
 # >> Maiduidui
 URL-REGEX,^https?://mob\.mddcloud\.com\.cn/api/(ad|advert)/
 # >> Manhuaren
 URL-REGEX,^https?://mangaapi\.manhuaren\.com/v\d/public/getStartPageAds
 # >> Meituan
 URL-REGEX,^https?://img\.meituan\.net/midas/
-URL-REGEX,^https?://p\d\.meituan\.net/(mmc|wmbanner)/
 URL-REGEX,^https?://p\d\.meituan\.net/(adunion|display|linglong|mmc|wmbanner)/
 URL-REGEX,^https?://s3plus\.meituan\.net/.+/linglong/
 # >> Meiweibuyongdeng
@@ -431,8 +389,7 @@ URL-REGEX,^https?://capi\.mwee\.cn/app-api/V12/app/getstartad
 
 # >> MI
 URL-REGEX,^https?://api\.m\.mi\.com/v\d/app/start
-URL-REGEX,^https?://api\.jr\.mi\.com/v\d/adv/
-URL-REGEX,^https?://api\.jr\.mi\.com/jr/api/playScreen
+URL-REGEX,^https?://api\.jr\.mi\.com/(v\d/adv/|jr/api/playScreen)
 URL-REGEX,^https?://home\.mi\.com/cgi-op/api/v1/recommendation/(banner|carousel/banners|myTab|openingBanner)
 
 # >> MI Fit
@@ -443,8 +400,7 @@ URL-REGEX,^https?://b-api\.ins\.miaopai\.com/1/ad/
 # >> MIgu
 # URL-REGEX,^https?://.+/v\d/iflyad/
 # URL-REGEX,^https?://.+/cdn-adn/
-URL-REGEX,^https?://ggic\.cmvideo\.cn/ad/
-URL-REGEX,^https?://ggic2\.cmvideo\.cn/ad/
+URL-REGEX,^https?://(ggic|ggic2)\.cmvideo\.cn/ad/
 # URL-REGEX,^https?://.+/img/ad\.union\.api/
 # >> MixC
 URL-REGEX,^https?://app\.mixcapp\.com/mixc/api/v\d/ad
@@ -458,20 +414,14 @@ URL-REGEX,^https?://www\.myhug\.cn/ad/
 URL-REGEX,^https?://dili\.bdatu\.com/jiekou/ad/
 # >> NationalGeographicChina
 URL-REGEX,^https?://wap\.ngchina\.cn/news/adverts/
-# >> ofo
-URL-REGEX,^https?://supportda\.ofo\.com/adaction\?
-URL-REGEX,^https?://ma\.ofo\.com/ads/
-URL-REGEX,^https?://activity2\.api\.ofo\.com/ofo/Api/v\d/ads
-URL-REGEX,^https?://ma\.ofo\.com/adImage/
 # >> PeanutWiFiMpass
-URL-REGEX,^https?://cmsapi\.wifi8\.com/v\d{1}/(emptyAd|adNew)/
+URL-REGEX,^https?://cmsapi\.wifi8\.com/v\d/(emptyAd|adNew)/
 # >> Qdaily
 URL-REGEX,^https?://app3\.qdaily\.com/app3/boot_advertisements\.json
 URL-REGEX,^https?://notch\.qdaily\.com/api/v\d/boot_ad
 # >> Qiongou
 URL-REGEX,^https?://media\.qyer\.com/ad/
-URL-REGEX,^https?://open\.qyer\.com/qyer/config/get
-URL-REGEX,^https?://open\.qyer\.com/qyer/startpage/
+URL-REGEX,^https?://open\.qyer\.com/qyer/(config/get|startpage/)
 # >> Qiuduoduo
 URL-REGEX,^https?://api\.qiuduoduo\.cn/guideimage
 # >> Renren Video
@@ -480,24 +430,14 @@ URL-REGEX,^https?://api\.videozhishi\.com/api/getAdvertising
 URL-REGEX,^https?://msspjh\.emarbox\.com/getAdConfig
 # >> ShiHuo
 URL-REGEX,^https?://www\.shihuo\.cn/app3/saveAppInfo
-# >> Xiami music
-URL-REGEX,^https?://acs\.m\.taobao\.com/gw/mtop\.alimusic\.common\.mobileservice\.startinit/
-# >> Xianyu
-URL-REGEX,^https?://gw\.alicdn\.com/mt/
 # >> Xiao Shuimian
 URL-REGEX,^https?://api\.psy-1\.com/cosleep/startup
 # >> Xunyou Booster
-URL-REGEX,^https?://portal-xunyou\.qingcdn\.com/api/v\d/ios/configs/(splash_ad|ad_urls)
-URL-REGEX,^https?://portal-xunyou\.qingcdn\.com/api/v\d{1}/ios/ads/
-
+URL-REGEX,^https?://portal-xunyou\.qingcdn\.com/api/v\d/ios/(ads/|configs/splash_ad|configs/ad_urls)
 # >> Yahoo!
 URL-REGEX,^https?://m\.yap\.yahoo\.com/v18/getAds\.do
-
 # >> Yingshi Cloud Video
 URL-REGEX,^https?://i\.ys7\.com/api/ads
-# >> YOUKU
-# URL-REGEX,^https?://.+\.mp4\?ccode=0902
-# URL-REGEX,^https?://.+\.mp4\?sid=
 # >> Youtube++
 URL-REGEX,^https?://api\.catch\.gift/api/v\d/pagead/
 # >> Yundongshijie
@@ -509,14 +449,11 @@ URL-REGEX,^https?://a\.qiumibao\.com/activities/config\.php
 # >> Zhuishushenqi
 URL-REGEX,^https?://(api|b)\.zhuishushenqi\.com/advert
 URL-REGEX,^https?://api01pbmp\.zhuishushenqi\.com/gameAdvert
-URL-REGEX,^https?://api\.zhuishushenqi\.com/notification/shelfMessage
-URL-REGEX,^https?://api\.zhuishushenqi\.com/recommend
-URL-REGEX,^https?://api\.zhuishushenqi\.com/splashes/ios
-URL-REGEX,^https?://api\.zhuishushenqi\.com/user/bookshelf-updated
+URL-REGEX,^https?://api\.zhuishushenqi\.com/(notification/shelfMessage|recommend|splashes/ios|user/bookshelf-updated)
 URL-REGEX,^https?://dspsdk\.abreader\.com/v\d/api/ad\?
 # URL-REGEX,^https?://itunes\.apple\.com/lookup\?id=575826903
 URL-REGEX,^https?://mi\.gdt\.qq\.com/gdt_mview\.fcg
-
-# >> Misc
+# >> Kugou Music
+URL-REGEX,^https?://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/(EcomResourceServer/AdPlayPage/adinfo|MobileAdServer/)
 
 # --- End of Anti-AD Section ---

部分文件因为文件数量过多而无法显示