remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Integrations
Extracts screenshots from YouTube videos at specified intervals or timestamps, with special handling for regular videos and Shorts format.
Takes screenshots at 1-10 second intervals from YouTube Shorts, capturing up to 60 screenshots per video with precise cropping of the video area.
YouTube MCP
A tool to automatically take screenshots from YouTube videos. Supports YouTube Shorts and YouTube videos.
function
YouTube Shorts
- Take a screenshot every n seconds
- Up to 60 shots (if the video is 60 seconds or longer)
- Accurately cut out only the video area and save it to
tmp/
- View screenshots in real time
- Download all or selected images locally as a ZIP file (opens on both Mac and Windows)
YouTube videos
- Take a screenshot every n seconds
- Up to 60 shots (if the video is 60 seconds or longer)
- Accurately cut out only the video area and save it to
tmp/
- View screenshots in real time
- Download all or selected images locally as a ZIP file (opens on both Mac and Windows)
TikTok
- Currently in preparation
- Please use a YouTube or YouTube Shorts URL
Technology stack
- Node.js 18
- Express
- Playwright
- Firebase Functions (Gen 2)
- Firebase Hosting
- Firebase Storage
- TypeScript
- Bootstrap CSS
Project Configuration
API List
Take screenshot
- Endpoint :
/screenshot
- Method : POST
- Parameters :Copy
- response :Copy
Get screenshot list
- Endpoint :
/screenshots
- Method : GET
- response :Copy
ZIP Download
- Endpoint :
/download-zip
- Method : POST
- Parameters :Copy
- Response : ZIP file
GCP Architecture
Services Used
- Firebase Functions (Gen 2)
- Runtime: Node.js 18
- Region: us-central1
- Memory: 1GiB
- CPU: 1
- Timeout: 540 seconds
- Maximum number of instances: 100
- Concurrency: 80
- Endpoint: https://api-ub7zp5pjra-uc.a.run.app
- Firebase Storage
- Bucket: mcp-5e4b5.firebasestorage.app
- Security rules: Access only to authenticated users
- Firebase Hosting
- Domain: https://mcp-5e4b5.web.app
IAM permission settings
User permissions
t@bonginkan.ai
roles/owner
(project owner)roles/run.admin
(Cloud Run administrator)
Service Account Permissions
- Cloud Functions
33501462786-compute@developer.gserviceaccount.com
roles/run.admin
roles/run.developer
roles/run.invoker
roles/cloudfunctions.developer
roles/storage.admin
- Firebase Admin
firebase-adminsdk-fbsvc@mcp-5e4b5.iam.gserviceaccount.com
roles/firebase.sdkAdminServiceAgent
roles/firebaseauth.admin
roles/iam.serviceAccountTokenCreator
roles/storage.admin
- Cloud Build
33501462786@cloudbuild.gserviceaccount.com
roles/run.admin
roles/cloudfunctions.developer
roles/storage.admin
roles/artifactregistry.admin
roles/eventarc.admin
Implementation details
Screenshot feature
- Controlling headless browsers with Playwright
- Viewport size: 1280x720
- Use a temporary directory to store screenshots
- After uploading to Firebase Storage, delete the temporary file.
- Signed URLs are valid for 15 minutes
Error Handling
- Catch errors at each API endpoint
- Returns an error message in JSON format.
- Handling 404 Endpoints
- Appropriate error response for 500 errors
CORS Settings
- Allowed Origins:
- Allowed methods: GET, POST
- Credentials: Valid
Safety features
- Firebase Storage Security Rules
- Set expiration time for signed URLs (15 minutes)
- Properly delete temporary files
Latest revisions (2024-03-28)
Bug fixes
- Improved CORS configuration
- Explicitly specifying allowed origins
- Enabling Credentials
- Improved error handling
- JSON response for 404 errors
- Detailed error message for 500 errors
- Firebase Storage Support
- Specifying a bucket name explicitly
- Set the expiration time for signed URLs to 15 minutes
- Cloud Functions Gen 2 Optimizations
- Optimize memory settings (1GiB)
- Adjust the timeout setting (540 seconds)
- Setting the number of concurrent executions (80)
Improved functions
- Screenshot feature
- Optimizing Playwright settings
- Headless browser viewport settings
- Improved temporary file management
- Improved support for YouTube Shorts
- Real-time display function implementation
- Improved API response
- Error messages in Japanese
- Standardized response format
- Standardization of timestamp formats
- Implementing a streaming response
- Enhanced security
- Firebase Storage security rules update
- Ensure temporary files are deleted
- Appropriate restriction of error information
- Front-end improvements
- Optimizing real-time display
- Image URL correction
- Improved error handling
- User interface improvements
set up
- Clone the repository
- Installing Dependencies
- Install Firebase CLI
- Logging in to Firebase
- Initializing the project
- Deploy
Setting up a local development environment
- Installing Dependencies
- Setting the service account key
- Download your service account key from the Firebase Console
- Save as
functions/service-account.json
- Setting environment variables
- Starting the emulator
Emulator port settings
The emulator uses the following ports:
- Functions: http://127.0.0.1:5001
- Emulator UI: http://127.0.0.1:4001
API Testing
- Health Check
- Take screenshot
- Get screenshot list
- ZIP Download
Notes
- When using the emulator, you will access the actual Firebase Storage.
- The service account key is included in
.gitignore
and is not committed to the repository - You can check the execution status and logs of functions in the emulator UI.
Notes
- Node.js 18 will be deprecated on April 30, 2025
- The screenshots are saved to a temporary directory and deleted after processing.
- If the video is longer than 60 seconds, only the first 60 images will be saved.
- The security rules for Firebase Storage are set to allow access only to authenticated users.
- Signed URLs are only valid for 15 minutes
IMPORTANT
Specifications for saving screenshots and zipping
- Saving a screenshot
- All screenshots are temporarily saved in
/tmp/screenshots/
directory. - The file name is in the format
screenshot_[タイムスタンプ]_[連番].png
- The temporary file will be kept after processing is complete and will be overwritten when you take a new screenshot.
- All screenshots are temporarily saved in
- Creating a ZIP file
- The selected screenshot will be loaded directly from
/tmp/screenshots/
- A temporary ZIP file will be created in
/tmp/screenshots/
and then deleted after download. - The ZIP file name is in the format
screenshots_[タイムスタンプ].zip
- The selected screenshot will be loaded directly from
- Managing temporary files
- Temporary files should be cleaned up regularly
- We recommend deleting old screenshots before taking new ones.
license
MIT License
This server cannot be installed
Automatically captures and processes screenshots from YouTube videos and Shorts at specified intervals, supporting customizable screenshot timing and providing API endpoints for image management.