Bug fixes for unformatted URL

This is version 1.3, which enables the user to simply type in the name
of the website,  for example: google, and the code will automatically
add the http://www. and the .com at the end. This makes it easier for
people who are not accustomed to the (http://%@.com, urlName) format.
This was in response to a bug which appeared when I tried to show my
dad this bit of code (one of my first real projects), and it didn’t
work. I still need to figure out how to implement the technology for
detecting what the URL suffix is for any given website, and returning
it. So, for example, were I to enter usa to the command line, the URL
would become usa.com, but I want it to be .gov. How can I detect that?
I must have to parse google search results. Any ideas?