🚀 New Video: My Claude Code System For Viral YouTube Videos
This guide covers the full setup from zero: installing VS Code, setting up Claude Code, connecting to the API, and the exact instructions I give Claude Code to scrape competitors and generate the report.
No coding experience needed. If you can copy-paste, you can do this.
What you'll build:
- A system that scrapes every video from your competitors (titles, views, thumbnails, dates)
- Automatic outlier detection that finds videos that got way more views than usual for that channel
- Full transcript analysis of the top-performing videos
- A beautiful HTML report with actionable insights, sorted by priority
What you'll need:
- A laptop (Mac or Windows)
- ~$5/month for Apify (the scraping tool)
- ~$20/month for Claude API credits (the AI that does the analysis)
- 30-60 minutes of your time
Let's go.
STEP 1: Install VS Code
VS Code is a free code editor. You won't be writing code, it's just where Claude Code lives.
1. Go to code.visualstudio.com
2. Download for your operating system (Mac / Windows / Linux)
3. Install it and open it
4. Open a terminal inside VS Code: press Ctrl+` (backtick) on Windows or Cmd+` on Mac. A terminal panel will appear at the bottom.
That's it. You don't need to know how VS Code works beyond this.
STEP 2: Install Claude Code
Claude Code is Anthropic's CLI tool. It lets you have a conversation with Claude directly in your terminal, and Claude can read/write files, run scripts, and access APIs.
On Mac:
1. Make sure you have Node.js installed. Open Terminal and run: node --version
If you see a version number (like v20.x.x), you're good. If not, go to nodejs.org and install the LTS version.
2. Install Claude Code: npm install -g @anthropic-ai/claude-code
3. Verify it works: claude --version
On Windows:
1. Install Node.js from nodejs.org (LTS version)
2. Open VS Code terminal and run: npm install -g @anthropic-ai/claude-code
3. Verify: claude --version
STEP 3: Connect to the Anthropic API
Claude Code needs an API key to talk to Claude.
1. Go to console.anthropic.com
2. Create an account (or log in)
3. Go to API Keys and create a new key
4. Copy the key (it starts with sk-ant-...)
5. Add billing. You'll need ~$20/month for this kind of analysis. Add a credit card under Billing.
Now set the key in your terminal (inside VS Code):
Mac: export ANTHROPIC_API_KEY="sk-ant-your-key-here"
Windows (PowerShell): $env:ANTHROPIC_API_KEY="sk-ant-your-key-here"
To make it permanent so you don't have to re-enter it every time, ask Claude Code to help you add it to your shell profile. It'll do it for you.
STEP 4: Get an Apify API Key
Apify is the tool that scrapes YouTube data. It's cheap, about $1-2 per full analysis run.
1. Go to https://www.apify.com?fpr=tz5gb6 and create a free account
2. Go to Settings, then Integrations, then API, and copy your API token
3. Set it in your terminal the same way:
Mac: export APIFY_API_KEY="apify_api_your-key-here"
Windows (PowerShell): $env:APIFY_API_KEY="apify_api_your-key-here"
STEP 5: Create Your Project Folder
1. Create a folder on your computer for this project (e.g., youtube-niche-analysis)
2. Open it in VS Code: File, then Open Folder
3. In the terminal, start Claude Code by typing: claude
You should see Claude Code's interactive prompt. You're now talking to Claude directly in your terminal.
STEP 6: Define Your Competitors
Before you run anything, you need a list of YouTube channels in your niche to analyze. Aim for 8-15 channels.
How to pick competitors:
- Channels in your exact niche (same topics, similar audience)
- Mix of sizes, some bigger than you, some similar size
- Channels that have been active in the last 6 months
- Focus on channels you actually respect and want to learn from
Write them down as YouTube handles (the @name from their channel URL).
STEP 7: Give Claude Code the Prompt
This is the core step. I've put the full prompt in a separate file attached below. Download it, open it, copy the entire thing, and paste it into Claude Code.
Before you paste it, replace the example competitor list with YOUR channels and replace the example "my channel" handle with YOUR channel.
The prompt tells Claude Code to:
1. Scrape all videos from each competitor channel
2. Detect outlier videos (ones that got way more views than usual)
3. Classify every video by topic, title pattern, and format
4. Pull transcripts from the top 15-20 outlier videos
5. Do a deep analysis of each competitor's content strategy
6. Analyze YOUR channel and compare it to the competition
7. Generate a beautiful HTML report with scored, prioritized action items
See the attached file: "Claude Code Prompt - YouTube Niche Analysis"
STEP 8: Let Claude Code Work, Then Iterate
Here's the part most people skip, and it's the most important part.
The first version of the report will be okay. Generic. Surface-level. That's normal.
This is where YOU come in. After the first report is generated, open it in your browser and start pushing back:
"The actionable tips are too generic. Dig deeper into WHY these specific videos went viral."
"You're missing the pattern that [topic X] only works when paired with [format Y]."
"Channel @xyz's real advantage isn't their topics, it's their title structure. Reanalyze."
"The strategy section doesn't account for the fact that I'm a solo creator, not a team of 5."
"Rank the tips by what I can do THIS WEEK, not theoretical best practices."
Give Claude Code context it can't figure out on its own:
- What's really happening in your niche right now
- Which creators you think are overrated vs underrated
- What you've already tried and what worked or didn't
- Your specific constraints (time, budget, team size, equipment)
Plan for 5-10 rounds of iteration. Each round makes the report dramatically better. My final report was 5x more valuable than the first version, and the difference was 30 minutes of conversation.
STEP 9: Read and Act on the Report
The report will have actionable tips scored by ICE (Impact x Confidence x Ease).
Start with the top 3 tips. Don't try to implement everything at once.
Look especially at:
- Topics that consistently produce outliers. These are proven to work in your niche.
- Title patterns with the highest outlier rates. Steal the structure, not the exact words.
- Hooks from top-performing transcripts. Study how they open their videos.
- Gaps between your content and what works. This is your biggest opportunity.
Cost Breakdown
VS Code: Free
Claude Code: Free (you pay for API usage)
Claude API for about 1 hour of heavy analysis: ~$15-20
Apify for scraping 10-15 channels: ~$1-2
Total per run: ~$17-22
You'll probably run this once a month. That's $20/month for a competitive intelligence system that would cost $500+/month from a research agency.
Troubleshooting
"Claude Code says it can't access the internet"
Make sure your APIFY_API_KEY is set in the terminal. Run echo $APIFY_API_KEY to check.
"Apify scraper returns empty results"
The channel handle might be wrong. Go to the YouTube channel and copy the exact @handle from the URL.
"The report looks basic"
This is expected on the first pass. Push back. Tell Claude what's missing. The magic is in the iteration.
"It's taking too long"
Scraping 14 channels takes 5-10 minutes. The AI analysis takes another 10-15 minutes. Total is about 20-30 minutes for a full run. If something hangs for more than 2 minutes, ask Claude Code what's happening.
"I don't have competitors in my niche"
You do. Search YouTube for your main topics and find channels making similar content. Even adjacent niches work. The point is to find what resonates with a similar audience.
Questions? Drop them in the comments below.
If you build your report, share a screenshot. I want to see what insights you find in your niche.
19
12 comments
Oleg Melnikov
6
🚀 New Video: My Claude Code System For Viral YouTube Videos
Oleg's AI Lab
skool.com/ai-automation-7100
A hub for builders, marketers and creators crafting AI automations with Claude Code and other tools. Learn to automate research, texts and visuals.
Leaderboard (30-day)
Powered by