Вопрос

I am not 100% sure if this is something wrong with Youtube's endpoint of if i am doing something wrong.

The problem came about when I was embedding a Youtube video in WordPress. I did all the debugging through WordPress core and narrowed it down to the response from the Youtube endpoint that returns the oEmbed from youtube.

Endpoint:

https://www.youtube.com/oembed?maxwidth=640&maxheight=960&url=youtu.be%2FI0dQx4SNSwE&format=json

Response (raw):

{"thumbnail_height": 360, "width": 640, "thumbnail_width": 480, "provider_url": "http:\/\/www.youtube.com\/", "html": "\u003ciframe width=\"640\" height=\"360\" src=\"http:\/\/www.youtube.com\/embed\/I0dQx4SNSwE?feature=oembed\" frameborder=\"0\" allowfullscreen\u003e\u003c\/iframe\u003e)", "height": 360, "type": "video", "version": "1.0", "title": "Why Do We Yawn?", "author_name": "AsapSCIENCE", "thumbnail_url": "http:\/\/i1.ytimg.com\/vi\/I0dQx4SNSwE\/hqdefault.jpg", "provider_name": "YouTube", "author_url": "http:\/\/www.youtube.com\/user\/AsapSCIENCE"}

Response: (formatted)

{
    "thumbnail_height": 360,
    "version": "1.0",
    "provider_name": "YouTube",
    "thumbnail_url": "http://i1.ytimg.com/vi/I0dQx4SNSwE/hqdefault.jpg",
    "title": "Why Do We Yawn?",
    "html": "<iframe width=\"640\" height=\"360\" src=\"http://www.youtube.com/embed/I0dQx4SNSwE?feature=oembed\" frameborder=\"0\" allowfullscreen></iframe>)",
    "provider_url": "http://www.youtube.com/",
    "type": "video",
    "height": 360,
    "author_url": "http://www.youtube.com/user/AsapSCIENCE",
    "thumbnail_width": 480,
    "author_name": "AsapSCIENCE",
    "width": 640
}

As you can see at the end of the 'html' attribute there is an extra "/iframe\u003e)"

Am I doing something wrong or is there something wrong with Youtube? I am at a loss for words. I would really like to think that Youtube would be smart enough to not return something like this, so I have to think it is something I am doing wrong...

Это было полезно?

Решение

See this similar problem, looks like a known bug:

https://productforums.google.com/forum/#!topic/youtube/1jGhK-g8r4E

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top