[wp-trac] [WordPress Trac] #41201: Youtube Embed URL is not working in video widget

WordPress Trac noreply at wordpress.org
Fri Jul 21 19:22:20 UTC 2017


#41201: Youtube Embed URL is not working in video widget
-----------------------------------+------------------------------
 Reporter:  kakshak                |       Owner:
     Type:  defect (bug)           |      Status:  reopened
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Media                  |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-screenshots close  |     Focuses:
-----------------------------------+------------------------------

Comment (by timmydcrawford):

 So I apologize I spoke too soon on the simplicity of adding support for
 the embed url.  It appears YouTube itself does not support using the embed
 url when making requests to their oembed endpoint.  Take for example the
 following video:

 url: https://www.youtube.com/watch?v=ea2WoUtbzuw
 share url: https://youtu.be/ea2WoUtbzuw
 embed url: https://www.youtube.com/embed/ea2WoUtbzuw

 The first two URL's work properly against YouTube's oembed endpoint, which
 is what is ultimately called by {{{WP_oEmbed->fetch}}}

 url:
 https://www.youtube.com/oembed?maxwidth=600&maxheight=788&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dea2WoUtbzuw
 share:
 https://www.youtube.com/oembed?maxwidth=600&maxheight=788&url=https%3A%2F%2Fyoutu.be%2Fea2WoUtbzuw

 Both return valid oembed objects, but using the embed url does not:

 https://www.youtube.com/oembed?maxwidth=600&maxheight=788&url=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fea2WoUtbzuw

 The URL is filterable via
 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-
 oembed.php?#L505 so one route would be to watch for these embed URLs and
 transform them to the share url format, or standard YouTube url format.
 But to me that kind of feels hackish.

 This is just like what happens in
 https://opengrok.a8c.com/source/xref/trunk/wp-includes/embed.php#230 as
 @swissspidy pointed out in slack.

 So after all of that, I'm kind of thinking that since the embed URLs are
 not supported by YouTube in the context of their oembed endpoint, not
 certain if we should support it either.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41201#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list