Vimeo缩略图在PHP中的私人视频



我已经尝试了这个论坛上的每一个答案,但无法获得正确的工作代码。所以我再次发布此消息。我想从Vimeo获得私人和隐藏视频的缩略图。我还生成了一个访问令牌,我试图将其与为旧问题提供的解决方案一起使用,但这些解决方案也不起作用。

我试过这个代码

https://vimeo.com/api/oembed.json?url=https://vimeo.com/531126552/access_token

还尝试使用cURL


curl_setopt($curl_h, CURLOPT_HTTPHEADER,
array(
'Authorization: bearer {access_token}',
'Accept: application/vnd.vimeo.*+json;version=3.4',
)
);
curl_setopt($curl_h, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl_h);

上述cURL代码的响应是:

{"error":"Something strange occurred. Please contact the app owners.","link":null,"developer_message":"No user credentials were provided.","error_code":8003}

请建议我一种方法来做这件事,或者帮助我找到错误所在。

缩略图可以通过Oembed API提供的JSON数据中的thumbnail_url访问示例:https://vimeo.com/api/oembed.json?url=https://vimeo.com/{video_id}/

以下是适用于公共视频的内容。我知道你问过私人的事,所以我会问,如果你想明白的话。。。打电话给我,试着找出同样的答案。

对其他人来说,这是公共解决方案。它失败的是私人视频。

function mmd_get_vimeo_info( $video_id ) 
{
// https://vimeo.com/api/oembed.json?url=https://vimeo.com/

$VimeoConnectLink        = "https://vimeo.com/api/oembed.json?url=https://vimeo.com/" . $video_id ;   
$request                 = wp_remote_get( esc_url_raw($VimeoConnectLink));
if ('error' == $request || is_wp_error($request))
return ""; 

$response = wp_remote_retrieve_body( $request );
if ('error' == $response || is_wp_error($response))
return ""; 

$video_array = json_decode( $response, true );

// Looking for [title], [thumbnail_url] [duration]
return $video_array;
}

但如果域隐私到位,它可能会失败。

最新更新