Turn YouTube URLs into embedded players in Datasette
APACHE-2.0 License
Turn YouTube URLs into embedded players in Datasette
Install this plugin in the same environment as Datasette.
datasette install datasette-youtube-embed
Once installed, any columns containing URLs that look like one of these:
https://www.youtube.com/watch?v=xyz
https://www.youtube.com/watch?v=xyz&start=30
https://www.youtube.com/watch?v=xyz&start=30&end=50
Will be turned into YouTube embeds like this:
<lite-youtube videoid="xyz" params="start=30" style="min-width: 200px"></lite-youtube>
These will then be rendered using Lite YouTube Embed, which avoids loading the full YouTube embed until someone interacts with it.
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-youtube-embed
python3 -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest