上传视频至 Facebook 相册

发布于 2024-12-01 22:32:40 字数 352 浏览 0 评论 0原文

我已创建 Facebook 相册并拥有相册 ID。我可以使用 /photos API 将照片上传到相册。但我无法使用 /videos API 等上传视频。我收到错误消息:

“(#200) 用户无权发布到目标”

1) 这是否是受支持的 API 调用?我在 Facebook 的开发者网站上找不到太多这方面的信息。 2)是否是权限标志问题?我已经请求了publish_stream、photo_upload、video_upload、user_photos、user_videos。我不知道 photo_upload/video_upload 是否正确,但看到其他网站上有关 photo_upload 的示例,所以我只是假设可能有 video_upload。

I've created a Facebook album and have the album ID. I'm able to upload a photo to the album using the /photos API. But I can't upload a video using something like /videos API. I get the error message:

"(#200) User does not have permission to post to target"

1) Is that even a supported API call? I couldn't find much on Facebook's developer site on this.
2) Is it a permission flag problem? I have publish_stream, photo_upload, video_upload, user_photos, user_videos all requested. I don't know if photo_upload/video_upload are even proper ones, but saw examples from other sites about photo_upload so I just assumed there might be a video_upload.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纵情客 2024-12-08 22:32:40

是的,您可以上传视频。

确保您发布到的地方是您获得许可的地方。您可以在 http://developers.facebook.com/blog/post/ 查看代码示例493/

代码提取如下:

<?php 
$app_id = "YOUR_APP_ID";
$app_secret = "YOUR_APP_SECRET"; 
$my_url = "YOUR_POST_LOGIN_URL"; 
$video_title = "YOUR_VIDEO_TITLE";
$video_desc = "YOUR_VIDEO_DESCRIPTION";

$code = $_REQUEST["code"];

if(empty($code)) {
   $dialog_url = "http://www.facebook.com/dialog/oauth?client_id=" 
     . $app_id . "&redirect_uri=" . urlencode($my_url) 
     . "&scope=publish_stream";
    echo("<script>top.location.href='" . $dialog_url . "'</script>");
}

$token_url = "https://graph.facebook.com/oauth/access_token?client_id="
    . $app_id . "&redirect_uri=" . urlencode($my_url) 
    . "&client_secret=" . $app_secret 
    . "&code=" . $code;
$access_token = file_get_contents($token_url);

$post_url = "https://graph-video.facebook.com/me/videos?"
    . "title=" . $video_title. "&description=" . $video_desc 
    . "&". $access_token;

echo '<form enctype="multipart/form-data" action=" '.$post_url.' "  
     method="POST">';
echo 'Please choose a file:';
echo '<input name="file" type="file">';
echo '<input type="submit" value="Upload" />';
echo '</form>';
?>

yes, you can upload video.

Make sure you are posting to a place where u get permission to do so. You can see an example with code at http://developers.facebook.com/blog/post/493/

code extracted below:

<?php 
$app_id = "YOUR_APP_ID";
$app_secret = "YOUR_APP_SECRET"; 
$my_url = "YOUR_POST_LOGIN_URL"; 
$video_title = "YOUR_VIDEO_TITLE";
$video_desc = "YOUR_VIDEO_DESCRIPTION";

$code = $_REQUEST["code"];

if(empty($code)) {
   $dialog_url = "http://www.facebook.com/dialog/oauth?client_id=" 
     . $app_id . "&redirect_uri=" . urlencode($my_url) 
     . "&scope=publish_stream";
    echo("<script>top.location.href='" . $dialog_url . "'</script>");
}

$token_url = "https://graph.facebook.com/oauth/access_token?client_id="
    . $app_id . "&redirect_uri=" . urlencode($my_url) 
    . "&client_secret=" . $app_secret 
    . "&code=" . $code;
$access_token = file_get_contents($token_url);

$post_url = "https://graph-video.facebook.com/me/videos?"
    . "title=" . $video_title. "&description=" . $video_desc 
    . "&". $access_token;

echo '<form enctype="multipart/form-data" action=" '.$post_url.' "  
     method="POST">';
echo 'Please choose a file:';
echo '<input name="file" type="file">';
echo '<input type="submit" value="Upload" />';
echo '</form>';
?>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文