图谱 API 版

Video Captions

读取

VideoCaptions

例子

Graph API Explorer
GET /v19.0/{video-id}/captions HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/{video-id}/captions',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/{video-id}/captions",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{video-id}/captions",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{video-id}/captions"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
如果你希望详细了解如何使用图谱 API,请阅读我们的图谱 API 指南

参数

这个端点不包含任何参数。

字段

从这条连线读取将返回一个 JSON 格式的结果:

{ "data": [], "paging": {} }

data

VideoCaption 节点列表。

paging

详细了解分页功能,请见图谱 API 指南

错误代码

错误描述
104Incorrect signature

创建

你无法在此端点执行该操作。

更新

Permissions

To update a video's caption, you need one of the following:

  • User is the owner of the video
  • User has manage access on page that owns the video
  • User has advertiser access on account that owns the video

Limitations

The file size limit for video captions is 200K.

你可以向 /{video_id}/captions 发出 POST 请求,以更新 a Video

参数

参数描述
captions_file
file

Caption file in SRT (SubRip Text) format. File name must be in the format filename.locale.srt

default_locale
string

Specify which locale should be used as the default for the video. Can be set to 'none'

locales_to_delete
list<string>
默认值:Vector

locales of caption to delete

返回类型

这个端点支持先写后读,并会读取接收你的 POST 请求的节点。
Struct {
success: bool,
}

错误代码

错误描述
482The captions files you selected contain locales that had been applied to video, please remove and try again.
387There was a problem uploading your captions file. Please try again.
100Invalid parameter
386You uploaded a .SRT file with an incorrect file name. Please use this format: filename.en_US.srt
385The captions file you selected is in a format that we don't support.

删除

你无法在此端点执行该操作。