How to upload to YouTube using the API via a Proxy Server(如何通过代理服务器使用 API 上传到 YouTube)
问题描述
我正在构建一个应用程序,它允许用户将视频上传到你 Tube 上的特定帐户.
I am building an application which will allow users to upload videos to a specific account on you tube.
我已按照 http://code.google.com 上的示例进行操作/apis/youtube/2.0/developers_guide_dotnet.html 用于直接上传,但是当调用 request.Upload(newVideo)
时,我现在需要进行 407 代理身份验证.
I have followed the examples on http://code.google.com/apis/youtube/2.0/developers_guide_dotnet.html for direct upload however I am now getting a 407 proxy authentication required when request.Upload(newVideo)
is called.
我找到了一个使用代理的 Google 日历服务示例 (http://code.google.com/p/google-gdata/wiki/WebProxySetup )但似乎无法解决如何为 YouTube 重构它.
I've found an example for the Google Calendar Service using a proxy ( http://code.google.com/p/google-gdata/wiki/WebProxySetup )but can't seem to work out how to refactor it for YouTube.
有什么想法吗?
推荐答案
使用 Randolpho 提供的代码,我设法获得了成功调用 YouTube 的代码.我设法将代码简化为更多
Using the code provided by Randolpho I managed to get the code to successfully call YouTube. I managed to simplfy the code more to
YouTubeRequest request = new YouTubeRequest(settings);
GDataRequestFactory f = (GDataRequestFactory)request.Service.RequestFactory;
WebProxy myProxy = new WebProxy("http://proxy-server:port/", true);
myProxy.Credentials = CredentialCache.DefaultNetworkCredentials;
f.Proxy = myProxy;
代码将使用可以访问互联网的服务帐户运行,因此我不需要在代码中提供用户名和密码.
The code will be running with a service account with access to the internet so I shouldn't need to provide a username and password in the code.
这篇关于如何通过代理服务器使用 API 上传到 YouTube的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何通过代理服务器使用 API 上传到 YouTube


基础教程推荐
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01