Added exception blocks so that json loads fail more gracefully

Added error checking for server responses. Sometimes, the server just
returns the front page. Not sure why this is. In this case, the
json.loads barfs out.

In get_shortened_url:
Changed the logic that was used to extract the shortened URL. When we
iterated over all lines of the json response, there was a chance that
the term "short_url" would turn up in the middle, and the json.load
method would barf. Since we know that the short_url response is always
in the third last line, I'm using this information instead.