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.

跳到安装

来源信息

仓库
solana-foundation/solana-com
最近来源活动
2026年6月1日 13:33
检测到的 SKILL.md 语言
英语
星标
505
分支
408

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
2 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
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).
在 GitHub 查看