help creating pattern to remove linkid from amazon #400
-
Hello um i need some help with regex patterns. I'm trying to remove linkid param from amazon links but i keep failing. I tried using this regex made by chatgpt but it still keeps question mark. "remove linkId from Amazon URL": { https://www.amazon.in/shop/MrSujano?linkId=69900caff6b8ede42352973921a6ee43&language=en_US https://www.amazon.in/gp/product/B08D45C1YF?linkId=3fb12d772aedc6efe071703f0b838a7a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I think the URL Cleaner module is better suited for this task, or at least makes more sense to me. Just edit the file like the following. Coincidentally, amazon is the first that shows in the built in catalog, which is where I get the {
"customRules": {
YOUR RULES HERE
},
"providers": {
"amazon": {
... rest of the file ... And in YOUR RULES HERE paste the following: "amazon": {
"urlPattern": "^https?:\\/\\/(?:[a-z0-9-]+\\.)*?amazon(?:\\.[a-z]{2,}){1,}",
"rules": [
"linkId"
],
"exceptions": [
"^https?:\\/\\/(?:[a-z0-9-]+\\.)*?amazon(?:\\.[a-z]{2,}){1,}\\/gp\\/.*?(?:redirector.html|cart\\/ajax-update.html|video\\/api\\/)",
"^https?:\\/\\/(?:[a-z0-9-]+\\.)*?amazon(?:\\.[a-z]{2,}){1,}\\/(?:hz\\/reviews-render\\/ajax\\/|message-us\\?|s\\?)"
]
} In fact, here is my custom entry if you want it. Note that try to strip every parameter I can, and while I do testing, maybe one of these parameters is necessary for something and I just remove it for no reason. "amazon": {
"urlPattern": "^https?:\\\/\\\/(?:[a-z0-9-]+\\.)*?amazon(?:\\.[a-z]{2,}){1,}",
"rules": [
"psc",
"spc",
"sp_csd",
"linkId",
"sbo",
"xpid",
"ufe",
"spLa",
"maas",
"btn_ref",
"social_share",
"skipTwisterOG",
"starsLeft",
"visitId"
],
"exceptions": [
"^https?:\\\/\\\/(?:[a-z0-9-]+\\.)*?amazon(?:\\.[a-z]{2,}){1,}\\\/gp\\\/.*?(?:redirector.html|cart\\\/ajax-update.html|video\\\/api\\\/)",
"^https?:\\\/\\\/(?:[a-z0-9-]+\\.)*?amazon(?:\\.[a-z]{2,}){1,}\\\/(?:hz\\\/reviews-render\\\/ajax\\\/|message-us\\?|s\\?)"
]
} |
Beta Was this translation helpful? Give feedback.
I think the URL Cleaner module is better suited for this task, or at least makes more sense to me.
Just edit the file like the following. Coincidentally, amazon is the first that shows in the built in catalog, which is where I get the
urlPattern
andexceptions
fieldsAnd in YOUR RULES HERE paste the following: