Sun
Sun

Reputation: 3564

Download youtube videos with Java API?

I found similar questions in Stack Overflow, and I tried few of solutions. All are outdated, so I am raising a new issue.

I followed 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 audio (webm) separately. How can I combine 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);
        }
    }
}

Upvotes: 4

Views: 11038

Answers (1)

adjuremods
adjuremods

Reputation: 2998

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 "

Upvotes: 3

Related Questions