I used the following code to download HTML files and subtitle files over the Internet. But when I give the url of a Youtube video, the download stops very quickly and though some file IS downloaded, it doesn't open. Why ?
class read
{
public static void main(String aa[])throws IOException
{
byte a;
int b,c,d;
URL url=new URL("http://www.youtube.com/v/sHQXU9Kzgr8&color1=0xb1b1b1&color2=0xd0d0d0&hl=en_US&feature=player_detailpage&fs=1");
URLConnection conn=url.openConnection();
InputStream stream=conn.getInputStream();
FileOutputStream out=new FileOutputStream("/home/daud/Desktop/video");
while ((b=stream.read())!=-1)
out.write(b);
}
}