diff --git a/video_embed_field.handlers.inc b/video_embed_field.handlers.inc index dfeb860..121b4b6 100644 --- a/video_embed_field.handlers.inc +++ b/video_embed_field.handlers.inc @@ -431,9 +431,16 @@ function video_embed_field_handler_youtube_form_validate($element, &$form_state, function _video_embed_field_get_vimeo_id($url) { $pos = strripos($url, '/'); if ($pos != FALSE) { - $pos += 1; - return (int) substr($url, $pos); - } + $matches = ""; + $vid_id = ""; + preg_match_all('!\d+!', $url, $matches); + foreach($matches as $i => $row) { + foreach($row as $b => $digits ) { + if(strlen($digits) >= 8) { + $vid_id = $digits; + } + } + } return FALSE; } @@ -487,12 +494,10 @@ function video_embed_field_handle_vimeo_thumbnail($url) { $info = array( 'id' => $id, ); - $response = drupal_http_request('http://vimeo.com/api/v2/video/' . $id . '.php'); + $response = drupal_http_request('http://vimeo.com/api/oembed.json?url=http://vimeo.com/'.$id); if (!isset($response->error)) { - $response = unserialize($response->data); - $video = current($response); - - $image_url = $video['thumbnail_large']; + $video = json_decode($response->data, TRUE); + $image_url = $video['thumbnail_url']; $info['url'] = $image_url; } return $info;