No, there isn't a way to do this simply within the API. You will need a set of pattern matching to match the various types of urls to extract either ...
Lee mas