var products = Object.keys( Array.prototype.reduce.call( document.querySelectorAll('a.black'), function(obj, value){ var match = value.href.match(/\/products\/(\d+)\//); if(match) obj[match[1]] = true; return obj; }, {} ) )