使用 Youtube API 只播放音频 [英] Using Youtube API to play just audio

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

问题描述

我们是几个软件开发人员,正计划制作一些商业扩展或一些网站,通过这些网站,互联网连接速度较慢或数据有限的用户可以通过 YouTube 的 API 播放几乎所有视频.虽然在浏览 API 文档时,我们浏览了以下部分,

We are a couple of software developers and were planning on making some commercial extension or some website through which users, with slow internet connections or limited data could play almost any video through YouTube's API. Although, while going through the API docs, we came through the following section,

Your API Client will not, and You will not encourage or create functionality for Your users or other third parties to:

    "separate, isolate, or modify the audio or video components of any YouTube audiovisual content made available through the YouTube API"

-Kuan Yong, YouTube API Team

有没有这样的合法方式可以仅禁用视频和流音频,即使使用商业 API 也不行?

Is there no such legal way through which we can disable just the video and stream audio, not even with the commercial API?

希望得到肯定的答复.

推荐答案

只播放音频意味着隔离音频,这明显违反了 YouTube API 的条款和条件.但是,据我所知,不使用 YouTube API 时没有这样的限制.例如,youtube-dl,这是 YouTube 和数百个其他网站的视频下载器, 具有仅下载音频的功能.

Playing just audio means isolating audio, which is a clear violation of the terms and conditions of the YouTube API. However, as far as I know, there is no such restriction when not using the YouTube API. For example, youtube-dl, which is a video downloader for YouTube and hundreds of other websites, has the functionality to download just audio.

实际上,在 YouTube 的格式中,音频和视频实际上是存储在服务器上的单独文件中.这意味着您实际上可以获取音频文件的路径并将其流式传输给您的用户.查看开源 youtube-dl,特别是 youtube 模块,了解更多详情.

In fact, in YouTube's format, audio and video are actually stored in separate files on the server. This means you can actually acquire the path to the audio file and stream it to you users. Check out the open-source youtube-dl, specifically the youtube module, for more details.

编辑

我仅仅链接到一个库的原因是 YouTube 不断地改变它们的格式、存储和流式传输视频的方式.这意味着检索视频音频组件的直接链接是一项经常更改的任务.如果您可以链接到 youtube-dl 的 python 模块,您就可以在发生此类更改时利用它们的更新.

The reason I am merely linking to a library is that YouTube continually changes the way they format, store, and stream video. This means that retrieving the direct link to a video's audio component is a task subject to frequent change. If you can link against youtube-dl's python module, you can make use of their updates whenever such changes occur.

免责声明

我不完全确定这是否都是合法的等等.因此,我对您的决定不承担任何责任,也不宽恕此类行为.

I am not fully sure if this is all legal and whatnot. Hence, I take no responsibility for your decision on what to do, nor do I condone this kind of behavior.

这篇关于使用 Youtube API 只播放音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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