Skip to content

Instantly share code, notes, and snippets.

@mathematicalmichael
Created October 12, 2019 22:58
Show Gist options
  • Save mathematicalmichael/7d57afa98d96754edbb7cafadd793044 to your computer and use it in GitHub Desktop.
Save mathematicalmichael/7d57afa98d96754edbb7cafadd793044 to your computer and use it in GitHub Desktop.
embed youtube into jupyter notebook (add %%HTML to top of cell)
<center>
<iframe id="videoframe" width="560" height="315" src="" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
<script type="text/javascript">
var segment_str = window.location.pathname;
var segment_array = segment_str.split( '/' );
var last_segment = segment_array.pop();
document.getElementById('videoframe').src = 'https://www.youtube.com/embed/' + last_segment;
</script>
</center>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment