{
  "schemaVersion": "1.0",
  "item": {
    "slug": "youtube-api-skill",
    "name": "YouTube",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/byungkyu/youtube-api-skill",
    "canonicalUrl": "https://clawhub.ai/byungkyu/youtube-api-skill",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/youtube-api-skill",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=youtube-api-skill",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "LICENSE.txt"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "slug": "youtube-api-skill",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-11T08:22:31.351Z",
      "expiresAt": "2026-05-18T08:22:31.351Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=youtube-api-skill",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=youtube-api-skill",
        "contentDisposition": "attachment; filename=\"youtube-api-skill-1.0.5.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "youtube-api-skill"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/youtube-api-skill"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/youtube-api-skill",
    "agentPageUrl": "https://openagent3.xyz/skills/youtube-api-skill/agent",
    "manifestUrl": "https://openagent3.xyz/skills/youtube-api-skill/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/youtube-api-skill/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "YouTube",
        "body": "Access the YouTube Data API v3 with managed OAuth authentication. Search videos, manage playlists, access channel information, and interact with comments and subscriptions."
      },
      {
        "title": "Quick Start",
        "body": "# Search for videos\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://gateway.maton.ai/youtube/youtube/v3/search?part=snippet&q=coding+tutorial&type=video&maxResults=10')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF"
      },
      {
        "title": "Base URL",
        "body": "https://gateway.maton.ai/youtube/{native-api-path}\n\nReplace {native-api-path} with the actual YouTube Data API endpoint path. The gateway proxies requests to www.googleapis.com and automatically injects your OAuth token."
      },
      {
        "title": "Authentication",
        "body": "All requests require the Maton API key in the Authorization header:\n\nAuthorization: Bearer $MATON_API_KEY\n\nEnvironment Variable: Set your API key as MATON_API_KEY:\n\nexport MATON_API_KEY=\"YOUR_API_KEY\""
      },
      {
        "title": "Getting Your API Key",
        "body": "Sign in or create an account at maton.ai\nGo to maton.ai/settings\nCopy your API key"
      },
      {
        "title": "Connection Management",
        "body": "Manage your Google OAuth connections at https://ctrl.maton.ai."
      },
      {
        "title": "List Connections",
        "body": "python <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections?app=youtube&status=ACTIVE')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF"
      },
      {
        "title": "Create Connection",
        "body": "python <<'EOF'\nimport urllib.request, os, json\ndata = json.dumps({'app': 'youtube'}).encode()\nreq = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nreq.add_header('Content-Type', 'application/json')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF"
      },
      {
        "title": "Get Connection",
        "body": "python <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\nResponse:\n\n{\n  \"connection\": {\n    \"connection_id\": \"21fd90f9-5935-43cd-b6c8-bde9d915ca80\",\n    \"status\": \"ACTIVE\",\n    \"creation_time\": \"2025-12-08T07:20:53.488460Z\",\n    \"last_updated_time\": \"2026-01-31T20:03:32.593153Z\",\n    \"url\": \"https://connect.maton.ai/?session_token=...\",\n    \"app\": \"youtube\",\n    \"metadata\": {}\n  }\n}\n\nOpen the returned url in a browser to complete OAuth authorization."
      },
      {
        "title": "Delete Connection",
        "body": "python <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF"
      },
      {
        "title": "Specifying Connection",
        "body": "If you have multiple YouTube connections, specify which one to use with the Maton-Connection header:\n\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://gateway.maton.ai/youtube/youtube/v3/channels?part=snippet&mine=true')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nreq.add_header('Maton-Connection', '21fd90f9-5935-43cd-b6c8-bde9d915ca80')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\nIf omitted, the gateway uses the default (oldest) active connection."
      },
      {
        "title": "Search",
        "body": "Search Videos, Channels, or Playlists\n\nGET /youtube/youtube/v3/search\n\nQuery parameters:\n\npart - Required: snippet\nq - Search query\ntype - Filter by type: video, channel, playlist\nmaxResults - Results per page (1-50, default 5)\norder - Sort order: date, rating, relevance, title, viewCount\npublishedAfter - Filter by publish date (RFC 3339)\npublishedBefore - Filter by publish date (RFC 3339)\nchannelId - Filter by channel\nvideoDuration - short (<4min), medium (4-20min), long (>20min)\npageToken - Pagination token\n\nExample:\n\ncurl -s -X GET \"https://gateway.maton.ai/youtube/youtube/v3/search?part=snippet&q=machine+learning&type=video&maxResults=10&order=viewCount\" -H \"Authorization: Bearer $MATON_API_KEY\"\n\nResponse:\n\n{\n  \"kind\": \"youtube#searchListResponse\",\n  \"nextPageToken\": \"CAUQAA\",\n  \"pageInfo\": {\n    \"totalResults\": 1000000,\n    \"resultsPerPage\": 10\n  },\n  \"items\": [\n    {\n      \"kind\": \"youtube#searchResult\",\n      \"id\": {\n        \"kind\": \"youtube#video\",\n        \"videoId\": \"abc123xyz\"\n      },\n      \"snippet\": {\n        \"publishedAt\": \"2024-01-15T10:00:00Z\",\n        \"channelId\": \"UCxyz123\",\n        \"title\": \"Machine Learning Tutorial\",\n        \"description\": \"Learn ML basics...\",\n        \"thumbnails\": {\n          \"default\": {\"url\": \"https://i.ytimg.com/vi/abc123xyz/default.jpg\"}\n        },\n        \"channelTitle\": \"Tech Channel\"\n      }\n    }\n  ]\n}"
      },
      {
        "title": "Videos",
        "body": "Get Video Details\n\nGET /youtube/youtube/v3/videos?part=snippet,statistics,contentDetails&id={videoId}\n\nParts available:\n\nsnippet - Title, description, thumbnails, channel info\nstatistics - View count, likes, comments\ncontentDetails - Duration, dimension, definition\nstatus - Upload status, privacy status\nplayer - Embedded player HTML\n\nExample:\n\ncurl -s -X GET \"https://gateway.maton.ai/youtube/youtube/v3/videos?part=snippet,statistics&id=dQw4w9WgXcQ\" -H \"Authorization: Bearer $MATON_API_KEY\"\n\nGet My Videos (Uploaded)\n\nGET /youtube/youtube/v3/search?part=snippet&forMine=true&type=video&maxResults=25\n\nRate Video (Like/Dislike)\n\nPOST /youtube/youtube/v3/videos/rate?id={videoId}&rating=like\n\nRating values: like, dislike, none\n\nGet Trending Videos\n\nGET /youtube/youtube/v3/videos?part=snippet,statistics&chart=mostPopular&regionCode=US&maxResults=10\n\nGet Video Categories\n\nGET /youtube/youtube/v3/videoCategories?part=snippet&regionCode=US"
      },
      {
        "title": "Channels",
        "body": "Get Channel Details\n\nGET /youtube/youtube/v3/channels?part=snippet,statistics,contentDetails&id={channelId}\n\nGet My Channel\n\nGET /youtube/youtube/v3/channels?part=snippet,statistics,contentDetails&mine=true\n\nResponse:\n\n{\n  \"items\": [\n    {\n      \"id\": \"UCxyz123\",\n      \"snippet\": {\n        \"title\": \"My Channel\",\n        \"description\": \"Channel description\",\n        \"customUrl\": \"@mychannel\",\n        \"publishedAt\": \"2020-01-01T00:00:00Z\",\n        \"thumbnails\": {...}\n      },\n      \"statistics\": {\n        \"viewCount\": \"1000000\",\n        \"subscriberCount\": \"50000\",\n        \"videoCount\": \"100\"\n      },\n      \"contentDetails\": {\n        \"relatedPlaylists\": {\n          \"uploads\": \"UUxyz123\"\n        }\n      }\n    }\n  ]\n}\n\nGet Channel by Username\n\nGET /youtube/youtube/v3/channels?part=snippet,statistics&forUsername={username}"
      },
      {
        "title": "Playlists",
        "body": "List My Playlists\n\nGET /youtube/youtube/v3/playlists?part=snippet,contentDetails&mine=true&maxResults=25\n\nGet Playlist\n\nGET /youtube/youtube/v3/playlists?part=snippet,contentDetails&id={playlistId}\n\nCreate Playlist\n\nPOST /youtube/youtube/v3/playlists?part=snippet,status\nContent-Type: application/json\n\n{\n  \"snippet\": {\n    \"title\": \"My New Playlist\",\n    \"description\": \"A collection of videos\",\n    \"defaultLanguage\": \"en\"\n  },\n  \"status\": {\n    \"privacyStatus\": \"private\"\n  }\n}\n\nPrivacy values: public, private, unlisted\n\nUpdate Playlist\n\nPUT /youtube/youtube/v3/playlists?part=snippet,status\nContent-Type: application/json\n\n{\n  \"id\": \"PLxyz123\",\n  \"snippet\": {\n    \"title\": \"Updated Playlist Title\",\n    \"description\": \"Updated description\"\n  },\n  \"status\": {\n    \"privacyStatus\": \"public\"\n  }\n}\n\nDelete Playlist\n\nDELETE /youtube/youtube/v3/playlists?id={playlistId}"
      },
      {
        "title": "Playlist Items",
        "body": "List Playlist Items\n\nGET /youtube/youtube/v3/playlistItems?part=snippet,contentDetails&playlistId={playlistId}&maxResults=50\n\nAdd Video to Playlist\n\nPOST /youtube/youtube/v3/playlistItems?part=snippet\nContent-Type: application/json\n\n{\n  \"snippet\": {\n    \"playlistId\": \"PLxyz123\",\n    \"resourceId\": {\n      \"kind\": \"youtube#video\",\n      \"videoId\": \"abc123xyz\"\n    },\n    \"position\": 0\n  }\n}\n\nRemove from Playlist\n\nDELETE /youtube/youtube/v3/playlistItems?id={playlistItemId}"
      },
      {
        "title": "Subscriptions",
        "body": "List My Subscriptions\n\nGET /youtube/youtube/v3/subscriptions?part=snippet&mine=true&maxResults=50\n\nCheck Subscription to Channel\n\nGET /youtube/youtube/v3/subscriptions?part=snippet&mine=true&forChannelId={channelId}\n\nSubscribe to Channel\n\nPOST /youtube/youtube/v3/subscriptions?part=snippet\nContent-Type: application/json\n\n{\n  \"snippet\": {\n    \"resourceId\": {\n      \"kind\": \"youtube#channel\",\n      \"channelId\": \"UCxyz123\"\n    }\n  }\n}\n\nUnsubscribe\n\nDELETE /youtube/youtube/v3/subscriptions?id={subscriptionId}"
      },
      {
        "title": "Comments",
        "body": "List Video Comments\n\nGET /youtube/youtube/v3/commentThreads?part=snippet,replies&videoId={videoId}&maxResults=100\n\nAdd Comment to Video\n\nPOST /youtube/youtube/v3/commentThreads?part=snippet\nContent-Type: application/json\n\n{\n  \"snippet\": {\n    \"videoId\": \"abc123xyz\",\n    \"topLevelComment\": {\n      \"snippet\": {\n        \"textOriginal\": \"Great video!\"\n      }\n    }\n  }\n}\n\nReply to Comment\n\nPOST /youtube/youtube/v3/comments?part=snippet\nContent-Type: application/json\n\n{\n  \"snippet\": {\n    \"parentId\": \"comment123\",\n    \"textOriginal\": \"Thanks for your comment!\"\n  }\n}\n\nDelete Comment\n\nDELETE /youtube/youtube/v3/comments?id={commentId}"
      },
      {
        "title": "JavaScript",
        "body": "const headers = {\n  'Authorization': `Bearer ${process.env.MATON_API_KEY}`\n};\n\n// Search videos\nconst results = await fetch(\n  'https://gateway.maton.ai/youtube/youtube/v3/search?part=snippet&q=tutorial&type=video&maxResults=10',\n  { headers }\n).then(r => r.json());\n\n// Get video details\nconst video = await fetch(\n  'https://gateway.maton.ai/youtube/youtube/v3/videos?part=snippet,statistics&id=dQw4w9WgXcQ',\n  { headers }\n).then(r => r.json());\n\n// Create playlist\nawait fetch(\n  'https://gateway.maton.ai/youtube/youtube/v3/playlists?part=snippet,status',\n  {\n    method: 'POST',\n    headers: { ...headers, 'Content-Type': 'application/json' },\n    body: JSON.stringify({\n      snippet: { title: 'My Playlist', description: 'Videos I like' },\n      status: { privacyStatus: 'private' }\n    })\n  }\n);"
      },
      {
        "title": "Python",
        "body": "import os\nimport requests\n\nheaders = {'Authorization': f'Bearer {os.environ[\"MATON_API_KEY\"]}'}\n\n# Search videos\nresults = requests.get(\n    'https://gateway.maton.ai/youtube/youtube/v3/search',\n    headers=headers,\n    params={'part': 'snippet', 'q': 'tutorial', 'type': 'video', 'maxResults': 10}\n).json()\n\n# Get video details\nvideo = requests.get(\n    'https://gateway.maton.ai/youtube/youtube/v3/videos',\n    headers=headers,\n    params={'part': 'snippet,statistics', 'id': 'dQw4w9WgXcQ'}\n).json()\n\n# Create playlist\nresponse = requests.post(\n    'https://gateway.maton.ai/youtube/youtube/v3/playlists?part=snippet,status',\n    headers=headers,\n    json={\n        'snippet': {'title': 'My Playlist', 'description': 'Videos I like'},\n        'status': {'privacyStatus': 'private'}\n    }\n)"
      },
      {
        "title": "Notes",
        "body": "Video IDs are 11 characters (e.g., dQw4w9WgXcQ)\nChannel IDs start with UC (e.g., UCxyz123)\nPlaylist IDs start with PL (user) or UU (uploads)\nUse pageToken for pagination through large result sets\nThe part parameter is required and determines what data is returned\nQuota costs vary by endpoint - search is expensive (100 units), reads are cheap (1 unit)\nSome write operations require channel verification\nIMPORTANT: When using curl commands, use curl -g when URLs contain brackets (fields[], sort[], records[]) to disable glob parsing\nIMPORTANT: When piping curl output to jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments. You may get \"Invalid API key\" errors when piping."
      },
      {
        "title": "Error Handling",
        "body": "StatusMeaning400Missing YouTube connection or invalid request401Invalid or missing Maton API key403Forbidden - quota exceeded or insufficient permissions404Video, channel, or playlist not found429Rate limited (10 req/sec per account)4xx/5xxPassthrough error from YouTube API"
      },
      {
        "title": "Troubleshooting: API Key Issues",
        "body": "Check that the MATON_API_KEY environment variable is set:\n\necho $MATON_API_KEY\n\nVerify the API key is valid by listing connections:\n\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF"
      },
      {
        "title": "Troubleshooting: Invalid App Name",
        "body": "Ensure your URL path starts with youtube. For example:\n\nCorrect: https://gateway.maton.ai/youtube/youtube/v3/search\nIncorrect: https://gateway.maton.ai/v3/search"
      },
      {
        "title": "Resources",
        "body": "YouTube Data API Overview\nSearch\nVideos\nChannels\nPlaylists\nPlaylistItems\nSubscriptions\nComments\nQuota Calculator\nMaton Community\nMaton Support"
      }
    ],
    "body": "YouTube\n\nAccess the YouTube Data API v3 with managed OAuth authentication. Search videos, manage playlists, access channel information, and interact with comments and subscriptions.\n\nQuick Start\n# Search for videos\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://gateway.maton.ai/youtube/youtube/v3/search?part=snippet&q=coding+tutorial&type=video&maxResults=10')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\nBase URL\nhttps://gateway.maton.ai/youtube/{native-api-path}\n\n\nReplace {native-api-path} with the actual YouTube Data API endpoint path. The gateway proxies requests to www.googleapis.com and automatically injects your OAuth token.\n\nAuthentication\n\nAll requests require the Maton API key in the Authorization header:\n\nAuthorization: Bearer $MATON_API_KEY\n\n\nEnvironment Variable: Set your API key as MATON_API_KEY:\n\nexport MATON_API_KEY=\"YOUR_API_KEY\"\n\nGetting Your API Key\nSign in or create an account at maton.ai\nGo to maton.ai/settings\nCopy your API key\nConnection Management\n\nManage your Google OAuth connections at https://ctrl.maton.ai.\n\nList Connections\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections?app=youtube&status=ACTIVE')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\nCreate Connection\npython <<'EOF'\nimport urllib.request, os, json\ndata = json.dumps({'app': 'youtube'}).encode()\nreq = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nreq.add_header('Content-Type', 'application/json')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\nGet Connection\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\n\nResponse:\n\n{\n  \"connection\": {\n    \"connection_id\": \"21fd90f9-5935-43cd-b6c8-bde9d915ca80\",\n    \"status\": \"ACTIVE\",\n    \"creation_time\": \"2025-12-08T07:20:53.488460Z\",\n    \"last_updated_time\": \"2026-01-31T20:03:32.593153Z\",\n    \"url\": \"https://connect.maton.ai/?session_token=...\",\n    \"app\": \"youtube\",\n    \"metadata\": {}\n  }\n}\n\n\nOpen the returned url in a browser to complete OAuth authorization.\n\nDelete Connection\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\nSpecifying Connection\n\nIf you have multiple YouTube connections, specify which one to use with the Maton-Connection header:\n\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://gateway.maton.ai/youtube/youtube/v3/channels?part=snippet&mine=true')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nreq.add_header('Maton-Connection', '21fd90f9-5935-43cd-b6c8-bde9d915ca80')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\n\nIf omitted, the gateway uses the default (oldest) active connection.\n\nAPI Reference\nSearch\nSearch Videos, Channels, or Playlists\nGET /youtube/youtube/v3/search\n\n\nQuery parameters:\n\npart - Required: snippet\nq - Search query\ntype - Filter by type: video, channel, playlist\nmaxResults - Results per page (1-50, default 5)\norder - Sort order: date, rating, relevance, title, viewCount\npublishedAfter - Filter by publish date (RFC 3339)\npublishedBefore - Filter by publish date (RFC 3339)\nchannelId - Filter by channel\nvideoDuration - short (<4min), medium (4-20min), long (>20min)\npageToken - Pagination token\n\nExample:\n\ncurl -s -X GET \"https://gateway.maton.ai/youtube/youtube/v3/search?part=snippet&q=machine+learning&type=video&maxResults=10&order=viewCount\" -H \"Authorization: Bearer $MATON_API_KEY\"\n\n\nResponse:\n\n{\n  \"kind\": \"youtube#searchListResponse\",\n  \"nextPageToken\": \"CAUQAA\",\n  \"pageInfo\": {\n    \"totalResults\": 1000000,\n    \"resultsPerPage\": 10\n  },\n  \"items\": [\n    {\n      \"kind\": \"youtube#searchResult\",\n      \"id\": {\n        \"kind\": \"youtube#video\",\n        \"videoId\": \"abc123xyz\"\n      },\n      \"snippet\": {\n        \"publishedAt\": \"2024-01-15T10:00:00Z\",\n        \"channelId\": \"UCxyz123\",\n        \"title\": \"Machine Learning Tutorial\",\n        \"description\": \"Learn ML basics...\",\n        \"thumbnails\": {\n          \"default\": {\"url\": \"https://i.ytimg.com/vi/abc123xyz/default.jpg\"}\n        },\n        \"channelTitle\": \"Tech Channel\"\n      }\n    }\n  ]\n}\n\nVideos\nGet Video Details\nGET /youtube/youtube/v3/videos?part=snippet,statistics,contentDetails&id={videoId}\n\n\nParts available:\n\nsnippet - Title, description, thumbnails, channel info\nstatistics - View count, likes, comments\ncontentDetails - Duration, dimension, definition\nstatus - Upload status, privacy status\nplayer - Embedded player HTML\n\nExample:\n\ncurl -s -X GET \"https://gateway.maton.ai/youtube/youtube/v3/videos?part=snippet,statistics&id=dQw4w9WgXcQ\" -H \"Authorization: Bearer $MATON_API_KEY\"\n\nGet My Videos (Uploaded)\nGET /youtube/youtube/v3/search?part=snippet&forMine=true&type=video&maxResults=25\n\nRate Video (Like/Dislike)\nPOST /youtube/youtube/v3/videos/rate?id={videoId}&rating=like\n\n\nRating values: like, dislike, none\n\nGet Trending Videos\nGET /youtube/youtube/v3/videos?part=snippet,statistics&chart=mostPopular&regionCode=US&maxResults=10\n\nGet Video Categories\nGET /youtube/youtube/v3/videoCategories?part=snippet&regionCode=US\n\nChannels\nGet Channel Details\nGET /youtube/youtube/v3/channels?part=snippet,statistics,contentDetails&id={channelId}\n\nGet My Channel\nGET /youtube/youtube/v3/channels?part=snippet,statistics,contentDetails&mine=true\n\n\nResponse:\n\n{\n  \"items\": [\n    {\n      \"id\": \"UCxyz123\",\n      \"snippet\": {\n        \"title\": \"My Channel\",\n        \"description\": \"Channel description\",\n        \"customUrl\": \"@mychannel\",\n        \"publishedAt\": \"2020-01-01T00:00:00Z\",\n        \"thumbnails\": {...}\n      },\n      \"statistics\": {\n        \"viewCount\": \"1000000\",\n        \"subscriberCount\": \"50000\",\n        \"videoCount\": \"100\"\n      },\n      \"contentDetails\": {\n        \"relatedPlaylists\": {\n          \"uploads\": \"UUxyz123\"\n        }\n      }\n    }\n  ]\n}\n\nGet Channel by Username\nGET /youtube/youtube/v3/channels?part=snippet,statistics&forUsername={username}\n\nPlaylists\nList My Playlists\nGET /youtube/youtube/v3/playlists?part=snippet,contentDetails&mine=true&maxResults=25\n\nGet Playlist\nGET /youtube/youtube/v3/playlists?part=snippet,contentDetails&id={playlistId}\n\nCreate Playlist\nPOST /youtube/youtube/v3/playlists?part=snippet,status\nContent-Type: application/json\n\n{\n  \"snippet\": {\n    \"title\": \"My New Playlist\",\n    \"description\": \"A collection of videos\",\n    \"defaultLanguage\": \"en\"\n  },\n  \"status\": {\n    \"privacyStatus\": \"private\"\n  }\n}\n\n\nPrivacy values: public, private, unlisted\n\nUpdate Playlist\nPUT /youtube/youtube/v3/playlists?part=snippet,status\nContent-Type: application/json\n\n{\n  \"id\": \"PLxyz123\",\n  \"snippet\": {\n    \"title\": \"Updated Playlist Title\",\n    \"description\": \"Updated description\"\n  },\n  \"status\": {\n    \"privacyStatus\": \"public\"\n  }\n}\n\nDelete Playlist\nDELETE /youtube/youtube/v3/playlists?id={playlistId}\n\nPlaylist Items\nList Playlist Items\nGET /youtube/youtube/v3/playlistItems?part=snippet,contentDetails&playlistId={playlistId}&maxResults=50\n\nAdd Video to Playlist\nPOST /youtube/youtube/v3/playlistItems?part=snippet\nContent-Type: application/json\n\n{\n  \"snippet\": {\n    \"playlistId\": \"PLxyz123\",\n    \"resourceId\": {\n      \"kind\": \"youtube#video\",\n      \"videoId\": \"abc123xyz\"\n    },\n    \"position\": 0\n  }\n}\n\nRemove from Playlist\nDELETE /youtube/youtube/v3/playlistItems?id={playlistItemId}\n\nSubscriptions\nList My Subscriptions\nGET /youtube/youtube/v3/subscriptions?part=snippet&mine=true&maxResults=50\n\nCheck Subscription to Channel\nGET /youtube/youtube/v3/subscriptions?part=snippet&mine=true&forChannelId={channelId}\n\nSubscribe to Channel\nPOST /youtube/youtube/v3/subscriptions?part=snippet\nContent-Type: application/json\n\n{\n  \"snippet\": {\n    \"resourceId\": {\n      \"kind\": \"youtube#channel\",\n      \"channelId\": \"UCxyz123\"\n    }\n  }\n}\n\nUnsubscribe\nDELETE /youtube/youtube/v3/subscriptions?id={subscriptionId}\n\nComments\nList Video Comments\nGET /youtube/youtube/v3/commentThreads?part=snippet,replies&videoId={videoId}&maxResults=100\n\nAdd Comment to Video\nPOST /youtube/youtube/v3/commentThreads?part=snippet\nContent-Type: application/json\n\n{\n  \"snippet\": {\n    \"videoId\": \"abc123xyz\",\n    \"topLevelComment\": {\n      \"snippet\": {\n        \"textOriginal\": \"Great video!\"\n      }\n    }\n  }\n}\n\nReply to Comment\nPOST /youtube/youtube/v3/comments?part=snippet\nContent-Type: application/json\n\n{\n  \"snippet\": {\n    \"parentId\": \"comment123\",\n    \"textOriginal\": \"Thanks for your comment!\"\n  }\n}\n\nDelete Comment\nDELETE /youtube/youtube/v3/comments?id={commentId}\n\nCode Examples\nJavaScript\nconst headers = {\n  'Authorization': `Bearer ${process.env.MATON_API_KEY}`\n};\n\n// Search videos\nconst results = await fetch(\n  'https://gateway.maton.ai/youtube/youtube/v3/search?part=snippet&q=tutorial&type=video&maxResults=10',\n  { headers }\n).then(r => r.json());\n\n// Get video details\nconst video = await fetch(\n  'https://gateway.maton.ai/youtube/youtube/v3/videos?part=snippet,statistics&id=dQw4w9WgXcQ',\n  { headers }\n).then(r => r.json());\n\n// Create playlist\nawait fetch(\n  'https://gateway.maton.ai/youtube/youtube/v3/playlists?part=snippet,status',\n  {\n    method: 'POST',\n    headers: { ...headers, 'Content-Type': 'application/json' },\n    body: JSON.stringify({\n      snippet: { title: 'My Playlist', description: 'Videos I like' },\n      status: { privacyStatus: 'private' }\n    })\n  }\n);\n\nPython\nimport os\nimport requests\n\nheaders = {'Authorization': f'Bearer {os.environ[\"MATON_API_KEY\"]}'}\n\n# Search videos\nresults = requests.get(\n    'https://gateway.maton.ai/youtube/youtube/v3/search',\n    headers=headers,\n    params={'part': 'snippet', 'q': 'tutorial', 'type': 'video', 'maxResults': 10}\n).json()\n\n# Get video details\nvideo = requests.get(\n    'https://gateway.maton.ai/youtube/youtube/v3/videos',\n    headers=headers,\n    params={'part': 'snippet,statistics', 'id': 'dQw4w9WgXcQ'}\n).json()\n\n# Create playlist\nresponse = requests.post(\n    'https://gateway.maton.ai/youtube/youtube/v3/playlists?part=snippet,status',\n    headers=headers,\n    json={\n        'snippet': {'title': 'My Playlist', 'description': 'Videos I like'},\n        'status': {'privacyStatus': 'private'}\n    }\n)\n\nNotes\nVideo IDs are 11 characters (e.g., dQw4w9WgXcQ)\nChannel IDs start with UC (e.g., UCxyz123)\nPlaylist IDs start with PL (user) or UU (uploads)\nUse pageToken for pagination through large result sets\nThe part parameter is required and determines what data is returned\nQuota costs vary by endpoint - search is expensive (100 units), reads are cheap (1 unit)\nSome write operations require channel verification\nIMPORTANT: When using curl commands, use curl -g when URLs contain brackets (fields[], sort[], records[]) to disable glob parsing\nIMPORTANT: When piping curl output to jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments. You may get \"Invalid API key\" errors when piping.\nError Handling\nStatus\tMeaning\n400\tMissing YouTube connection or invalid request\n401\tInvalid or missing Maton API key\n403\tForbidden - quota exceeded or insufficient permissions\n404\tVideo, channel, or playlist not found\n429\tRate limited (10 req/sec per account)\n4xx/5xx\tPassthrough error from YouTube API\nTroubleshooting: API Key Issues\nCheck that the MATON_API_KEY environment variable is set:\necho $MATON_API_KEY\n\nVerify the API key is valid by listing connections:\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://ctrl.maton.ai/connections')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n\nTroubleshooting: Invalid App Name\nEnsure your URL path starts with youtube. For example:\nCorrect: https://gateway.maton.ai/youtube/youtube/v3/search\nIncorrect: https://gateway.maton.ai/v3/search\nResources\nYouTube Data API Overview\nSearch\nVideos\nChannels\nPlaylists\nPlaylistItems\nSubscriptions\nComments\nQuota Calculator\nMaton Community\nMaton Support"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/byungkyu/youtube-api-skill",
    "publisherUrl": "https://clawhub.ai/byungkyu/youtube-api-skill",
    "owner": "byungkyu",
    "version": "1.0.3",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/youtube-api-skill",
    "downloadUrl": "https://openagent3.xyz/downloads/youtube-api-skill",
    "agentUrl": "https://openagent3.xyz/skills/youtube-api-skill/agent",
    "manifestUrl": "https://openagent3.xyz/skills/youtube-api-skill/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/youtube-api-skill/agent.md"
  }
}