C# 从 YouTube 下载视频
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1083164/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Downloading video from YouTube
提问by Maxim Zaslavsky
I wish to download a video from YouTube and then extract its audio.
我希望从 YouTube 下载视频,然后提取其音频。
Can anyone point me to some C# code to download a video?
谁能指点我一些 C# 代码来下载视频?
For clarification purposes, I already know how to extract audio from a .FLV file like these.
为了澄清起见,我已经知道如何从这样的 .FLV 文件中提取音频。
采纳答案by Flagbug
Since all the other answers are outdated, I've written a library that is up-to-date:
由于所有其他答案都已过时,因此我编写了一个最新的库:
回答by mlvljr
To all interested:
致所有感兴趣的人:
The "Coding for fun"book's chapter 4 "InnerTube: Download, Convert, and Sync YouTube Videos"deals with the topic. The code and discussion are at http://www.c4fbook.com/InnerTube.
“为乐趣而编码”一书的第 4 章“InnerTube:下载、转换和同步 YouTube 视频”涉及该主题。代码和讨论位于http://www.c4fbook.com/InnerTube。
[PLEASE BEWARE] While the overall concepts are valid some years after the publication, non-documented details of the youtubeinternals the project relies on can have changed (see the comment at the bottom of the page behind the second link).
[请注意] 虽然整体概念在发布几年后仍然有效,但项目所依赖的youtube内部结构的未记录细节可能已更改(请参阅页面底部第二个链接后面的评论)。
回答by James Ko
回答by Tyrrrz
Gonna give another answer, since the libraries mentioned haven't been actively developed anymore.
将给出另一个答案,因为提到的库不再被积极开发。
Consider using YoutubeExplode. It has a very rich and consistent API and allows you to do a lot of other things with youtube videos beside downloading them.
考虑使用YoutubeExplode。它具有非常丰富且一致的 API,除了下载 YouTube 视频外,它还允许您对 YouTube 视频执行许多其他操作。
回答by Javid
I suggest you look into SharpGrabber- a .NET Standard library written just for this purpose. It is newer than YouTubeExtractor and libvideo.
It supports YouTubeand Instagramas the time of this answer. This project also offers high-quality video and audio mixing and a cross-platform desktop application.
我建议您查看SharpGrabber- 一个专门为此目的编写的 .NET Standard 库。它比 YouTubeExtractor 和 libvideo 更新。它支持YouTube并Instagram作为此答案的时间。该项目还提供高质量的视频和音频混合以及跨平台的桌面应用程序。

