Use TemoraryFile to avoid using urlopen() twice on one url

I found the script will try to fetch a URL twice. It may cause some some server timeout. With the change, the script will only fetch a URL once and store the content in a temporary file. So the data can be reused without fetching the URL again.