使用 Java API 下载 YouTube 视频? [英] Download youtube videos with Java API?

查看:104
本文介绍了使用 Java API 下载 YouTube 视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Stack Overflow 中发现了类似的问题,我尝试了一些解决方案.所有都过时了,所以我提出了一个新问题.

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

我跟随并尝试过:

如何在 java 上从 youtube 下载视频?

我浏览了 youtube-api,它没有提供任何下载,因为我了解 Github 中提供的示例.

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

它尝试使用最新的 VGet API,它运行良好,但它下载视频(mp4)和音频(webm) 分开.我怎样才能将两者结合起来?

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);
        }
    }
}

推荐答案

Youtube API 不支持下载视频.实际上是被禁止的.根据 服务条款 - II.禁止提到:

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

禁止

  1. 存储 YouTube 视听内容的副本

  1. store copies of YouTube audiovisual content

故意使用 YouTube API 来鼓励或促进侵犯版权或利用侵犯版权的材料;

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

此外,这个 SO 线程Youtube Page 条款

"除非您在服务上看到 YouTube 为该内容显示的下载"或类似链接,否则您不得下载任何内容.未经 YouTube 或内容的相应许可方事先书面同意,您不得出于任何其他目的复制、复制、分发、传输、广播、展示、出售、许可或以其他方式利用任何内容

"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 "

这篇关于使用 Java API 下载 YouTube 视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆