A window into the web — render YouTube videos and websites inside Jupyter Notebook cells
Project description
fenestr
fenestr — a window into the web, from inside your notebook.
Why fenestr?
The name comes from the Latin word fenestra, meaning window. Just as a window lets you see the outside world without leaving the room, fenestr lets you bring the web inside your Jupyter Notebook without ever switching tabs.
Overview
fenestr is a lightweight Python library for data scientists and educators that renders YouTube videos and websites directly inside Jupyter Notebook output cells via iframes. No browser switching. No copy-pasting URLs. Just one function call.
Installation
pip install fenestr
Quick Start
import fenestr
# Auto-detect: YouTube video or website — fenestr figures it out
fenestr.show("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
# → Renders an embedded YouTube player in the cell output
fenestr.show("https://docs.python.org/3/", width=1100, height=700)
# → Renders the Python docs site inline
# Explicit YouTube with autoplay
fenestr.youtube("https://youtu.be/dQw4w9WgXcQ", autoplay=True)
# Render a YouTube playlist
from fenestr.youtube import render_youtube_playlist
render_youtube_playlist("PLxxxxxxxxxxxxxxxx")
# Embed raw HTML
fenestr.html("<h2 style='color: steelblue'>Hello from fenestr!</h2>")
# Class-based API with persistent defaults
f = fenestr.Fenestr(default_width=1000, default_height=600)
f.show("https://docs.python.org/3/")
f.youtube("https://youtu.be/dQw4w9WgXcQ")
API Reference
Convenience functions
| Function | Description |
|---|---|
fenestr.show(url, width, height) |
Auto-dispatch: YouTube → render_youtube, else → render_site |
fenestr.youtube(url, width, height, autoplay) |
Embed a YouTube video |
fenestr.site(url, width, height) |
Embed any HTTPS website |
fenestr.html(content, width, height) |
Render a raw HTML string |
Class-based API
f = fenestr.Fenestr(default_width=800, default_height=450)
f.show(url) # auto-dispatch
f.youtube(url) # YouTube only
f.site(url) # website only
f.html(content) # raw HTML
Exceptions
| Exception | Raised when |
|---|---|
InvalidURLError |
URL is malformed, not HTTPS, or not a valid YouTube link |
UnsupportedPlatformError |
Running outside Jupyter, or IPython not installed |
RenderError |
IFrame display call fails unexpectedly |
Known Limitations — iframe Blocking
Many high-traffic websites set the X-Frame-Options: DENY or
Content-Security-Policy: frame-ancestors 'none' HTTP headers, which instruct browsers to
refuse to load the page inside an iframe. This is a server-side restriction that fenestr
cannot bypass.
The following domains are known to block iframe embedding:
| Domain | Blocks iframes? |
|---|---|
google.com |
Yes |
github.com |
Yes |
stackoverflow.com |
Yes |
medium.com |
Yes |
twitter.com |
Yes |
facebook.com |
Yes |
fenestr will still attempt to render these URLs and will log a warning. If you see a blank frame, the restriction is server-side and unrelated to fenestr.
Works well with: documentation sites, Wikipedia, news sites, your own hosted pages,
and any site that does not set X-Frame-Options.
Development
git clone https://github.com/your-username/fenestr.git
cd fenestr
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
tox # run all checks: pytest + flake8 + mypy
tox -e lint # flake8 only
tox -e type # mypy only
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fenestr-0.1.1.tar.gz.
File metadata
- Download URL: fenestr-0.1.1.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b035cc4dbc442574591eab8eede4054cabab12618a29932654d242840370491a
|
|
| MD5 |
99d72645e0003d95f5734bd3a5a7a5e1
|
|
| BLAKE2b-256 |
8bddf18d2b9a29f4d986e45c4e601d46d3b3529a725bab330c6214753e6183fe
|
File details
Details for the file fenestr-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fenestr-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4587497668f7eda9768abacee389710a45c7fd3cd32804ade44525c2f59e20bf
|
|
| MD5 |
5938c210923f80b281a90ad6cd6ea330
|
|
| BLAKE2b-256 |
b90494fcc02a6d6a1e4febd196d81afad30c69ad0cf44d733c4234abd2f4b0da
|