// ==UserScript== | |
// @name RedFlagDeals Redirect Stripper | |
// @author Dave Gallant | |
// @description Strip redirect links on forums.redflagdeals.com | |
// @downloadURL https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/main/script.js | |
// @grant none | |
// @match *://forums.redflagdeals.com/* | |
// @namespace http://tampermonkey.net/ | |
// @updateURL https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/main/script.js | |
// @version 0.0.1 | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var Links = document.querySelectorAll('a.postlink, a.autolinker_link'); | |
const REDIRECT_REGEX = [ | |
{ | |
name: 'Amazon', | |
pattern: 'www.amazon.ca/gp/redirect.html\\?ie=UTF8&location=(?<baseUrl>.*?)(&|ref%3D|%3F)', | |
}, | |
{ | |
name: 'Best Buy', | |
pattern: 'bestbuyca.(.*).net(.*)\\?u=(?<baseUrl>.*)', | |
}, | |
{ | |
name: 'Samsung', | |
pattern: 'www.awin1.com(.*)\?p=(?<baseUrl>.*)', | |
}, | |
{ | |
name: 'redirectingat.com', | |
pattern: 'go.redirectingat.com/.*url=(?<baseUrl>.*).*', | |
}, | |
{ | |
name: 'homedepot', | |
pattern: 'the-home-depot-ca.pxf.io(.*)\?u=(?<baseUrl>.*)', | |
}, | |
{ | |
name: 'redirectingat', | |
pattern: 'go.redirectingat.com(.*)\?url=(?<baseUrl>.*)', | |
}, | |
{ | |
name: 'adidas-canada', | |
pattern: 'adidas-canada.sjv.io(.*)\?u=(?<baseUrl>.*)', | |
}, | |
{ | |
name: 'canadiantire', | |
pattern: 'imp.i([0-9]*).net(.*)\?u=(?<baseUrl>.*)', | |
}, | |
{ | |
name: 'underarmour', | |
pattern: 'www.awin1.com(.*)\?ued=(?<baseUrl>.*)', | |
}, | |
{ | |
name: 'lenovo', | |
pattern: '(.*).evyy.net(.*)\?u=(?<baseUrl>.*)', | |
}, | |
{ | |
name: 'thesource', | |
pattern: 'www.kqzyfj.com(.*)\?url=(?<baseUrl>.*)', | |
}, | |
{ | |
name: 'walmart', | |
pattern: 'click.linksynergy.com(.*)\?murl=(?<baseUrl>.*)&u1=.*', | |
}, | |
]; | |
var StripRedirect = function(URL) { | |
for (var i = 0; i < REDIRECT_REGEX.length; i++) { | |
var rule = REDIRECT_REGEX[i]; | |
var result = new RegExp(rule.pattern).exec(URL); | |
if (result) { | |
var newURL = result.groups.baseUrl; | |
try { | |
return decodeURIComponent(newURL); | |
} catch (e) { | |
console.log(e); | |
return URL; | |
} | |
} | |
} | |
return URL; | |
}; | |
Links.forEach(function(Link) { | |
var ReferralURL = Link.href; | |
Link.href = StripRedirect(ReferralURL); | |
}); | |
})(); |
How is this supposed to work? I installed from the zip file and Tampermonkey doesn't show the script.
@YesTrustMe, you can simply:
- Click on the TamperMonkey extension
- Click on "Create a new Script"
- Paste this gist in
- Save
It should then be active and referral links should be stripped out.
@davegallant Hi. Thank you for that! It's loaded, but...
RFD Referral links such as those from Amazon posted on RFD in threads. They are no longer stripped of referral links. In the past, I have been using a URL cleaner and URL revealer website but recently RFD referral links for many retailers like Amazon are not stripped. It's frustrating.
@davegallant Hi. Thank you for that! It's loaded, but...
RFD Referral links such as those from Amazon posted on RFD in threads. They are no longer stripped of referral links. In the past, I have been using a URL cleaner and URL revealer website but recently RFD referral links for many retailers like Amazon are not stripped. It's frustrating.
@YesTrustMe I haven't had time to browse RFD much lately. I've updated it to use regex with named capture groups to strip redirects. I've only added the regex for Amazon and Best Buy but as you can see, it should be somewhat extendable.
@YesTrustMe Please feel free to fork this or contribute any other regex / patterns you may find:
https://github.com/davegallant/rfd-redirect-stripper
Thanks. But it's a no-go. It also appears RFD has FURTHER modified their Amazon referal links and now you can't even copy the link in Chrome. Have a look at this thread: https://forums.redflagdeals.com/amazon-ca-huion-hs610-graphics-drawing-tablet-battery-free-stylus-android-windows-macos-tilt-function-pw100-touch-ring-10-2515747/
Thanks. But it's a no-go. It also appears RFD has FURTHER modified their Amazon referal links and now you can't even copy the link in Chrome. Have a look at this thread: https://forums.redflagdeals.com/amazon-ca-huion-hs610-graphics-drawing-tablet-battery-free-stylus-android-windows-macos-tilt-function-pw100-touch-ring-10-2515747/
Not sure what you mean. That thread's link is broken with or without this script? This comment alludes to it being broken: https://forums.redflagdeals.com/amazon-ca-huion-hs610-graphics-drawing-tablet-battery-free-stylus-android-windows-macos-tilt-function-pw100-touch-ring-10-2515747/#p35518179
A valid link should be stripped like this:
https://forums.redflagdeals.com/amazon-ca-asus-geforce-gtx-1050-ti-4gb-phoenix-fan-edition-221-99-2515731/
It's not broken. If you go to the site and hover over the link, you cannot even copy and paste it any more in Chrome. Whereas, you can do so in FireFox. In fact, in FF, the script works fine to copy the cleaned link. This could be an RFD issue since revealing a link on other sites or even on RFD with non referral links on their site. I haven't tested the script on Edge though to rule out if this issue is with Chromium browsers. But Google has made some changes and CCleaner can no longer clean Chrome cookies.
Hi. It was working great until just the other day. Here's the link in question, Tampermonkey used to show a counter but not any more, Sample is attached,: http://www.amazon.ca/gp/redirect.html?ie=UTF8&location=https%3A%2F%2Fwww.amazon.ca%2Fdp%2FB0787D6SGT%2Fref%3Dvp_d_pb_TIER3_d3_lp_B00EC5EUSM_pd%3F_encoding%3DUTF8%26pd_rd_i%3DB0787D6SGT%26pd_rd_w%3DFHdmP%26pf_rd_p%3D12bcdf04-a0b5-4c35-ab9d-da86d8bbcb5a%26pf_rd_r%3D6Q5SZKT1Q84W10QBRCTP%26pd_rd_r%3D4618038f-eaaa-4e86-9deb-dec43fc428a3%26pd_rd_wg%3Dd8Ys7%26th%3D1&tag=redflagdealsc-20&linkCode=ur2&camp=15121&creative=330641
Hi. It was working great until just the other day. Here's the link in question, Tampermonkey used to show a counter but not any more, Sample is attached,: http://www.amazon.ca/gp/redirect.html?ie=UTF8&location=https%3A%2F%2Fwww.amazon.ca%2Fdp%2FB0787D6SGT%2Fref%3Dvp_d_pb_TIER3_d3_lp_B00EC5EUSM_pd%3F_encoding%3DUTF8%26pd_rd_i%3DB0787D6SGT%26pd_rd_w%3DFHdmP%26pf_rd_p%3D12bcdf04-a0b5-4c35-ab9d-da86d8bbcb5a%26pf_rd_r%3D6Q5SZKT1Q84W10QBRCTP%26pd_rd_r%3D4618038f-eaaa-4e86-9deb-dec43fc428a3%26pd_rd_wg%3Dd8Ys7%26th%3D1&tag=redflagdealsc-20&linkCode=ur2&camp=15121&creative=330641
Do you have a link to the forum post itself?
Amazon links are working for me AFAICT.
Hi. It was working great until just the other day. Here's the link in question, Tampermonkey used to show a counter but not any more, Sample is attached,: http://www.amazon.ca/gp/redirect.html?ie=UTF8&location=https%3A%2F%2Fwww.amazon.ca%2Fdp%2FB0787D6SGT%2Fref%3Dvp_d_pb_TIER3_d3_lp_B00EC5EUSM_pd%3F_encoding%3DUTF8%26pd_rd_i%3DB0787D6SGT%26pd_rd_w%3DFHdmP%26pf_rd_p%3D12bcdf04-a0b5-4c35-ab9d-da86d8bbcb5a%26pf_rd_r%3D6Q5SZKT1Q84W10QBRCTP%26pd_rd_r%3D4618038f-eaaa-4e86-9deb-dec43fc428a3%26pd_rd_wg%3Dd8Ys7%26th%3D1&tag=redflagdealsc-20&linkCode=ur2&camp=15121&creative=330641
Do you have a link to the forum post itself?
Amazon links are working for me AFAICT.
I can confirm, the RFD stripper no longer working. Here's a sample link: https://www.awin1.com/cread.php?awinmid=18530&awinaffid=139736&clickref=&p=https://www.samsung.com/ca/mobile-accessories/galaxy-tab-s8-ultra-book-cover-keyboard-black-ef-dx900bbegca/
Originally posted here: https://forums.redflagdeals.com/samsung-tab-s8-ultra-book-cover-keyboard-230-before-100-code-2560148/#p36433845
I accessed the RFD link on FireFox which uses Ublock and the EasyList filter blocked access with a warning if I wanted to proceed.
In Chrome I use Adguard and it allowed the sample awin1 link.
But you're right. Amazon links work, not RFD.
Hi. It was working great until just the other day. Here's the link in question, Tampermonkey used to show a counter but not any more, Sample is attached,: http://www.amazon.ca/gp/redirect.html?ie=UTF8&location=https%3A%2F%2Fwww.amazon.ca%2Fdp%2FB0787D6SGT%2Fref%3Dvp_d_pb_TIER3_d3_lp_B00EC5EUSM_pd%3F_encoding%3DUTF8%26pd_rd_i%3DB0787D6SGT%26pd_rd_w%3DFHdmP%26pf_rd_p%3D12bcdf04-a0b5-4c35-ab9d-da86d8bbcb5a%26pf_rd_r%3D6Q5SZKT1Q84W10QBRCTP%26pd_rd_r%3D4618038f-eaaa-4e86-9deb-dec43fc428a3%26pd_rd_wg%3Dd8Ys7%26th%3D1&tag=redflagdealsc-20&linkCode=ur2&camp=15121&creative=330641
Do you have a link to the forum post itself?
Amazon links are working for me AFAICT.I can confirm, the RFD stripper no longer working. Here's a sample link: https://www.awin1.com/cread.php?awinmid=18530&awinaffid=139736&clickref=&p=https://www.samsung.com/ca/mobile-accessories/galaxy-tab-s8-ultra-book-cover-keyboard-black-ef-dx900bbegca/
Originally posted here: https://forums.redflagdeals.com/samsung-tab-s8-ultra-book-cover-keyboard-230-before-100-code-2560148/#p36433845
I accessed the RFD link on FireFox which uses Ublock and the EasyList filter blocked access with a warning if I wanted to proceed.
In Chrome I use Adguard and it allowed the sample awin1 link.
But you're right. Amazon links work, not RFD.
I've added a pattern for samsung.com
in the latest revision. I'll try to add more websites as I see them.
This script is only as good as the how up-to-date and complete REDIRECT_REGEX
is.
Added a pattern for go.redirctingnat.com
Example here https://forums.redflagdeals.com/western-digital-wd-red-plus-8tb-256mb-cache-149-99-18-75-tb-2590852/
{
name: 'redirectingat.com',
pattern: 'go.redirectingat.com/.*url=(?<baseUrl>.*).*',
},
Edit: changed the pattern so its a bit more bulletproof and easier to read.
Added a pattern for go.redirctingnat.com Example here https://forums.redflagdeals.com/western-digital-wd-red-plus-8tb-256mb-cache-149-99-18-75-tb-2590852/
{ name: 'redirectingat.com', pattern: 'go.redirectingat.com/\\?id=.*&xs=1&url=(?<baseUrl>.*)', },
Will this be added to the main version? It hasn't been updated since 02/16/2022.
I'd add it myself manually via editor on my PC but I don't know how.
Added a pattern for go.redirctingnat.com Example here https://forums.redflagdeals.com/western-digital-wd-red-plus-8tb-256mb-cache-149-99-18-75-tb-2590852/
{ name: 'redirectingat.com', pattern: 'go.redirectingat.com/\\?id=.*&xs=1&url=(?<baseUrl>.*)', },
Will this be added to the main version? It hasn't been updated since 02/16/2022.
I'd add it myself manually via editor on my PC but I don't know how.
You just have to add to the bottom of the REDIRECT_REGEX constant (variable) so that it looks like this:
const REDIRECT_REGEX = [
{
name: 'Amazon',
pattern: 'www.amazon.ca/gp/redirect.html\\?ie=UTF8&location=(?<baseUrl>.*?)(&|ref%3D|%3F)',
},
{
name: 'Best Buy',
pattern: 'bestbuyca.(.*).net(.*)\\?u=(?<baseUrl>.*)',
},
{
name: 'Samsung',
pattern: 'www.awin1.com(.*)\?p=(?<baseUrl>.*)',
},
{
name: 'redirectingat.com',
pattern: 'go.redirectingat.com/.*url=(?<baseUrl>.*).*',
},
];
Edit: changed the pattern so its a bit more bulletproof and easier to read.
Maybe this can be centralized somewhere? I created https://github.com/davegallant/rfd-redirect-stripper.
Feel free to open a PR.
Sent a PR.
I just noticed this fork has a lot of additional sites https://github.com/timwharton/rfd-redirect-stripper/blob/main/script.js
Sent a PR.
I just noticed this fork has a lot of additional sites https://github.com/timwharton/rfd-redirect-stripper/blob/main/script.js
I cherry-picked and pushed @timwharton's changes here.
Thanks for the update. I added @aman207 's code. However, I'm confused now with @davegallant 's script. I tried to add it (as a new script) file script.js into Tampermonkey but it came back with an error, "invalid userscript".
Additionally, I suppose there's no way to add a "wild card" feature because RFD is now adding their crap to every URL/link (site)? Adding them manually is quite time consuming, but appreciated nonetheless.
Thanks for the update. I added @aman207 's code. However, I'm confused now with @davegallant 's script. I tried to add it (as a new script) file script.js into Tampermonkey but it came back with an error, "invalid userscript".
Additionally, I suppose there's no way to add a "wild card" feature because RFD is now adding their crap to every URL/link (site)? Adding them manually is quite time consuming, but appreciated nonetheless.
Did you use the "raw" link when adding it? https://raw.githubusercontent.com/timwharton/rfd-redirect-stripper/main/script.js
Thanks for the update. I added @aman207 's code. However, I'm confused now with @davegallant 's script. I tried to add it (as a new script) file script.js into Tampermonkey but it came back with an error, "invalid userscript".
Additionally, I suppose there's no way to add a "wild card" feature because RFD is now adding their crap to every URL/link (site)? Adding them manually is quite time consuming, but appreciated nonetheless.Did you use the "raw" link when adding it? https://raw.githubusercontent.com/timwharton/rfd-redirect-stripper/main/script.js
Thanks. No. I used @davegallant link: https://gist.githubusercontent.com/davegallant/70fca6dc6fbb9d55ba456580339ccb22/raw/be0fbad0aad349778655a9052ff9ca73177e294b/rfd-redirect-stripper.js then I "right clicked" to "Save as" rfd-redirect-stripper.js. That didn't work. This is one of my major pet peeves about GH is I don't find it intuitive or simple to add a script or even download a file unless it's clear as crystal.
The URL link: https://github.com/davegallant/rfd-redirect-stripper.git won't update in Tampermonkey with the new changes.
I would just start from scratch. Copy and paste the text from here into a new script in tamper monkey
https://raw.githubusercontent.com/timwharton/rfd-redirect-stripper/main/script.js
Thanks for the update. I added @aman207 's code. However, I'm confused now with @davegallant 's script. I tried to add it (as a new script) file script.js into Tampermonkey but it came back with an error, "invalid userscript".
Additionally, I suppose there's no way to add a "wild card" feature because RFD is now adding their crap to every URL/link (site)? Adding them manually is quite time consuming, but appreciated nonetheless.Did you use the "raw" link when adding it? https://raw.githubusercontent.com/timwharton/rfd-redirect-stripper/main/script.js
Thanks. No. I used @davegallant link: https://gist.githubusercontent.com/davegallant/70fca6dc6fbb9d55ba456580339ccb22/raw/be0fbad0aad349778655a9052ff9ca73177e294b/rfd-redirect-stripper.js then I "right clicked" to "Save as" rfd-redirect-stripper.js. That didn't work. This is one of my major pet peeves about GH is I don't find it intuitive or simple to add a script or even download a file unless it's clear as crystal.
The URL link: https://github.com/davegallant/rfd-redirect-stripper.git won't update in Tampermonkey with the new changes.
I updated the gist to be the latest commit in main, but updating in both places is a bit cumbersome.
Maybe having the script dynamically update itself by fetching a github file would be better?
I would just start from scratch. Copy and paste the text from here into a new script in tamper monkey https://raw.githubusercontent.com/timwharton/rfd-redirect-stripper/main/script.js
@aman207 Ok.
I updated the gist to be the latest commit in main, but updating in both places is a bit cumbersome.
Maybe having the script dynamically update itself by fetching a github file would be better?
@davegallant Yes, that would be awesome if the script could update itself automatically.
How is this supposed to work? I installed from the zip file and Tampermonkey doesn't show the script.