From 51fe1bcac35d61065afde3558279444d4fcc2ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20R=C3=B6bert?= Date: Wed, 27 Nov 2019 23:16:08 +0100 Subject: [PATCH] Added new rules + regex fixes #303 --- clearurls.js | 4 +-- data/data.min.json | 73 +++++++++++++++++++++++++--------------------- 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/clearurls.js b/clearurls.js index 0030d36..c887cbc 100644 --- a/clearurls.js +++ b/clearurls.js @@ -433,7 +433,7 @@ function start() { * @param {boolean} isActive Is this rule active? */ this.addRule = function (rule, isActive = true) { - rule = "([\\/|\\?|#]|(&|&))+(" + rule + "=[^\\/|\\?|&]*)"; + rule = "([\\/\\?#]|(&|&))+(" + rule + "=[^\\/\\?&]*)"; this.applyRule(enabled_rules, disabled_rules, rule, isActive); }; @@ -479,7 +479,7 @@ function start() { * @param {boolean} isActive Is this rule active? */ this.addReferralMarketing = function (rule, isActive = true) { - rule = "([\\/|\\?|#]|(&|&))+(" + rule + "=[^\\/|\\?|&]*)"; + rule = "([\\/\\?#]|(&|&))+(" + rule + "=[^\\/\\?&]*)"; this.applyRule(enabled_referralMarketing, disabled_referralMarketing, rule, isActive); }; diff --git a/data/data.min.json b/data/data.min.json index 698735a..e1a2f6f 100644 --- a/data/data.min.json +++ b/data/data.min.json @@ -45,7 +45,7 @@ ".*(amazon\\.).*\\/message-us\\?.*" ], "rawRules": [ - "\\/ref=[^\\/|\\?]*" + "\\/ref=[^\\/\\?]*" ], "redirections": [], "forceRedirection": false @@ -104,13 +104,13 @@ ".*(google\\.).*(\\/upload)?(\\/drive)\\/.*", ".*(docs\\.google\\.).*\\/.*", ".*(accounts\\.google\\.).*", - ".*(google\\.).*\\/searchbyimage\\?image_url=[^\\/|\\?|&]*(\\/|&(amp;)?)?", - ".*(hangouts\\.google\\.).*\\/webchat.*zx=[^\\/|\\?|&]*(\\/|&(amp;)?)?", - ".*(client-channel\\.google\\.).*\\/client-channel.*zx=[^\\/|\\?|&]*(\\/|&(amp;)?)?", - ".*(google\\.).*\\/complete\\/search\\?.*gs_[a-zA-Z]*=[^\\/|\\?|&]*(\\/|&(amp;)?)?", - ".*(google\\.).*\\/s\\?tbm=map.*gs_[a-zA-Z]*=[^\\/|\\?|&]*(\\/|&(amp;)?)?", + ".*(google\\.).*\\/searchbyimage\\?image_url=[^\\/\\?&]*(\\/|&(amp;)?)?", + ".*(hangouts\\.google\\.).*\\/webchat.*zx=[^\\/\\?&]*(\\/|&(amp;)?)?", + ".*(client-channel\\.google\\.).*\\/client-channel.*zx=[^\\/\\?&]*(\\/|&(amp;)?)?", + ".*(google\\.).*\\/complete\\/search\\?.*gs_[a-zA-Z]*=[^\\/\\?&]*(\\/|&(amp;)?)?", + ".*(google\\.).*\\/s\\?tbm=map.*gs_[a-zA-Z]*=[^\\/\\?&]*(\\/|&(amp;)?)?", ".*(news\\.google\\.).*\\?hl=.*", - ".*(google\\.).*\\/setprefs\\?.*hl=[^\\/|\\?|&]*(\\/|&(amp;)?)?", + ".*(google\\.).*\\/setprefs\\?.*hl=[^\\/\\?&]*(\\/|&(amp;)?)?", ".*(google\\.).*\\/appsactivity\\/.*", ".*(google\\.).*\\/aclk\\?.*" ], @@ -160,12 +160,7 @@ "completeProvider": false, "rules": [ "(%3F)?utm_[a-zA-Z]*", - "(%3F)?ga_source", - "(%3F)?ga_medium", - "(%3F)?ga_term", - "(%3F)?ga_content", - "(%3F)?ga_campaign", - "(%3F)?ga_place", + "(%3F)?ga_[a-zA-Z_]+", "(%3F)?yclid", "(%3F)?_openstat", "(%3F)?fb_action_ids", @@ -181,11 +176,12 @@ "(%3F)?hmb_campaign", "(%3F)?hmb_medium", "(%3F)?hmb_source", - "(%3F)?[\\?|&]?ref[\\_]?", + "(%3F)?[\\?&]?ref[\\_]?", "(%3F)?gclid", "(%3F)?otm_[a-zA-Z_]*", "(%3F)?cmpid", - "(%3F)?os_ehash" + "(%3F)?os_ehash", + "(%3F)?_ga" ], "referralMarketing": [], "rawRules": [], @@ -193,11 +189,11 @@ ".*([\\.]?matrix\\.org)(\\/_matrix)\\/.*", ".*([\\.]?prismic\\.io).*", ".*([\\.]?gitlab\\.com).*", - ".*([\\.]?gcsip\\.com).*[\\?|&]ref[\\_]?=[^\\/|\\?|&]*.*", + ".*([\\.]?gcsip\\.com).*[\\?&]ref[\\_]?=[^\\/\\?&]*.*", ".*([\\.]?cloudflare\\.com).*", ".*(myaccount.google\\.[a-zA-Z]{2,}).*", ".*([\\.]?tangerine\\.ca).*", - ".*bugtracker\\.fairphone\\.com\\/.*[\\?|&]ref[\\_]?=[^\\/|\\?|&]*.*", + ".*bugtracker\\.fairphone\\.com\\/.*[\\?&]ref[\\_]?=[^\\/\\?&]*.*", ".*(comment-cdn\\.9gag\\.com).*(\\/comment-list.json\\?).*", ".*(battle\\.net\\/login).*", ".*(blizzard\\.com\\/oauth2).*", @@ -207,8 +203,8 @@ ".*(facebook\\.)\\w{2,}.*(\\/groups\\/member_bio\\/bio_dialog\\/).*", ".*([\\.]?tinkoff\\.ru).*", ".*(cyberport\\.de).*(\\/adscript\\.php).*", - ".*(\\/refs\\/switch).*\\?.*(%3F)?[\\?|&]?ref[\\_]?=.*", - ".*tweakers\\.net\\/ext\\/lt\\.dsp\\?.*(%3F)?[\\?|&]?ref[\\_]?=.*", + ".*(\\/refs\\/switch).*\\?.*(%3F)?[\\?&]?ref[\\_]?=.*", + ".*tweakers\\.net\\/ext\\/lt\\.dsp\\?.*(%3F)?[\\?&]?ref[\\_]?=.*", "(https:\\/\\/|http:\\/\\/)git\\..*(\\.[a-zA-Z]{2,}).*\\/commit\\/.*\\/pipelines\\?.*", "(https:\\/\\/|http:\\/\\/)git\\..*(\\.[a-zA-Z]{2,}).*\\/.*\\/-\\/branches\\?.*", "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(amazon)(\\.[a-zA-Z]{2,}).*\\/message-us\\?.*" @@ -365,8 +361,7 @@ ".*out\\.reddit\\.\\w{2,}\\/.*url=([^&]*)" ], "forceRedirection": false - } - , + }, "netflix": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(netflix)(\\.[a-zA-Z]{2,}).*", "completeProvider": false, @@ -987,17 +982,29 @@ ], "forceRedirection": false }, - "SPIEGEL ONLINE": { - "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(spiegel)(\\.de)(.*\\?.*)", - "completeProvider": false, - "rules": [ - "b" - ], - "referralMarketing": [], - "rawRules": [], - "exceptions": [], - "redirections": [], - "forceRedirection": false - } + "SPIEGEL ONLINE": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(spiegel)(\\.de)(.*\\?.*)", + "completeProvider": false, + "rules": [ + "b" + ], + "referralMarketing": [], + "rawRules": [], + "exceptions": [], + "redirections": [], + "forceRedirection": false + }, + "rutracker.org": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(rutracker)(\\.org)(.*\\?.*)", + "completeProvider": false, + "rules": [], + "referralMarketing": [], + "rawRules": [], + "exceptions": [], + "redirections": [ + ".*url=([^&]*)" + ], + "forceRedirection": false + } } }