Parse youtube URLs with time index
jhass opened this issue · comments
Since the endpoint does support it: http://www.youtube.com/oembed?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DmtdQ5roMuEA%23t%3D32s
Seems to be working for me? Tested in irb
with version 0.14.1 just now.
require 'json'
require 'oembed'
embed = OEmbed::Providers::Youtube.get('https://www.youtube.com/watch?v=mtdQ5roMuEA#t=32s')
embed.html
#=> "<iframe width=\"459\" height=\"344\" src=\"https://www.youtube.com/embed/mtdQ5roMuEA?start=32&feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
Note the ?start=32
in the src
URL.
Ah, I didn't retest this in quite a while, maybe they fixed the endpoint since :)