fix urls and allow '~' in download path

Hi,
I just made a couple of changes to the script. I fixed the url issue that I brought up before (it now uses "id" for echess, "lid" for everything else), and also allowed the use of ~ in the download path. Let me know what you think, and it would be great if you can merge in the changes!
Thanks,
Sean