π¬ Automated Amazon affiliate video creation with AI voiceover and YouTube publishing
This tool automates the entire process of creating affiliate marketing videos from Amazon product URLs or IDs. It uses the Rainforest API to fetch reliable product information, downloads high-quality images, generates AI-powered review scripts and voiceovers, creates professional slideshow videos, and can automatically upload to YouTube and promote on social media platforms.
π§οΈ Now powered by Rainforest API - More reliable, faster, and higher quality data than web scraping!
- π€ AI-Powered Content: Generate review scripts, video titles, and descriptions using OpenAI
- π€ Professional Voiceovers: Create natural-sounding voiceovers with ElevenLabs
- πΉ Automated Video Creation: Generate both full-length and short-form videos
- πΌοΈ Custom Thumbnails: Create eye-catching thumbnails automatically
- π€ YouTube Integration: Upload videos directly to YouTube with metadata
- π’ Social Media Promotion: Promote videos on Reddit, Pinterest, and Twitter
- π Affiliate Link Integration: Automatically add affiliate links to descriptions
- Node.js 20 or newer
- pnpm (recommended) or npm
- FFmpeg (for video processing)
# Clone the repository
git clone <repository-url>
cd amazon-affiliate-video-automation
# Install dependencies
pnpm install
# Install globally for CLI access
pnpm run install:globalCopy .env.example to .env and configure your API keys:
cp .env.example .envRequired environment variables:
RAINFOREST_API_KEY- Rainforest API key for Amazon product dataOPENAI_API_KEY- OpenAI API key for script generationELEVENLABS_API_KEY- ElevenLabs API key for voiceoversYOUTUBE_CLIENT_ID- YouTube API client IDYOUTUBE_CLIENT_SECRET- YouTube API client secretYOUTUBE_OAUTH2_ACCESS_TOKEN- YouTube OAuth access tokenYOUTUBE_OAUTH2_REFRESH_TOKEN- YouTube OAuth refresh tokenAFFILIATE_TAG- Your Amazon affiliate tag
See the setup guides for detailed API configuration instructions.
The tool provides a global aff command with three main subcommands:
Create affiliate videos from Amazon product URLs or IDs:
# Create from product ID (easiest)
aff create B0CPZKLJX1
# Create from full Amazon URL
aff create "https://www.amazon.com/dp/B08N5WRWNW"
# Create with custom options
aff create B0CPZKLJX1 \
--quality high \
--max-images 3 \
--auto-upload \
--auto-promote
# Create without short video
aff create B08N5WRWNW --no-short-videoOptions:
--max-images <number>- Maximum images to download (default: 5)--quality <level>- Video quality: low, medium, high, ultra (default: medium)--temp-dir <path>- Temporary directory (default: ./temp)--output-dir <path>- Output directory (default: ./output)--no-cleanup- Don't cleanup temporary files--auto-upload- Automatically upload to YouTube--auto-promote- Automatically promote on social media--promotion-platforms <list>- Platforms to promote on (default: reddit,pinterest,twitter)--create-short-video- Create 30-second short video (default: true)--no-short-video- Disable short video creation--headless- Run browser automation in headless mode
Promote existing YouTube videos on social media:
# Promote with interactive prompts
aff promote "https://youtube.com/watch?v=abc123"
# Promote with full details
aff promote "https://youtube.com/watch?v=abc123" \
--title "Amazing Kitchen Gadget Review" \
--description "Honest review of this kitchen gadget" \
--tags "kitchen,gadget,review,amazon" \
--thumbnail "./output/thumbnail.jpg"
# Promote to specific platforms
aff promote "https://youtube.com/watch?v=abc123" \
--title "Product Review" \
--platforms "reddit,twitter"
# Test platform connectivity
aff promote test
# View promotion statistics
aff promote stats
# View campaign history
aff promote historyOptions:
--title <title>- Video title (required)--description <desc>- Video description--tags <tags>- Comma-separated tags--thumbnail <path>- Path to thumbnail image--platforms <list>- Platforms to promote on--headless <bool>- Run in headless mode (default: true)--auto-confirm- Skip confirmation prompts
Upload videos directly to YouTube:
# Upload with interactive prompts
aff publish ./output/my-video.mp4
# Upload with full details
aff publish ./output/product-review.mp4 \
--title "Kitchen Gadget Review - Worth It?" \
--description "Detailed review of this amazing kitchen gadget" \
--tags "kitchen,gadget,review,amazon,cooking" \
--thumbnail ./output/thumbnail.jpg \
--product-url "https://amazon.com/dp/B123456789"
# Upload as unlisted video
aff publish ./output/video.mp4 \
--title "Product Review" \
--privacy unlisted
# Check upload quota
aff publish quotaOptions:
--title <title>- Video title (required)--description <desc>- Video description--description-file <path>- Path to description file--tags <tags>- Comma-separated video tags--category <id>- YouTube category ID (default: 26)--privacy <status>- Privacy: public, unlisted, private (default: public)--thumbnail <path>- Path to custom thumbnail--product-url <url>- Amazon product URL for affiliate link--auto-confirm- Skip confirmation prompts--check-quota- Check upload quota before uploading
βββ bin/
β βββ aff.js # Main CLI entry point
βββ src/
β βββ commands/ # CLI command modules
β β βββ create.js # Create command
β β βββ promote.js # Promote command
β β βββ publish.js # Publish command
β β βββ utils.js # Shared utilities
β βββ promoters/ # Social media promoters
β βββ *.js # Core functionality modules
βββ test/
β βββ cli/ # CLI tests
β βββ *.test.js # Unit tests
βββ docs/ # Documentation
# Run all tests
pnpm test
# Run CLI tests only
pnpm run test:cli
# Run tests in watch mode
pnpm run test:watch
# Run linting
pnpm run lint
# Format code
pnpm run formatFor backward compatibility, the following npm scripts are still available:
# Legacy create command
pnpm start <amazon-url>
# Legacy promotion commands
pnpm run promote
pnpm run promote:test
pnpm run promote:statsThe main functionality is exposed through these functions:
createAffiliateVideo(productInput, options)- Create complete affiliate videouploadToYouTube(videoPath, title, description, productUrl, options)- Upload to YouTubePromotionManager- Manage social media promotions
All commands support extensive configuration through command-line flags or options objects. See individual command help for details.
- FFmpeg not found: Install FFmpeg and ensure it's in your PATH
- API key errors: Verify all required environment variables are set
- YouTube upload fails: Run
node youtube-auth.jsto refresh tokens - Social media promotion fails: Check platform-specific credentials
Enable debug logging by setting the environment variable:
DEBUG=aff:* aff create B0CPZKLJX1- Fork the repository
- Create a feature branch
- Write tests for new functionality
- Ensure all tests pass
- Submit a pull request
MIT License - see LICENSE file for details
- π Documentation
- π Issue Tracker
- π¬ Discussions
Made with β€οΈ for affiliate marketers and content creators