trim url and clean the code