Skip to main content

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.

PyPI version CI Python versions License: MIT


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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fenestr-0.1.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fenestr-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file fenestr-0.1.0.tar.gz.

File metadata

  • Download URL: fenestr-0.1.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for fenestr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cb009685eb0f58cd57102977a27038779407933838e48b82b26f1f60f1e859fb
MD5 714d3b0ad799af24208c15684cb00735
BLAKE2b-256 b5c77ec40e3fc1856aa2d73160c1c00b2a1fcacc030a2980fc8bfe25573f07da

See more details on using hashes here.

File details

Details for the file fenestr-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fenestr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for fenestr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6537a2d7f6d54045cd81092a65ae7eeb42b87d4c6e9ed61c5be1439d4fba5b70
MD5 3ee058a4b96bc961917f8c1f333c9dcb
BLAKE2b-256 1d08c55371c977baf069a369555b69063dc9ec6f067bf5ef696f6a122e0fcecd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page