我想从 Vimeo 获取视频的缩略图。
从 Youtube 获取图片时,我只是这样做:
http://img.youtube.com/vi/HwP5NG-3e8I/2.jpg
知道如何为 Vimeo 做些什么吗?
最佳答案
提出视频请求
To get data about a specific video, use the following url:
http://vimeo.com/api/v2/video/video_id.output
video_id The ID of the video you want information for.
output Specify the output type. We currently offer JSON, PHP, and XML formats.
所以得到这个 URL http://vimeo.com/api/v2/video/6271487.xml
<videos>
<video>
[skipped]
<thumbnail_small>http://ts.vimeo.com.s3.amazonaws.com/235/662/23566238_100.jpg</thumbnail_small>
<thumbnail_medium>http://ts.vimeo.com.s3.amazonaws.com/235/662/23566238_200.jpg</thumbnail_medium>
<thumbnail_large>http://ts.vimeo.com.s3.amazonaws.com/235/662/23566238_640.jpg</thumbnail_large>
[skipped]
</videos>
为每个视频解析此内容以获取缩略图
这是 PHP 中的大致代码
<?php
$imgid = 6271487;
$hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/$imgid.php"));
echo $hash[0]['thumbnail_medium'];
关于html - 从 Vimeo 获取 img 缩略图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1361149/