使用 Dropbox 公共链接将视频上传到 YouTube?
我正在使用 youtube ZEND gdata api 将视频上传到我的 youtube 帐户。但现在我需要将存储在我的 DropBox 帐户中的视频上传到 YouTube。我有视频文件的公共链接或直接链接。我使用的代码是:
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_App_Exception');
$developerKey = '******************';
$applicationId = '*********';
$clientId = '';
$video_title = 'test movie';
$video_description = 'test movie';
$video_category = 'Entertainment';
$video_tags = 'test,movie';
$path_of_uploaded_file = 'http://dl.dropbox.com/uhh/336/test.wmv';
$authenticationURL= 'https://www.google.com/youtube/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
$username = '*****',
$password = '*****',
$service = 'youtube',
$client = null,
$source = '*******', // a short string identifying your application
$loginToken = null,
$loginCaptcha = null,
$authenticationURL);
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
$yt = new Zend_Gdata_YouTube($httpClient);
// create a new VideoEntry object
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
// create a new Zend_Gdata_App_MediaFileSource object
$filesource = $yt->newMediaFileSource($path_of_uploaded_file);
..
.
.
.
.
.?>
我收到的错误是:要上传的文件 http://dl.dropbox.com/uhh/336/test.wmv 不存在或不可读。
我什至不知道为什么 YouTube 会抛出此错误尽管 URL 是直接(公共)链接。我不明白我的代码有什么问题以及为什么它不起作用。请帮助:)
I am using youtube ZEND gdata api to upload videos to My youtube account.But now I need to upload videos to YouTube which are stored in my DropBox account.I have public links or direct links for video files.Code I am using is:
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_App_Exception');
$developerKey = '******************';
$applicationId = '*********';
$clientId = '';
$video_title = 'test movie';
$video_description = 'test movie';
$video_category = 'Entertainment';
$video_tags = 'test,movie';
$path_of_uploaded_file = 'http://dl.dropbox.com/uhh/336/test.wmv';
$authenticationURL= 'https://www.google.com/youtube/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
$username = '*****',
$password = '*****',
$service = 'youtube',
$client = null,
$source = '*******', // a short string identifying your application
$loginToken = null,
$loginCaptcha = null,
$authenticationURL);
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
$yt = new Zend_Gdata_YouTube($httpClient);
// create a new VideoEntry object
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
// create a new Zend_Gdata_App_MediaFileSource object
$filesource = $yt->newMediaFileSource($path_of_uploaded_file);
..
.
.
.
.
.?>
Error I am getting is:File to be uploaded at http://dl.dropbox.com/uhh/336/test.wmv does not exist or is not readable.
I don't why YouTube is throwing this error even though the URL is direct(Public) link. I am not getting what's wrong with my code and why it is not working.Please help :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
为了防止其他人仍在寻找答案,我在使用 Dropbox 编写的应用程序读取 txt 文件时遇到了类似的问题。我发现我没有使用正确的直接链接格式。正确的链接(对于此线程示例链接)将是:
dl.dropboxusercontent.com/uhh/336/test.wmv
只需将“www”更改为“dl”即可用于网络浏览器,因为它们会自动处理重定向。对于应用程序和脚本,您必须集成重定向处理。或者只是正确格式化直接链接。
Just in case other are still looking for answers, I had a similar problem reading txt files with an app I wrote from Dropbox. I discovered that I wasn't using the right direct-link format. The correct link (for this threads example link) would be:
dl.dropboxusercontent.com/uhh/336/test.wmv
Just changing 'www' to 'dl' will work for web-browser as they handle redirects automatically. For apps and scripts you would have to integrate handling of redirects. Or just format the direct-link correctly.
鉴于所提供的信息,不可能明确回答这个问题,但我们可以将其范围缩小到几种可能性。我建议您运行此快速调试清单:
如果您使用相同的凭据将该确切链接复制/粘贴到您的网络浏览器中,您是否能够下载视频?
如果不是,则可能是凭据或 URL 本身有问题。
如果您能够从浏览器下载它,则表示您的代码有问题或 YouTube 存在问题。
如果您完成了上述步骤,但仍然陷入僵局,请将您的结果作为评论发布,我们将进行更深入的研究。
It's impossible to answer this question definitively given the information provided, but we can narrow it down to a few possibilities. I would recommend you run down this quick debugging checklist:
If you copy/paste that exact link into your web browser, using the same credentials, are you able to download the video?
If not, then it's either a problem with the credentials or the URL itself.
If you are able to download it from the browser, then it means there's something wrong with your code or an issue with YouTube.
If you run through the above steps but you're still at an impasse, please post your results as a comment and we'll delve deeper.
您上传到 YouTube 的文件必须位于本地路径。
The file you're uploading to YouTube must be on a local path.
在保管箱中“获取链接”给出“保管箱页面的链接”。
试试这个。
希望这有帮助
In dropbox "get link" gives "link of dropbox page".
Try this.
Hope this helps