I'm building one of these at the moment.
It's to process URLs, and it's just a part of what I need, but knowing that others might like such a thing means I'll see if I can open it up afterwards.
I'm looking to achieve this by two methods:
1) If the link contains the ID of the end page (i.e. ASIN for Amazon), then reconstruct the URL of the end page.
2) For places in which #1 fails, follow the link and seek to determine whether a permalink or canonical URL exists at the end page.
Ironically I seek to strip affiliate codes in order to add my own in my given use case... but I'm using golang and am trying to structure it all in a flow based way in which stripping and adding codes are just separate steps.
So it doesn't seem to me to be too hard to then expose each side as a service by itself.