ruby-on-railsyoutubeoembed

Youtube oembed 401 unauthorized for some videos


I'm currently facing a 401 Unauthorized error using the ruby gem "ruby-oembed" which use oEmbed and noembed libs.

I tried it directly with oembed and noembed and I got the following result

$> https://noembed.com/embed?url=https://www.youtube.com/watch?v=3xlegeyULX8
$> {"error":"401 Unauthorized","url":"https://www.youtube.com/watch?v=3xlegeyULX8"}

and you can try it with oembed here with this youtube video https://www.youtube.com/watch?v=3xlegeyULX8

I tried to check if the video is private or has different settings but I can't find any settings different with working cases.

Any idea why it could cause it?


Solution

  • The video you shared 3xlegeyULX8 isn't embeddable, as YouTube Data API v3 Videos: list#status.embeddable is false for this video (cf https://www.googleapis.com/youtube/v3/videos?part=status&id=3xlegeyULX8&fields=items(status/embeddable)&key=API_KEY)

    status.embeddable

    boolean

    This value indicates whether the video can be embedded on another website.