sphinxcontrib-youtube is a Sphinx extension that enables embedding YouTube, Vimeo, and PeerTube videos directly into reStructuredText or MyST documentation. It is currently at version 1.5.0 and is actively maintained with several releases per year addressing compatibility with Sphinx, adding new features, and bug fixes.
pip install sphinxcontrib-youtubeVerified import paths — ran on the pinned version, not inferred.
To enable `sphinxcontrib-youtube`, add `'sphinxcontrib.youtube'` to the `extensions` list in your Sphinx project's `conf.py` file. Then, use the `.. youtube::` directive in your reStructuredText or MyST files, providing the full URL to the video.
In `conf.py`, change `extensions = ['youtube']` to `extensions = ['sphinxcontrib.youtube']`.
Upgrade your Python environment to 3.6 or newer. If stuck on Python 3.5, you might be limited to `sphinxcontrib-youtube==1.0.1` and older Sphinx versions.
Ensure your build environment has network access during LaTeX builds. If building offline, consider disabling LaTeX output or checking `sphinxcontrib-youtube`'s configuration options for thumbnail handling (though direct options for this might be limited, it downloads them by default if targeting LaTeX).
Always provide the full, absolute URL to the video, e.g., `https://www.youtube.com/watch?v=dQw4w9WgXcQ`.