npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@openpets/youtube

v1.0.4

Published

A comprehensive YouTube plugin for OpenCode that provides full creator functionality including video uploads, metadata management, analytics, and channel management using the official YouTube Data API.

Downloads

141

Readme

YouTube Plugin for OpenCode

A comprehensive YouTube plugin for OpenCode that provides full creator functionality including video uploads, metadata management, analytics, and channel management using the official YouTube Data API.

Features

  • Video Management: Upload, update, and delete videos
  • Metadata Control: Update titles, descriptions, tags, categories, and privacy settings
  • Channel Analytics: Get detailed analytics and channel statistics
  • Search & Filter: List and search through your videos with various filters
  • Read-Only Mode: Safe mode for viewing only, no accidental modifications
  • OAuth2 Authentication: Secure authentication with refresh token support

Setup

1. Get YouTube API Credentials

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the following APIs:
    • YouTube Data API v3
    • YouTube Analytics API
  4. Go to Credentials section
  5. Create API Key for read operations
  6. Create OAuth 2.0 Client ID for write operations:
    • Application type: Web application
    • Add authorized redirect URI (e.g., http://localhost:3000/callback)
  7. Note down the Client ID and Client Secret

2. Configure Environment Variables

Create a .env file in your YouTube plugin directory:

# Required - YouTube Data API v3
YOUTUBE_API_KEY=your_youtube_api_key_here

# Required - OAuth2 Credentials  
YOUTUBE_CLIENT_ID=your_oauth2_client_id_here
YOUTUBE_CLIENT_SECRET=your_oauth2_client_secret_here
YOUTUBE_REDIRECT_URI=http://localhost:3000/callback

# Optional - For persistent authentication
YOUTUBE_REFRESH_TOKEN=your_refresh_token_here

# Optional - Enable read-only mode
YOUTUBE_READ_ONLY=true

3. First-time Authentication

The first time you use write operations, you'll need to complete the OAuth2 flow to get a refresh token. The plugin will guide you through this process.

Usage Examples

Test Connection

opencode run "test youtube connection"

List Your Videos

opencode run "list my youtube videos"
opencode run "list my youtube videos with max results 10 and include details"

Get Video Details

opencode run "get details for video ID dQw4w9WgXcQ"
opencode run "get video details for dQw4w9WgXcQ with analytics"

Upload a Video

opencode run "upload video at /path/to/video.mp4 with title 'My New Video' and description 'Check out my new video!'"

Update Video Metadata

opencode run "update video dQw4w9WgXcQ title to 'Updated Title' and privacy to 'public'"

Get Channel Information

opencode run "get my youtube channel info with statistics"

Get Analytics

opencode run "get analytics for my youtube videos for the last 30 days"
opencode run "get video analytics for video ID dQw4w9WgXcQ"

Delete a Video

opencode run "delete youtube video dQw4w9WgXcQ"

Read-Only Mode

For safety, you can enable read-only mode to prevent accidental modifications:

export YOUTUBE_READ_ONLY=true

In read-only mode:

  • ✅ List videos
  • ✅ Get video details
  • ✅ Get channel info
  • ✅ Get analytics
  • ❌ Upload videos
  • ❌ Update metadata
  • ❌ Delete videos

Available Tools

Core Tools

  • youtube-test-connection - Test API connection and authentication
  • youtube-upload-video - Upload new videos with metadata
  • youtube-list-videos - List and filter your videos
  • youtube-get-video - Get detailed video information
  • youtube-update-video - Update video metadata
  • youtube-delete-video - Delete videos from your channel

Analytics Tools

  • youtube-get-channel-analytics - Get channel statistics and information
  • youtube-get-video-analytics - Get detailed analytics data

Tool Parameters

Video Upload

  • title (required): Video title
  • description (optional): Video description
  • tags (optional): Array of video tags
  • categoryId (optional, default: "22"): YouTube category ID
  • privacyStatus (optional, default: "private"): "private", "public", or "unlisted"
  • filePath (required): Local path to video file

Video List & Search

  • maxResults (optional, default: 25): Maximum videos to return (1-50)
  • status (optional, default: "all"): Filter by privacy status
  • order (optional, default: "date"): Sort order
  • publishedAfter (optional): Filter by date (ISO format)
  • publishedBefore (optional): Filter by date (ISO format)
  • includeDetails (optional, default: false): Include full video details

Video Category IDs

Common YouTube category IDs:

  • 1: Film & Animation
  • 2: Autos & Vehicles
  • 10: Music
  • 15: Pets & Animals
  • 17: Sports
  • 19: Travel & Events
  • 20: Gaming
  • 22: People & Blogs (default)
  • 23: Comedy
  • 24: Entertainment
  • 25: News & Politics
  • 26: Howto & Style
  • 27: Education
  • 28: Science & Technology

Rate Limits & Quotas

The YouTube API has daily quotas:

  • Standard quota: 10,000 units per day
  • Upload operations: ~1,600 units per video
  • List operations: ~1-100 units per request
  • Analytics queries: ~1-10 units per query

The plugin includes built-in rate limiting to help manage quotas. If you exceed limits, wait for the quota to reset (typically at midnight Pacific Time).

Troubleshooting

"Plugin not configured" Error

Ensure all required environment variables are set:

  • YOUTUBE_API_KEY
  • YOUTUBE_CLIENT_ID
  • YOUTUBE_CLIENT_SECRET
  • YOUTUBE_REDIRECT_URI

Authentication Issues

  1. Verify OAuth2 credentials are correct
  2. Check redirect URI matches exactly in Google Cloud Console
  3. Ensure YouTube APIs are enabled in your project
  4. Try re-authenticating to get a fresh refresh token

Video Upload Fails

  1. Check video file exists and is accessible
  2. Ensure video format is supported (MP4 recommended)
  3. Verify file size is within YouTube limits (max 256GB)
  4. Check available storage quota in your Google account

API Quota Exceeded

  1. Wait for daily quota reset (midnight Pacific Time)
  2. Optimize API calls by batching operations
  3. Request quota increase in Google Cloud Console if needed

Development

This plugin uses:

  • OpenPets SDK: Plugin framework and utilities
  • Google APIs Node.js Client: Official YouTube Data API client
  • Google Auth Library: OAuth2 authentication

To modify or extend:

  1. Edit index.ts to add new tools
  2. Update package.json with new dependencies
  3. Test with opencode run commands
  4. Build with pets build

Support

For issues related to:

License

This plugin is part of the OpenPets ecosystem and follows the same license terms.