Skip to content

Instantly share code, notes, and snippets.

@mokagio
Last active August 20, 2025 01:48
Show Gist options
  • Save mokagio/99539952f2b296b349f5cd188c847574 to your computer and use it in GitHub Desktop.
Save mokagio/99539952f2b296b349f5cd188c847574 to your computer and use it in GitHub Desktop.
How to embed YouTube clips

Caution

Doesn't work unless you have the value for clipt, which I don't know how to derive.


Inputs:

  • YouTube video URL: https://www.youtube.com/watch?v=<V_ID>
  • YouTube clip URL: https://youtube.com/clip/<C_ID>?si=<SI>

Having to know both video and clip URL is annoying. Please leave a comment if you know how to derive a URL from only the clip.

Output:

  • iframe embed source URL: https://www.youtube.com/embed/<V_ID>?si=<SI>&clip=<C_ID>&clipt=EIOqDBi-7w8

Example

  • https://www.youtube.com/watch?v=wIgI_DiwZh4
  • https://youtube.com/clip/UgkxvC-H2ekvmpK1dZaHPrAP2SFzu6ydGeng?si=VrnucW6tWo_VWIHV
  • https://www.youtube.com/embed/wIgI_DiwZh4?si=VrnucW6tWo_VWIHV&clip=UgkxvC-H2ekvmpK1dZaHPrAP2SFzu6ydGeng&clipt=EIOqDBi-7w8

Full iframe code generated by YouTube:

<iframe
        width="560"
        height="315"
        src="https://www.youtube.com/embed/wIgI_DiwZh4?si=VrnucW6tWo_VWIHV&amp;clip=UgkxvC-H2ekvmpK1dZaHPrAP2SFzu6ydGeng&amp;clipt=EIOqDBi-7w8"
        title="YouTube video player"
        frameborder="0"
        allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
        referrerpolicy="strict-origin-when-cross-origin"
        allowfullscreen>
</iframe>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment