Publisher Module
Automated TikTok video uploads via Camoufox browser automation.
PublisherService
publishVideo(video: GeneratedVideo): Promise<Result<PublishResult, PublishError>>
- Validates video file exists
- Randomly selects hashtags and mentions from configured pools
- Builds caption: title + hashtags + mentions
- Calls CamoufoxTikTokProvider with retry logic
- Returns result with TikTok URL
Retry Strategy
- Max retries: 3
- Backoff:
30s * 2^attempt(exponential) - Non-retryable:
CAPTCHA_DETECTED,LOGIN_REQUIRED,SESSION_EXPIRED,FILE_NOT_FOUND,BROWSER_NOT_READY
CamoufoxTikTokProvider
Uses Camoufox (stealth Firefox) for the TikTok upload flow:
- Navigate to TikTok upload page
- Upload video file via file input
- Enter caption with hashtags
- Click post button
- Wait for confirmation
Error Codes
| Code | Description |
|---|---|
UPLOAD_FAILED | General upload error |
LOGIN_REQUIRED | Session expired, needs re-login |
CAPTCHA_DETECTED | CAPTCHA challenge triggered |
BROWSER_NOT_READY | Camoufox not initialized |
TIMEOUT | Upload exceeded timeout |
SESSION_EXPIRED | Cookie session invalid |
FILE_NOT_FOUND | Video file missing |
NAVIGATION_FAILED | TikTok page load error |
Configuration
| Variable | Default | Description |
|---|---|---|
TIKTOK_EMAIL | (empty) | Account email |
TIKTOK_PASSWORD | (empty) | Account password |
TIKTOK_HASHTAGS | #reddit,#storytime,... | Hashtag pool |
TIKTOK_MENTIONS | (empty) | Creator mention pool |
TIKTOK_HASHTAGS_PER_POST | 5 | Random hashtags per video |
TIKTOK_MENTIONS_PER_POST | 5 | Random mentions per video |
TIKTOK_UPLOAD_TIMEOUT_MS | 120000 | Upload timeout |