I have this piece of code for my website
function extractASIN(link) {
const asinMatch = link.match(//(?:dp|gp/product|exec/obidos|aw/d)/(B[0-9A-Z]{9}|w{10})|a.co/(?:[^/]+/)?(w{7})(/|?|#|$)/);
console.log('Link:', link);
console.log('Match:', asinMatch);
if (asinMatch) {
return asinMatch[1] || asinMatch[2];
} else {
return '';
}
}
when using the output from a a.co link I expect to get the product to pop up but instead i tend to always get redirected to the homepage of amazon and was wondering if there was a way to convert the a.co to amazon.ca