@@ -239,167 +239,12 @@ func sanitizeURL(text string) (string, bool, bool, []string, []string, error) {
239239 continue
240240 }
241241
242- // Create query parameter rules based on defaultRules.ts
243- universalRules := []string {
244- "action_object_map" ,
245- "action_type_map" ,
246- "action_ref_map" ,
247- "spm@*.aliexpress.com" ,
248- "scm@*.aliexpress.com" ,
249- "aff_platform" ,
250- "aff_trace_key" ,
251- "algo_expid@*.aliexpress.*" ,
252- "algo_pvid@*.aliexpress.*" ,
253- "btsid" ,
254- "ws_ab_test" ,
255- "pd_rd_*@amazon.*" ,
256- "_encoding@amazon.*" ,
257- "psc@amazon.*" ,
258- "tag@amazon.*" ,
259- "ref_@amazon.*" ,
260- "pf_rd_*@amazon.*" ,
261- "pf@amazon.*" ,
262- "crid@amazon.*" ,
263- "keywords@amazon.*" ,
264- "sprefix@amazon.*" ,
265- "sr@amazon.*" ,
266- "ie@amazon.*" ,
267- "node@amazon.*" ,
268- "qid@amazon.*" ,
269- "callback@bilibili.com" ,
270- "cvid@bing.com" ,
271- "form@bing.com" ,
272- "sk@bing.com" ,
273- "sp@bing.com" ,
274- "sc@bing.com" ,
275- "qs@bing.com" ,
276- "pq@bing.com" ,
277- "sc_cid" ,
278- "mkt_tok" ,
279- "trk" ,
280- "trkCampaign" ,
281- "ga_*" ,
282- "gclid" ,
283- "gclsrc" ,
284- "hmb_campaign" ,
285- "hmb_medium" ,
286- "hmb_source" ,
287- "spReportId" ,
288- "spJobID" ,
289- "spUserID" ,
290- "spMailingID" ,
291- "itm_*" ,
292- "s_cid" ,
293- "elqTrackId" ,
294- "elqTrack" ,
295- "assetType" ,
296- "assetId" ,
297- "recipientId" ,
298- "campaignId" ,
299- "siteId" ,
300- "mc_cid" ,
301- "mc_eid" ,
302- "pk_*" ,
303- "sc_campaign" ,
304- "sc_channel" ,
305- "sc_content" ,
306- "sc_medium" ,
307- "sc_outcome" ,
308- "sc_geo" ,
309- "sc_country" ,
310- "nr_email_referer" ,
311- "vero_conv" ,
312- "vero_id" ,
313- "yclid" ,
314- "_openstat" ,
315- "mbid" ,
316- "cmpid" ,
317- "cid" ,
318- "c_id" ,
319- "campaign_id" ,
320- "Campaign" ,
321- "hash@ebay.*" ,
322- "fb_action_ids" ,
323- "fb_action_types" ,
324- "fb_ref" ,
325- "fb_source" ,
326- "fbclid" ,
327- "refsrc@facebook.com" ,
328- "hrc@facebook.com" ,
329- "gs_l" ,
330- "gs_lcp@google.*" ,
331- "ved@google.*" ,
332- "ei@google.*" ,
333- "sei@google.*" ,
334- "gws_rd@google.*" ,
335- "gs_gbg@google.*" ,
336- "gs_mss@google.*" ,
337- "gs_rn@google.*" ,
338- "_hsenc" ,
339- "_hsmi" ,
340- "__hssc" ,
341- "__hstc" ,
342- "hsCtaTracking" ,
343- "source@sourceforge.net" ,
344- "position@sourceforge.net" ,
345- "t@*.twitter.com" ,
346- "s@*.twitter.com" ,
347- "ref_*@*.twitter.com" ,
348- "t@*.x.com" ,
349- "s@*.x.com" ,
350- "ref_*@*.x.com" ,
351- "t@*.fixupx.com" ,
352- "s@*.fixupx.com" ,
353- "ref_*@*.fixupx.com" ,
354- "t@*.fxtwitter.com" ,
355- "s@*.fxtwitter.com" ,
356- "ref_*@*.fxtwitter.com" ,
357- "t@*.twittpr.com" ,
358- "s@*.twittpr.com" ,
359- "ref_*@*.twittpr.com" ,
360- "t@*.fixvx.com" ,
361- "s@*.fixvx.com" ,
362- "ref_*@*.fixvx.com" ,
363- "tt_medium" ,
364- "tt_content" ,
365- "lr@yandex.*" ,
366- "redircnt@yandex.*" ,
367- "feature@*.youtube.com" ,
368- "kw@*.youtube.com" ,
369- "si@*.youtube.com" ,
370- "pp@*.youtube.com" ,
371- "si@*.youtu.be" ,
372- "wt_zmc" ,
373- "utm_source" ,
374- "utm_content" ,
375- "utm_medium" ,
376- "utm_campaign" ,
377- "utm_term" ,
378- "si@open.spotify.com" ,
379- "igshid" ,
380- "igsh" ,
381- "share_id@reddit.com" ,
382- "si@soundcloud.com" ,
383- }
384-
385- // Host-specific rules
386- hostRules := map [string ][]string {
387- "amazon" : {"pd_rd_" , "_encoding" , "psc" , "tag" , "ref_" , "pf_rd_" , "pf" , "crid" },
388- "youtube.com" : {"feature" , "kw" , "si" , "pp" },
389- "youtu.be" : {"si" },
390- "twitter.com" : {"t" , "s" , "ref_" },
391- "x.com" : {"t" , "s" , "ref_" },
392- "instagram.com" : {"igshid" },
393- "spotify.com" : {"si" },
394- "reddit.com" : {"share_id" },
395- "soundcloud.com" : {"si" },
396- "tiktok" : {"_r" , "_t" },
397- }
242+ // Use universal rules from rules.go
398243
399244 // Clean universal parameters
400245 q := parsedURL .Query ()
401246 for param := range q {
402- for _ , rule := range universalRules {
247+ for _ , rule := range URLRules {
403248 if strings .HasPrefix (param , rule ) {
404249 q .Del (param )
405250 sanitized = true
@@ -408,7 +253,7 @@ func sanitizeURL(text string) (string, bool, bool, []string, []string, error) {
408253 }
409254
410255 // Clean host-specific parameters
411- for host , rules := range hostRules {
256+ for host , rules := range DomainRules {
412257 if strings .Contains (parsedURL .Host , host ) {
413258 for param := range q {
414259 for _ , rule := range rules {
0 commit comments