Use urllib instead of regexes to work with URLS where possible