youtube - android URL stream cannot get whole data -
i'm trying youtube download link using this
string data = geturl("http://www.youtube.com/get_video_info?video_id=" + id);
but return part of data. end of data "..." example,
expire%253d1391242316%2526ms%253dau%2526fexp%253d900356%25252c902546%25252c936910%252...
i used code
public string geturl(string s){ inputstream = null; try{ url r = new url(s); urlconnection rc = r.openconnection(); datainputstream dis = new datainputstream(rc.getinputstream()); list<byte> l = new arraylist<byte>(); while(true){ try{ l.add(dis.readbyte()); }catch(exception e){ break; } } byte[] b = new byte[l.size()]; for(int = 0; < l.size(); i++){ b[i] = l.get(i); } return new string(b,"utf-8"); }catch(exception e){ e.printstacktrace(); return null; } }
is there why can't whole data? can downloaded if use chrome url
http://www.youtube.com/get_video_info?video_id=itgnqbjwrsk
it downloads whole file. streaming can't.
i stupid!. debug window value.
i logged string length , found same total file length.
Comments
Post a Comment