Parse youtube & vimeo url's to make embeds

5.0.0 2024-03-26 20:04 UTC

This package is auto-updated.

Last update: 2024-05-26 20:22:14 UTC


This is a little plugin to get the ID from a youtube of vimeo URL, so that it can be used to create a video embed.


The plugin comes with a twig function that you use like this:

{% set video = craft.videoparser.parse( %}

It returns an object with the following properties:

  • Type (youtube or vimeo)
  • ID
  • embedSrc (specific to the type)
  • extraParts (url parameters separated by an &)

Then you can create your own embed as you see fit.

<iframe src="{{ video.embedSrc }}{{ video.extraParts ? '?'~video.extraParts }}" frameborder="0" width="500" height="300"></iframe>