2013-04-10 123 views
1

目前我在一個Android應用程序的工作中,我們有下載YouTube視頻的功能,所以沒有谷歌alllow的YouTube視頻下載在我們的應用谷歌是否允許YouTube視頻下載在我們的應用程序

感謝

+0

有網站喜歡'tubidy.com'和'vuclip.com'提供的YouTube視頻下載,所以有可能的方式 – Pragnani 2013-04-10 09:59:51

+0

所以有什麼協議或條款,我們必須接受下載視頻? – bindal 2013-04-10 10:01:43

+0

坦率地說,我不知道,但它是合法的,因爲我看到幾個應用程序做同樣的事情。但這裏的艱鉅任務是如何轉換攝像機? – Pragnani 2013-04-10 10:04:40

回答

1

不,這將是非法的。 Google不允許這樣做。您只能在網頁瀏覽中查看視頻。
[編輯]
您可以流中的任何視圖中的視頻。但我不知道那一個的法律迴應。

1
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 
       } 
    } 

這在某些情況下有效,並且在某些情況下不起作用。在這種情況下,您需要從html源代碼中獲取url,刪除不必要的內容並使用此代碼解碼url以下載。

回答this link

+0

感謝哥爲你的代碼,但我已經有一個代碼,但我只是想知道谷歌是否允許這項功能在我們的應用程序或不? – bindal 2013-04-10 10:04:13

+0

它是非法的。 http://www.pcadvisor.co.uk/how-to/internet/3420353/is-it-legal-download-youtube-videos/此鏈接將給出確切的原因。您不會發現任何應用程序允許在Play商店的YouTube下載器類應用程序出於完全相同的原因。 youtube下載只適用於谷歌本身設計的特定應用程序。 – 2013-04-10 10:12:27

相關問題