Create a function to parse amazon urls and reduce code redundancy.

A test for amazon url parsing was added.