私はvimeo APIキーを持っていて、私はこのURLをhttps://vimeo.comのビデオにアップロードし、このリンクからすべてのビデオリンクを取得してください。https://vimeo.com/home/myvideos今私はすべての私のビデオリンクの詳細のための応答を得ました。php:私のvimeoアカウントでビデオURLを取得する方法
<?php
$urls = array();
$videos = array();
// vimeo test
$urls[] = 'https://vimeo.com/243625359';
$urls[] = 'https://vimeo.com/243438242';
foreach ($urls as $url) {
$videos[] = getVideoDetails($url);
}
function getVideoDetails($url)
{
$host = explode('.', str_replace('www.', '', strtolower(parse_url($url, PHP_URL_HOST))));
$host = isset($host[0]) ? $host[0] : $host;
switch ($host) {
case 'vimeo':
$video_id = substr(parse_url($url, PHP_URL_PATH), 1);
$hash = json_decode(file_get_contents("http://vimeo.com/api/v2/video/{$video_id}.json"));
// header("Content-Type: text/plain");
// print_r($hash);
// exit;
return array(
'provider' => 'Vimeo',
'title' => $hash[0]->title,
'description' => str_replace(array("<br>", "<br/>", "<br />"), NULL, $hash[0]->description),
'description_nl2br' => str_replace(array("\n", "\r", "\r\n", "\n\r"), NULL, $hash[0]->description),
'thumbnail' => $hash[0]->thumbnail_large,
'video' => "https://vimeo.com/" . $hash[0]->id,
'embed_video' => "https://player.vimeo.com/video/" . $hash[0]->id,
);
break;
}
}
header("Content-Type: text/plain");
print_r($videos);
応答:
Array
(
[0] => Array
(
[provider] => Vimeo
[title] => SampleVideo_1280x720_10mb
[description] => Vimeo was born in 2004, created by a group of
filmmakers who wanted an easy and beautiful way to share videos with
their friends. Word started to spread, and an insanely supportive
community of creators began to blossom. Now Vimeo is home to more
than:
[description_nl2br] => Vimeo was born in 2004, created by a group of
filmmakers who wanted an easy and beautiful way to share videos
with their friends. Word started to spread, and an insanely
supportive community of creators began to blossom. Now Vimeo is home
to more than:
[thumbnail] => http://i.vimeocdn.com/video/667808655_640.jpg
[video] => https://vimeo.com/243625359
[embed_video] => https://player.vimeo.com/video/243625359
)
[1] => Array
(
[provider] => Vimeo
[title] => SampleVideo_1280x720_5mb
[description] => We spend our days building a product we love for a growing community of millions. And eating lots of free snacks.
[description_nl2br] => We spend our days building a product we love for a growing community of millions. And eating lots of free snacks.
[thumbnail] => http://i.vimeocdn.com/video/667575091_640.jpg
[video] => https://vimeo.com/243438242
[embed_video] => https://player.vimeo.com/video/243438242
)
)
それは良いことです。私はビデオリンクを手動で適用しましたが、ビデオリンクを動的に適用する正しい方法です。私はベースのAPIキーで私のvimeoビデオURLを取得したい。