From cbb22f3b162c641f2d66bbdf84bac3e094887777 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Tue, 23 Apr 2024 14:08:10 +0800 Subject: [PATCH] Perf: improve reject regex / regex sorting --- ...itm-hostname.js => build-mitm-hostname.ts} | 85 ++++++----- Build/lib/create-file.ts | 31 +++- Modules/sukka_mitm_hostnames.sgmodule | 2 +- Modules/sukka_url_rewrite.sgmodule | 5 +- Source/domainset/reject_sukka.conf | 1 - Source/non_ip/domestic.conf | 1 + Source/non_ip/reject.conf | 139 +++++------------- 7 files changed, 114 insertions(+), 150 deletions(-) rename Build/{build-mitm-hostname.js => build-mitm-hostname.ts} (67%) diff --git a/Build/build-mitm-hostname.js b/Build/build-mitm-hostname.ts similarity index 67% rename from Build/build-mitm-hostname.js rename to Build/build-mitm-hostname.ts index fcba416c..a2d1b8ed 100644 --- a/Build/build-mitm-hostname.js +++ b/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; } diff --git a/Build/lib/create-file.ts b/Build/lib/create-file.ts index c407e7be..f0373cd0 100644 --- a/Build/lib/create-file.ts +++ b/Build/lib/create-file.ts @@ -115,16 +115,37 @@ const sortTypeOrder: Record = { '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]); diff --git a/Modules/sukka_mitm_hostnames.sgmodule b/Modules/sukka_mitm_hostnames.sgmodule index 363cdd8d..f1a0e8d7 100644 --- a/Modules/sukka_mitm_hostnames.sgmodule +++ b/Modules/sukka_mitm_hostnames.sgmodule @@ -4,4 +4,4 @@ [MITM] -hostname = %APPEND% update.pan.baidu.com, c.tieba.baidu.com, cover.baidu.com, *ydstatic.com, api.chelaile.net.cn, atrace.chelaile.net.cn, *.meituan.net, ctrl.playcvn.com, ctrl.playcvn.net, ctrl.zmzapi.com, ctrl.zmzapi.net, api.zhuishushenqi.com, b.zhuishushenqi.com, *.music.126.net, *.prod.hosts.ooklaserver.net, api.abema.io, g.cn, google.cn, ign.xn--fiqs8s, abbyychina.com, bartender.cc, betterzip.net, beyondcompare.cc, bingdianhuanyuan.cn, chemdraw.com.cn, codesoftchina.com, coreldrawchina.com, crossoverchina.com, easyrecoverychina.com, ediuschina.com, flstudiochina.com, formysql.com, guitarpro.cc, huishenghuiying.com.cn, iconworkshop.cn, imindmap.cc, jihehuaban.com.cn, keyshot.cc, mathtype.cn, mindmanager.cc, mindmapper.cc, mycleanmymac.com, nicelabel.cc, ntfsformac.cc, ntfsformac.cn, overturechina.com, passwordrecovery.cn, pdfexpert.cc, ultraiso.net, vegaschina.cn, xmindchina.net, xshellcn.com, yuanchengxiezuo.com, zbrushcn.com, aweme-eagle*.snssdk.com, union.click.jd.com, gw.alicdn.com, www.g.cn, www.google.cn, www.ign.xn--fiqs8s, www.abbyychina.com, www.bartender.cc, www.betterzip.net, www.beyondcompare.cc, www.bingdianhuanyuan.cn, www.chemdraw.com.cn, www.codesoftchina.com, www.coreldrawchina.com, www.crossoverchina.com, www.easyrecoverychina.com, www.ediuschina.com, www.flstudiochina.com, www.formysql.com, www.guitarpro.cc, www.huishenghuiying.com.cn, www.iconworkshop.cn, www.imindmap.cc, www.jihehuaban.com.cn, www.keyshot.cc, www.mathtype.cn, www.mindmanager.cc, www.mindmapper.cc, www.mycleanmymac.com, www.nicelabel.cc, www.ntfsformac.cc, www.ntfsformac.cn, www.overturechina.com, www.passwordrecovery.cn, www.pdfexpert.cc, www.ultraiso.net, www.vegaschina.cn, www.xmindchina.net, www.xshellcn.com, www.yuanchengxiezuo.com, www.zbrushcn.com, premiumyva.appspot.com, service.4gtv.tv, issuecdn.baidupcs.com, app.bilibili.com, api.bilibili.com, asp.cntv.myalicdn.com, cntv.hls.cdn.myqcloud.com, v.cctv.com, www.cntv.cn, img-ys011.didistatic.com, act.vip.iqiyi.com, iface.iqiyi.com, counter.ksosoft.com, *.kingsoft-office-service.com, dict-mobile.iciba.com, ios.wps.cn, mobile-pic.cache.iciba.com, service.iciba.com, iad.*mat.*.126.net, iad.*mat.*.127.net, client.mail.163.com, c.m.163.com, dsp-impr2.youdao.com, oimage*.ydstatic.com, sp.kaola.com, support.you.163.com, agent-count.pconline.com.cn, mrobot.pcauto.com.cn, mrobot.pconline.com.cn, edit.sinaapp.com, tqt.weibo.cn, sdkapp.uve.weibo.com, wbapp.uve.weibo.com, api.k.sohu.com, api.tv.sohu.com, hui.sohu.com, pic.k.sohu.com, s1.api.tv.itc.cn, api.m.jd.com, dsp-x.jd.com, bdsp-x.jd.com, ms.jr.jd.com, huichuan.sm.cn, iflow.uczzd.cn, mp.weixin.qq.com, adse.ximalaya.com, fdfs.xmcdn.com, www.zhihu.com, api.zhihu.com, *.58cdn.com.cn, app.58.com, aes.acfun.cn, dsp.toutiao.com, nnapp.cloudbae.cn, gw.aihuishou.com, m*.amap.com, 7n.bczcdn.com, www.myhug.cn, app.api.ke.com, channel.beitaichufang.com, iapi.bishijie.com, api.intsig.net, cap.caocaokeji.cn, pic1.chelaile.net.cn, app.10086.cn, m.client.10010.com, www.dandanzan.com, mapi.dangdang.com, api.daydaycook.com.cn, cms.daydaycook.com.cn, mobile-api2011.elong.com, www.facebook.com, acs.m.taobao.com, www.flyertea.com, foodie-api.yiruikecorp.com, cdn.api.fotoable.com, gateway.shouqiev.com, m.ibuscloud.com, smkmp.96225.com, games.mobileapi.hupu.com, imeclient.openspeech.cn, img.jiemian.com, api.jxedt.com, richmanapi.jxedt.com, static1.keepcdn.com, api.gotokeep.com, res.kfc.com.cn, render.alipay.com, api.kkmh.com, gw-passenger.01zhuanche.com, api.smzdm.com, snailsleep.net, a.sfansclub.com, api5.futunn.com, qt.qq.com, ssl.kohsocialapp.qq.com, 3gimg.qq.com, newsso.map.qq.com, r.inews.qq.com, vv.video.qq.com, adpai.thepaper.cn, images.client.vip.xunlei.com, 47.97.20.12, api.gaoqingdianshi.com, pss.txffp.com, app.variflight.com, static.vuevideo.net, api.wallstreetcn.com, app.wy.guahao.com, overseas.weico.cc, thor.weidian.com, nochange.ggsafe.com, cmsapi.wifi8.com, api-release.wuta-cam.com, res-release.wuta-cam.com, api.xiachufang.com, mapi.mafengwo.cn, mob.mddcloud.com.cn, mangaapi.manhuaren.com, capi.mwee.cn, api.m.mi.com, api.jr.mi.com, api-mifit.huami.com, b-api.ins.miaopai.com, ggic.cmvideo.cn, ggic2.cmvideo.cn, app.mixcapp.com, api.mgzf.com, cdn.moji.com, dili.bdatu.com, wap.ngchina.cn, supportda.ofo.com, ma.ofo.com, activity2.api.ofo.com, app3.qdaily.com, notch.qdaily.com, media.qyer.com, open.qyer.com, api.qiuduoduo.cn, api.rr.tv, api.videozhishi.com, msspjh.emarbox.com, www.shihuo.cn, api.psy-1.com, portal-xunyou.qingcdn.com, m.yap.yahoo.com, i.ys7.com, api.catch.gift, *.iydsj.com, a.qiumibao.com, api01pbmp.zhuishushenqi.com, dspsdk.abreader.com, mi.gdt.qq.com, y.gtimg.cn, nomo.dafork.com, manga.bilibili.com +hostname = %APPEND% *.ydstatic.com, api.chelaile.net.cn, atrace.chelaile.net.cn, *.meituan.net, ctrl.playcvn.com, ctrl.playcvn.net, ctrl.zmzapi.com, ctrl.zmzapi.net, api.zhuishushenqi.com, b.zhuishushenqi.com, 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, api.abema.io, g.cn, google.cn, ign.xn--fiqs8s, abbyychina.com, bartender.cc, betterzip.net, beyondcompare.cc, bingdianhuanyuan.cn, chemdraw.com.cn, codesoftchina.com, coreldrawchina.com, crossoverchina.com, easyrecoverychina.com, ediuschina.com, flstudiochina.com, formysql.com, guitarpro.cc, huishenghuiying.com.cn, iconworkshop.cn, imindmap.cc, jihehuaban.com.cn, keyshot.cc, mathtype.cn, mindmanager.cc, mindmapper.cc, mycleanmymac.com, nicelabel.cc, ntfsformac.cc, ntfsformac.cn, overturechina.com, passwordrecovery.cn, pdfexpert.cc, ultraiso.net, vegaschina.cn, xmindchina.net, xshellcn.com, yuanchengxiezuo.com, zbrushcn.com, union.click.jd.com, nomo.dafork.com, www.g.cn, www.google.cn, www.ign.xn--fiqs8s, www.abbyychina.com, www.bartender.cc, www.betterzip.net, www.beyondcompare.cc, www.bingdianhuanyuan.cn, www.chemdraw.com.cn, www.codesoftchina.com, www.coreldrawchina.com, www.crossoverchina.com, www.easyrecoverychina.com, www.ediuschina.com, www.flstudiochina.com, www.formysql.com, www.guitarpro.cc, www.huishenghuiying.com.cn, www.iconworkshop.cn, www.imindmap.cc, www.jihehuaban.com.cn, www.keyshot.cc, www.mathtype.cn, www.mindmanager.cc, www.mindmapper.cc, www.mycleanmymac.com, www.nicelabel.cc, www.ntfsformac.cc, www.ntfsformac.cn, www.overturechina.com, www.passwordrecovery.cn, www.pdfexpert.cc, www.ultraiso.net, www.vegaschina.cn, www.xmindchina.net, www.xshellcn.com, www.yuanchengxiezuo.com, www.zbrushcn.com, premiumyva.appspot.com, cover.baidu.com, c.tieba.baidu.com, issuecdn.baidupcs.com, update.pan.baidu.com, app.bilibili.com, www.cntv.cn, img-ys011.didistatic.com, act.vip.iqiyi.com, iface.iqiyi.com, counter.ksosoft.com, ios.wps.cn, mobile-pic.cache.iciba.com, service.iciba.com, client.mail.163.com, c.m.163.com, dsp-impr2.youdao.com, sp.kaola.com, support.you.163.com, agent-count.pconline.com.cn, tqt.weibo.cn, edit.sinaapp.com, wbapp.uve.weibo.com, api.k.sohu.com, api.tv.sohu.com, hui.sohu.com, s1.api.tv.itc.cn, b, api.m.jd.com, ms.jr.jd.com, huichuan.sm.cn, iflow.uczzd.cn, adse.ximalaya.com, www.zhihu.com, app.58.com, aes.acfun.cn, acs.m.taobao.com, dsp.toutiao.com, nnapp.cloudbae.cn, gw.aihuishou.com, m*.amap.com, 7n.bczcdn.com, www.myhug.cn, app.api.ke.com, channel.beitaichufang.com, iapi.bishijie.com, api.intsig.net, cap.caocaokeji.cn, pic1.chelaile.net.cn, m.client.10010.com, www.dandanzan.com, mapi.dangdang.com, api.daydaycook.com.cn, cms.daydaycook.com.cn, www.flyertea.com, cdn.api.fotoable.com, gateway.shouqiev.com, m.ibuscloud.com, smkmp.96225.com, imeclient.openspeech.cn, img.jiemian.com, api.jxedt.com, richmanapi.jxedt.com, api.gotokeep.com, res.kfc.com.cn, api.smzdm.com, api5.futunn.com, qt.qq.com, 3gimg.qq.com, newsso.map.qq.com, vv.video.qq.com, szextshort.weixin.qq.com, y.gtimg.cn, api.gaoqingdianshi.com, pss.txffp.com, app.variflight.com, static.vuevideo.net, api.wallstreetcn.com, app.wy.guahao.com, thor.weidian.com, nochange.ggsafe.com, api-release.wuta-cam.com, res-release.wuta-cam.com, api.xiachufang.com, mapi.mafengwo.cn, mangaapi.manhuaren.com, img.meituan.net, capi.mwee.cn, api.m.mi.com, b-api.ins.miaopai.com, app.mixcapp.com, api.mgzf.com, dili.bdatu.com, wap.ngchina.cn, app3.qdaily.com, notch.qdaily.com, media.qyer.com, api.qiuduoduo.cn, api.rr.tv, api.videozhishi.com, msspjh.emarbox.com, www.shihuo.cn, api.psy-1.com, m.yap.yahoo.com, i.ys7.com, api.catch.gift, a.qiumibao.com, api01pbmp.zhuishushenqi.com, dspsdk.abreader.com, mi.gdt.qq.com, service.4gtv.tv, api.bilibili.com, manga.bilibili.com, sdkapp.uve.weibo.com, api.zhihu.com, app.10086.cn, mobile-api2011.elong.com, foodie-api.yiruikecorp.com, gw-passenger.01zhuanche.com, snailsleep.net, a.sfansclub.com, r.inews.qq.com, mp.weixin.qq.com, cmsapi.wifi8.com, mob.mddcloud.com.cn, p*.meituan.net, api.jr.mi.com, home.mi.com, api-mifit.huami.com, cdn.moji.com, open.qyer.com, portal-xunyou.qingcdn.com, asp.cntv.myalicdn.com, cntv.hls.cdn.myqcloud.com, v.cctv.com, *.kingsoft-office-service.com, oimage*.ydstatic.com, *.58cdn.com.cn, static1.keepcdn.com, adpai.thepaper.cn, images.client.vip.xunlei.com, s3plus.meituan.net, *.iydsj.com, dict-mobile.iciba.com, games.mobileapi.hupu.com, api.kkmh.com diff --git a/Modules/sukka_url_rewrite.sgmodule b/Modules/sukka_url_rewrite.sgmodule index 5f048c93..d7c8b2fa 100644 --- a/Modules/sukka_url_rewrite.sgmodule +++ b/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 diff --git a/Source/domainset/reject_sukka.conf b/Source/domainset/reject_sukka.conf index 04743f22..3328fe4a 100644 --- a/Source/domainset/reject_sukka.conf +++ b/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 diff --git a/Source/non_ip/domestic.conf b/Source/non_ip/domestic.conf index 863a6fcd..6f95b4a7 100644 --- a/Source/non_ip/domestic.conf +++ b/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 diff --git a/Source/non_ip/reject.conf b/Source/non_ip/reject.conf index 26908a9b..c184c608 100644 --- a/Source/non_ip/reject.conf +++ b/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 ---