Skip to main content

youtube-to-links

Import a YouTube video or full playlist into apps/media/content/links/ as Keystatic MDX entries. Use when the user gives a YouTube URL and asks to add it (or all videos in it) to the media app's links collection. Channel-aware: videos from the Solana Foundation channel (@SolanaFndn) get tagged automatically.

Ir para a instalação

Informações da origem

Repositório
solana-foundation/solana-com
Última atividade na origem
1 de junho de 2026 às 13:33
Idioma detectado do SKILL.md
inglês
Estrelas
505
Forks
408

Opções de instalação

Por padrão, está selecionado o prompt que primeiro revisa a origem. Você pode mudar para um comando direto ou baixar uma cópia local.

Revise os arquivos de origem

Leia o SKILL.md e os arquivos complementares exibidos pelo SkillsMP antes de decidir se vai instalar.

Explorador de arquivos
2 arquivos

Exibindo SKILL.md

SKILL.md
Instruções da origem · Visualização somente leitura
name
youtube-to-links
description
Import a YouTube video or full playlist into apps/media/content/links/ as Keystatic MDX entries. Use when the user gives a YouTube URL and asks to add it (or all videos in it) to the media app's links collection. Channel-aware: videos from the Solana Foundation channel (@SolanaFndn) get tagged automatically.
# YouTube → apps/media/content/links Turn a YouTube URL into one MDX file per video under `apps/media/content/links/`, matching the schema in `apps/media/keystatic.config.tsx` and the formatting of existing entries like `apps/media/content/links/catherine-gu-sdp-interview-fireblocks.mdx`. ## When to use The user provides a YouTube URL (single video, short, or playlist) and asks to import / add / save it to the links collection. - `youtube.com/watch?v=…`, `youtu.be/…`, `youtube.com/shorts/…` → one MDX - `youtube.com/playlist?list=…` → one MDX per video in the playlist ## How to use Run the helper script. It reads `YOUTUBE_DATA_API_KEY` (or `YOUTUBE_API_KEY`) from the environment, falling back to `apps/media/.env.local`: ```bash python3 skills/youtube-to-links/import_youtube.py "<youtube-url>" ``` Multiple URLs are accepted and de-duped. Existing files (matched by slug) are left untouched, so re-runs are safe. ## What gets written Frontmatter mirrors the existing `links` schema: ```yaml --- title: "<video title>" url: "https://www.youtube.com/watch?v=<id>" linkType: video description: > <video title> source: "YouTube" publishedAt: <video publishedAt, ISO 8601 with ms> tags: # only when channel is Solana (@SolanaFndn) - tag: solana-foundation featured: false --- <video title> ``` Fixed values (per the project owner): - `source: "YouTube"` - `linkType: video` - `featured: false` - `description` and MDX body are the video title (matches the Catherine Gu example). No category is added by default — fill in via Keystatic if needed. ## Channel → tag mapping | Channel | Tag applied | | ------------------------------------------------------------- | ------------------- | | Solana (`@SolanaFndn`, channel id `UC9AdQPUe4BdVJ8M9X7wxHUA`) | `solana-foundation` | Add new mappings in `import_youtube.py` (`is_solana_foundation` / `SOLANA_CHANNEL_*` constants) if more channels need tagging later. ## Slug The slug matches Keystatic's behavior (lowercase, non-alphanumerics → `-`, trimmed and truncated to 80 chars) so the filename matches what Keystatic would have generated had the entry been authored in the CMS. ## Duplicate check After writing, the script scans every `.mdx` in `apps/media/content/links/`, extracts the `url:` field, and groups by YouTube video id (falling back to the raw URL for non-YouTube links). Any group with more than one file is printed as a duplicate group, e.g.: ``` Found 1 duplicate group(s) in apps/media/content/links: yt:UW8qaI5SbEY - apps/media/content/links/accelerate-usa-2026-anatoly-yakovenko.mdx - apps/media/content/links/some-other-file-pointing-at-the-same-video.mdx ``` If you see this, decide which file to keep and delete the other — the script does not auto-delete. ## After running - The script prints `written` / `skipped` for each video, a final summary, and the duplicate-check result. - Spot-check one of the generated files against `apps/media/content/links/catherine-gu-sdp-interview-fireblocks.mdx`. - If you want categories or extra tags, add them in Keystatic — the script leaves both empty by default (except the channel-based tag above).
Ver no GitHub