The current API (http://vimeo.com/api/oembed) no longer supports thumbnails for private video's.

If a video’s privacy is set to anything other than public, private or password protected, only the embed code, width, and height will be returned.

source: https://developer.vimeo.com/apis/oembed

This would require the new API (developer.vimeo.com/api). See documentation on https://developer.vimeo.com/api/start

So the new API with keys and a token is needed to get a video thumbnail for private video's (https://api.vimeo.com/videos/{video_id}).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mpp created an issue. See original summary.

AndrewsizZ’s picture

did someone found any solution?

davps’s picture

FileSize
54.73 KB

@AndrewsizZ

Still supports and works.

Request:
https://vimeo.com/api/oembed.json?url=https://player.vimeo.com/video/vid...

Response:
Vimeo response

Check function _video_embed_field_get_vimeo_data in D7 version.

Joachim Namyslo’s picture

I am not sure if this is the right place to comment on, but if thumbnail generation just works with public videos on vimeo it should be documented somewhere in the meantime.

something like

  1. Make your videos privacy settings on vimeo.com to public
  2. Add your video to your media library or content
  3. run cron manually to make shure image gest generated quite well
  4. change the privacy settings for the affected video on vimeo.com, back to something else than public

As long as this is the only workaround it should be at least documented in the read me file as well on the modules page or in documentation as well as drupal's help system.

This bug is still active for 8.x, too so I'll create a new one with the same content.

nimoatwoodway’s picture

It's now possible to get meta data such as thumb url when vimeo video is private.
See API description (https://developer.vimeo.com/api/oembed/videos)

NOTE: In the case of a video with domain-level privacy, the oEmbed request returns a simplified response containing the embed code only and no private metadata. To get the complete response, send the Referer header along with the request, and set its value to the video's whitelisted domain.

So if we set the Referer and the domain we are using is whitelisted in privacy settings this will start working again.

Find patch attached.

sakiland’s picture

Thank you @nimoatwoodway

Patch #5 works for me.

This is not the best solution, better will be to implement new Vimeo's API, but it's fastest solution for this issue.

joelstein’s picture

Status: Active » Reviewed & tested by the community

Agreed; the patch in #5 works by adding the "Referer" header. But the thumbnail is small, and we could get higher resolution thumbnails by using Vimeo's API:

https://developer.vimeo.com/api/reference/videos#get_video_thumbnails

Though, that should probably happen in a separate issue.

joelstein’s picture

I created an issue to use the Vimeo API (rather than oEmbed) which would resolve this issue as well.

#3105171: Use Vimeo API to get thumbnails

Joachim Namyslo’s picture

@joelstein

Sounds great to me. Thank you.

rajeev_drupal’s picture

#5 worked for me. Not sure about usage if Vimeo API.

grasmash’s picture

Note that this is an issue for Drupal 8 as well. Non-public vimeo videos will not return a thumbnail_url unless the referrer is set. See Vimeo docs at https://developer.vimeo.com/api/oembed/videos#embedding-a-video-with-oem...

for videos with the whitelist privacy setting — that is, videos with domain-level privacy — the results are a little different. The oEmbed request returns a simplified response containing no private metadata

To get the complete response, including the private metadata, send the Referer header with the request, and set its value to the video's whitelisted domain.

grasmash’s picture

Note that PHP docs specifically say that using $_SERVER['HTTP_REFERER'] is unreliable:

The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

You need to get the base url from Drupal, not the server directly.

jrb’s picture

** Ignore -- see patch below ***
This is also a problem in the D8/9 version of this module. Patch attached.

jrb’s picture

Updated D9 patch.

I didn't realize my code *already* had a patch applied for a different (but related) Vimeo issue: #2872795: Error generating video thumbnail