Currently i am working on one android application in which we have feature of downloading youtube videos , so does google alllow download of youtube videos in our application
Thanks
Currently i am working on one android application in which we have feature of downloading youtube videos , so does google alllow download of youtube videos in our application
Thanks
As per my knowledge you can not directly do this..
Currently what you are doing is, opening a http connection on url and then saving the buffer.
This is not allowed as per thread by google
http://support.google.com/youtube/bin/answer.py?hl=en&answer=56100
But ofcourse there are other ways:
like what i have noticed with other sites is that they themselves upload content on sites like dailymotion etc and then create a new website where they give this video uploader site link and then they say "this is third party content, we do not host this video"
This is basically done to avoid copyright law.
In this case, video creator will have to sue sites like dailymotion and not video uploader, which is not easy for a small player.
But again they have expert lawyers to tell them what they can do to avoid copyright and save their @ss in trouble because they are basically exploiting some loopholes.
So whatever you do, you need expert advice, because directly, it is illegal.
No that would be illegal. Google does not allow that. You can only view the videos in a webview.
[Edit]
you can stream the videos in any view. But I dont know the legal repurcussions of that one.
URL u = null;
InputStream is = null;
try {
u = new URL(url);
is = u.openStream();
HttpURLConnection huc = (HttpURLConnection)u.openConnection();//to know the size of video
int size = huc.getContentLength();
if(huc != null){
String fileName = "FILE.mp4";
String storagePath = Environment.getExternalStorageDirectory().toString();
File f = new File(storagePath,fileName);
FileOutputStream fos = new FileOutputStream(f);
byte[] buffer = new byte[1024];
int len1 = 0;
if(is != null){
while ((len1 = is.read(buffer)) > 0) {
fos.write(buffer,0, len1);
}
}
if(fos != null){
fos.close();
}
}
}catch (MalformedURLException mue) {
mue.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
if(is != null){
is.close();
}
}catch (IOException ioe) {
// just going to ignore this one
}
}
this works in some cases and doesn't work in some. You need to take the url from the html source code in this case, remove unnecessary things and decode the url to download using this code.
Answer copied from this link