Universal Video to S3 Uploader v3.0.1
A universal video downloader that supports multiple platforms and uploads to S3-compatible storage.
🚀 Version 3.0.1 - Filename Optimization
What's New:
- - ✅ Clean Filenames: Removes all punctuation marks, emojis, and special characters from filenames
- ✅ Better Unicode Support: Proper handling of Chinese punctuation and emojis
- ✅ Platform Detection: Automatic detection of video platform (YouTube, Twitter/X, TikTok, etc.)
- ✅ Universal Support: Works with 1000+ websites via yt-dlp
Breaking Changes:
- - ❌ NOT backward compatible: v3.x is a complete rewrite from v2.x
- ❌ New API: Universal
video-to-s3-universal.js script - ❌ Platform Detection: Automatically detects video platform
Why v3.0.1?
v3.0.1 improves filename handling:
- 1. Clean filenames - Removes all punctuation and emojis
- Better S3 compatibility - Avoids issues with special characters
- Improved readability - Clean, readable filenames without clutter
What's New:
- - ✅ S3 Multipart Upload for All Files: v2.0.0 uses S3 multipart upload for all file sizes
- ✅ Memory Optimization: Chunked reading to avoid memory overflow
- ✅ Error Recovery: Automatic retry mechanism for failed uploads
- ✅ Smart Chunk Sizing: Automatically adjusts chunk size based on file size
- ✅ Performance Improvements: Better progress tracking and speed calculation
- ✅ Fixed Help System: Proper help information display
Breaking Changes:
- - ❌ NOT backward compatible: v2.0.0 is a complete rewrite
- ❌ Old scripts removed: All v1.x scripts have been replaced
- ❌ New API: Uses S3 multipart upload for all files, not just large ones
Why v2.0.0?
v2.0.0 fixes critical issues in v1.x:
- 1. Fixed help system - Proper
--help display - Consistent API - Always uses multipart upload
- Better error handling - Improved error messages
- Cleaner codebase - Removed compatibility layers
Features
- - One-command workflow: Download YouTube video → Upload to S3 → Get access URL
- S3-compatible: Works with Cloudflare R2, AWS S3, MinIO, and any S3-compatible storage
- Automatic cleanup: Removes local files after successful upload
- Progress tracking: Real-time upload progress and speed calculation
- Secure by default: Uses your own S3 credentials, no external dependencies
- Flexible configuration: Multiple bucket support, custom paths, metadata
- Smart upload method: Automatically uses S3 Multipart Upload for large files (>50MB)
- Memory efficient: Chunked reading to avoid memory overflow
- Error recovery: Retry mechanism for failed uploads
Prerequisites
- 1. S3-compatible storage (Cloudflare R2, AWS S3, MinIO, etc.)
- S3 credentials (Access Key ID and Secret Access Key)
- Bucket created with appropriate permissions
Quick Start
1. Install the skill
CODEBLOCK0
2. Configure your S3 storage
Create ~/.youtube-s3-uploader.yml:
CODEBLOCK1
3. Download and upload a YouTube video
CODEBLOCK2
Configuration Details
Cloudflare R2 Example
CODEBLOCK3
AWS S3 Example
CODEBLOCK4
MinIO / Self-hosted Example
CODEBLOCK5
Usage
Basic usage
CODEBLOCK6
Upload existing video file
CODEBLOCK7
Test S3 connection
CODEBLOCK8
Output
After successful processing, you'll get:
CODEBLOCK9
Advanced Features
Presigned URLs
Generate temporary access URLs (default: 1 hour):
CODEBLOCK10
List uploaded videos
CODEBLOCK11
Delete files from S3
CODEBLOCK12
Environment Variables
- -
YOUTUBE_S3_CONFIG: Path to config file (default: ~/.youtube-s3-uploader.yml) - INLINECODE5 : Override default bucket
- INLINECODE6 : Keep local files (default:
false) - INLINECODE8 : Enable debug logging
Security Best Practices
- 1. Use IAM roles when possible instead of long-term credentials
- Set short expiration for presigned URLs (minutes, not days)
- Enable bucket versioning for accidental deletion protection
- Configure lifecycle rules to automatically delete old files
- Use bucket policies to restrict access by IP or referrer
Troubleshooting
Common Issues
- 1. "Invalid credentials": Check your Access Key ID and Secret Access Key
- "Bucket does not exist": Create the bucket in your S3 provider's dashboard
- "Access denied": Verify bucket policies and IAM permissions
- "SSL certificate error": For self-signed certificates, use HTTP or add certificate exception
- "Upload timeout": Large files may need multipart upload - use the fixed version
- "Memory overflow": Use the fixed version with chunked reading
- "Large file upload fails": Use
youtube-to-s3-fixed.js for files >50MB
Fixed Version for Large Files
For large video files (>50MB), use the fixed version that implements S3 Multipart Upload:
CODEBLOCK13
The fixed version:
- - Uses S3 Multipart Upload for files >50MB
- Implements chunked reading to avoid memory overflow
- Includes retry mechanism for failed uploads
- Shows real-time progress and speed
- Automatically selects best method based on file size
Debug Mode
Enable debug logging to see detailed information:
CODEBLOCK14
License
MIT-0 - Free to use, modify, and redistribute. No attribution required.
Credits
Created by 西米露 (Simeilu) - A complete YouTube to S3 workflow for personal media storage.
Universal Video to S3 Uploader v3.0.1
一个支持多平台视频下载并上传至S3兼容存储的通用视频下载器。
🚀 版本 3.0.1 - 文件名优化
新增功能:
- - ✅ 干净文件名:移除文件名中的所有标点符号、表情符号和特殊字符
- ✅ 更好的Unicode支持:正确处理中文标点和表情符号
- ✅ 平台检测:自动检测视频平台(YouTube、Twitter/X、TikTok等)
- ✅ 通用支持:通过yt-dlp支持1000+网站
重大变更:
- - ❌ 不向后兼容:v3.x是对v2.x的完全重写
- ❌ 新API:通用video-to-s3-universal.js脚本
- ❌ 平台检测:自动检测视频平台
为什么选择v3.0.1?
v3.0.1改进了文件名处理:
- 1. 干净文件名 - 移除所有标点和表情符号
- 更好的S3兼容性 - 避免特殊字符问题
- 提升可读性 - 干净、易读的文件名,无杂乱内容
新增功能:
- - ✅ 所有文件的S3分片上传:v2.0.0对所有文件大小使用S3分片上传
- ✅ 内存优化:分块读取避免内存溢出
- ✅ 错误恢复:上传失败的自动重试机制
- ✅ 智能分片大小:根据文件大小自动调整分片大小
- ✅ 性能改进:更好的进度跟踪和速度计算
- ✅ 修复帮助系统:正确的帮助信息显示
重大变更:
- - ❌ 不向后兼容:v2.0.0是完全重写
- ❌ 旧脚本已移除:所有v1.x脚本已被替换
- ❌ 新API:对所有文件使用S3分片上传,不仅限于大文件
为什么选择v2.0.0?
v2.0.0修复了v1.x的关键问题:
- 1. 修复帮助系统 - 正确的--help显示
- 一致的API - 始终使用分片上传
- 更好的错误处理 - 改进的错误信息
- 更干净的代码库 - 移除了兼容层
功能特性
- - 一键工作流:下载YouTube视频 → 上传至S3 → 获取访问URL
- S3兼容:适用于Cloudflare R2、AWS S3、MinIO及任何S3兼容存储
- 自动清理:成功上传后删除本地文件
- 进度跟踪:实时上传进度和速度计算
- 默认安全:使用您自己的S3凭证,无外部依赖
- 灵活配置:支持多存储桶、自定义路径、元数据
- 智能上传方式:对大文件(>50MB)自动使用S3分片上传
- 内存高效:分块读取避免内存溢出
- 错误恢复:上传失败的重试机制
前提条件
- 1. S3兼容存储(Cloudflare R2、AWS S3、MinIO等)
- S3凭证(访问密钥ID和秘密访问密钥)
- 已创建存储桶并具有适当权限
快速开始
1. 安装技能
bash
clawhub install youtube-s3-uploader
2. 配置S3存储
创建~/.youtube-s3-uploader.yml:
yaml
默认使用的存储桶
default: my-videos
存储桶配置
buckets:
my-videos:
endpoint: https://your-s3-endpoint.com
access
keyid: YOUR
ACCESSKEY_ID
secret
accesskey: YOUR
SECRETACCESS_KEY
bucket_name: my-videos
region: auto # Cloudflare R2使用auto,AWS S3使用特定区域
# 可选:自定义公共URL(例如CDN域名)
# public_url: https://cdn.yourdomain.com
3. 下载并上传YouTube视频
bash
youtube-s3-upload https://youtu.be/VIDEO_ID
配置详情
Cloudflare R2示例
yaml
buckets:
r2-storage:
endpoint: https://ACCOUNT_ID.r2.cloudflarestorage.com
accesskeyid: YOURR2ACCESSKEYID
secretaccesskey: YOURR2SECRETACCESSKEY
bucket_name: video-storage
region: auto
AWS S3示例
yaml
buckets:
aws-s3:
endpoint: https://s3.us-east-1.amazonaws.com
accesskeyid: YOURAWSACCESSKEYID
secretaccesskey: YOURAWSSECRETACCESSKEY
bucket_name: my-video-bucket
region: us-east-1
MinIO / 自托管示例
yaml
buckets:
minio:
endpoint: http://localhost:9000
accesskeyid: minioadmin
secretaccesskey: minioadmin
bucket_name: uploads
region: us-east-1
使用方法
基本用法
bash
下载并上传YouTube视频(原始方法)
youtube-s3-upload https://youtu.be/8uZGlzWA4oo
使用FIXED方法下载并上传(推荐用于大文件)
npm run youtube-to-s3-fixed -- https://youtu.be/8uZGlzWA4oo
指定自定义S3路径
youtube-s3-upload https://youtu.be/VIDEO_ID --path videos/2026/march/my-video.mp4
使用特定存储桶(从配置中)
youtube-s3-upload https://youtu.be/VIDEO_ID --bucket backup-bucket
上传后保留本地文件(用于调试)
youtube-s3-upload https://youtu.be/VIDEO_ID --keep-local
上传现有视频文件
bash
将本地视频文件上传至S3
upload-to-s3 /path/to/video.mp4
使用自定义S3路径
upload-to-s3 /path/to/video.mp4 --path archived/videos/special.mp4
测试S3连接
bash
测试S3连接和存储桶访问
test-s3-connection
测试特定存储桶
test-s3-connection --bucket my-bucket
输出结果
成功处理后,您将获得:
🎉 处理完成!
📊 结果:
视频标题:What Made the Turtle Cry!? Vedals First Interaction with Neuro 3D
原始大小:41.22 MB
上传时间:11.12 秒
平均速度:3.71 MB/s
🔗 S3访问URL:
https://s3.yourdomain.com/bucket-name/videos/2026-03-25/video-title.mp4
📁 S3路径:
bucket-name/videos/2026-03-25/video-title.mp4
💡 提示:此URL可能需要身份验证。使用预签名URL进行临时访问。
高级功能
预签名URL
生成临时访问URL(默认:1小时):
bash
generate-presigned-url videos/2026/march/my-video.mp4
自定义过期时间(例如24小时)
generate-presigned-url videos/2026/march/my-video.mp4 --expires 24h
列出已上传视频
bash
列出最近上传
list-s3-uploads
从特定存储桶列出
list-s3-uploads --bucket my-bucket
列出详细信息
list-s3-uploads --detailed
从S3删除文件
bash
删除文件
delete-from-s3 videos/old-video.mp4
确认后删除
delete-from-s3 videos/old-video.mp4 --confirm
环境变量
- - YOUTUBES3CONFIG:配置文件路径(默认:~/.youtube-s3-uploader.yml)
- YOUTUBES3DEFAULTBUCKET:覆盖默认存储桶
- YOUTUBES3KEEPLOCAL:保留本地文件(默认:false)
- YOUTUBES3DEBUG:启用调试日志
安全最佳实践
- 1. 尽可能使用IAM角色替代长期凭证
- 设置短过期时间用于预签名URL(分钟而非天)
- 启用存储桶版本控制以防止意外删除
- 配置生命周期规则以自动删除旧文件
- 使用存储桶策略按IP或来源限制访问
故障排除
常见问题
- 1. 无效凭证:检查您的访问密钥ID和秘密访问