Download youtube videos with Java API?

2019-03-05 16:45发布

I found similar questions in stack overflow, and I tried few of solutions. All are outdates. So I am rising a new issue. Please provide me latest solutions if you tried recently please.

I fallow and tried:

How to download videos from youtube on java?

I gone through the youtube-api, it not providing anything to download as I understand the samples provided in Github.

https://developers.google.com/youtube/v3/code_samples/java

It tried with latest VGet API, it working well but it downloading video(mp4) and audia(webm) seperately.

Do you have solution how to combile both.

import com.github.axet.vget.VGet;

public class YoutubeDownloadTool {

    public static void main(String[] args) {
        try {
            String url = "https://www.youtube.com/watch?v=7lFhwXeSidQ";
            String path = "D:\\videos";
            VGet v = new VGet(new URL(url), new File(path));
            v.download();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

1条回答
干净又极端
2楼-- · 2019-03-05 17:34

Downloading of videos is not supported in Youtube API. It is in fact prohibited. Under Terms of Service - II. Prohibitions it is mentioned that:

Prohibited

  1. store copies of YouTube audiovisual content

  2. use the YouTube API intentionally to encourage or promote copyright infringement or the exploitation of copyright-infringing materials;

Also, this SO thread states that is explicitly mentioned in Youtube Page terms

"You shall not download any Content unless you see a “download” or similar link displayed by YouTube on the Service for that Content. You shall not copy, reproduce, distribute, transmit, broadcast, display, sell, license, or otherwise exploit any Content for any other purposes without the prior written consent of YouTube or the respective licensors of the Content "

查看更多
登录 后发表回答