leedo / noembed

oEmbed gateway service with additional non-oEmbed sources
http://www.noembed.com
484 stars 90 forks source link

Long cache time and Vimeo thumbnail url change #120

Closed rchrdkn closed 1 year ago

rchrdkn commented 2 years ago

We're using ReactPlayer for a project which uses noembed.com to fetch video thumbnails for embeds. Vimeo have recently updated the urls for their video thumbnails within their oembed api and the previous urls no longer work.

I can see that you're using fastly for caching responses, and from the below snippet responses are being cached for 100 days.

https://github.com/leedo/noembed/blob/5a05fa5ee8cdc33760e87d3e931123389fe6619b/lib/Noembed/App.pm#L135

This is causing us to get the old thumbnail urls back from the noembed embed request, the Age header is currently ~25 days so won't be refreshed for over 2 months - examples below

New Vimeo: https://vimeo.com/api/oembed.json?url=https://vimeo.com/352941231

{
...
"thumbnail_url":"https:\/\/i.vimeocdn.com\/video\/1246701104-33c6e19c335afc5e6a6ccabaa694b462c5fd92dd69452827e7a17d07b8c4f904-d_295x166",
...
}

Noembed: https://noembed.com/embed?url=https://vimeo.com/352941231

{
...
"thumbnail_url":"https://i.vimeocdn.com/video/804956474_295x166",
...
}

Is it possible to purge the cache for Vimeo embeds?

Thanks

luwes commented 2 years ago

Not sure ReactPlayer is willing to change oEmbed API, they can host Playerx oEmbed themselves too on a free tier. Or if it's possible to add a oEmbedUrl API property or something. https://github.com/playerxo/oembed#purge-cached-resource

srtena commented 2 years ago

I think this is also a problem if you ever fetch a private video: noembed will cache the {"error":"404 Not Found","url":"https://vimeo.com/647024531"} so you won't be able to retrieve the info even if you turn it public later. So... +1

cookpete commented 2 years ago

It’s worth noting that ReactPlayer lets you pass your own thumbnail URL, fetched from wherever you like, as the light prop.

<ReactPlayer
  url={myVimeoUrl}
  light={myFetchedImageUrl}
/>