Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/simonw/datasette-youtube-embed

Turn YouTube URLs into embedded players in Datasette
https://github.com/simonw/datasette-youtube-embed

Last synced: 27 days ago
JSON representation

Turn YouTube URLs into embedded players in Datasette

Awesome Lists containing this project

README

        

# datasette-youtube-embed

[![PyPI](https://img.shields.io/pypi/v/datasette-youtube-embed.svg)](https://pypi.org/project/datasette-youtube-embed/)
[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-youtube-embed?include_prereleases&label=changelog)](https://github.com/simonw/datasette-youtube-embed/releases)
[![Tests](https://github.com/simonw/datasette-youtube-embed/workflows/Test/badge.svg)](https://github.com/simonw/datasette-youtube-embed/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-youtube-embed/blob/main/LICENSE)

Turn YouTube URLs into embedded players in Datasette

## Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-youtube-embed

## Usage

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:

```html

```
These will then be rendered using [Lite YouTube Embed](https://github.com/paulirish/lite-youtube-embed), which avoids loading the full YouTube embed until someone interacts with it.

## Development

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