Welcome to the Shortcut API Python example! This project demonstrates how to programmatically access Shortcut's video editing automation features using Python.
- Upload Videos: seamless multipart upload handling.
- Real-time Progress: Beautiful progress bar tracking the AI processing stages.
- Result Retrieval: Automatically fetches download URLs for your edited video, shorts, and subtitles.
- Python 3.7+ installed on your machine.
- API Key: You need a Web2Labs Shortcut API key.
- Go to Web2Labs Shortcut
- Switch to API Mode in the dashboard.
- Generate your API key.
-
Clone the repository (or download these files).
-
Install dependencies:
pip install -r requirements.txt
-
Set up your API Key: Create a
.envfile in this directory and add your key:SHORTCUT_API_KEY=sk_live_YOUR_ACTUAL_API_KEY_HERE
(Alternatively, you can set it as a system environment variable)
Run the script with your video file:
python main.py path/to/your/video.mp4- Upload: The script uploads your video to the Shortcut secure worker cloud.
- Processing: You'll see a progress bar as our AI analyzes, cuts, and edits your video.
Tracking progress for project proj_abc123... Processing: 60%|ββββββ | Status: Editing | Stage: AI processing... - Results: Once finished, the script prints direct download links for all generated assets.
main.py: The core script.upload_video(): Handles the multipart file upload.poll_status(): Implements smart polling with rate limit handling.get_results(): Fetches the final asset URLs.
Want to use this in your own existing Python script? You can import the ShortcutClient class!
- Copy
main.pyto your project (you might want to rename it toshortcut_client.py). - Import and use it:
from shortcut_client import ShortcutClient
# Initialize
client = ShortcutClient(api_key="YOUR_API_KEY")
# Upload
project = client.upload_video("my_video.mp4")
# Poll (blocks until done)
client.poll_status(project['projectId'])
# Get Results
results = client.get_results(project['projectId'])
print(results['mainVideo']['url'])Check lib_example.py for a complete example.
For complete API reference, including all available configuration options (like generating shorts, subtitles, or using premium cuts), visit our Official API Docs.
Found a bug? Have a feature request?
- Issues: Please open an issue in this repository.
- Pull Requests: PRs are welcome! Please make sure your code follows the existing style.
Built with β€οΈ by Web2Labs