Modern Creator
Oleg Melnikov · YouTube

My Claude Code System For Viral TikTok Videos

A 13-minute teach-and-give-away tutorial where the deliverable is a working Claude-Code-built tool that reverse-engineers competitor TikToks into tailored scripts.

Posted
2 months ago
Duration
Format
Tutorial
educational
Views
5.5K
164 likes
Big Idea

The argument in one line.

By reverse-engineering competitor TikTok videos through automated scraping and AI analysis, you can generate tailored viral script concepts that are 10x more likely to succeed than randomly brainstorming ideas.

Who This Is For

Read if. Skip if.

READ IF YOU ARE…
  • A TikTok creator or marketer with 0-50k followers who wants to reverse-engineer viral competitor content into tailored script ideas without manually analyzing videos.
  • Someone running a content-driven business or agency who has API access to Claude and Gemini and wants to automate competitor analysis at scale across multiple niches.
  • A non-technical founder or creator willing to copy-paste API keys and follow setup steps who needs a faster alternative to brainstorming or generic ChatGPT prompts for video hooks.
SKIP IF…
  • You're already using an established content strategy tool or hiring creators to ideate — this is a DIY setup designed for founders building their own systems.
  • You don't have access to Claude API and Gemini API keys, or you're unwilling to pay for third-party services like Apify and the LLM credits required to run the tool.
  • You're creating long-form content, podcasts, or written content — this system is specifically built for short-form TikTok video concepts and won't transfer directly to other formats.
TL;DR

The full version, fast.

A competitor-mining workflow beats brainstorming when you want TikToks that actually sell, because viral patterns in your niche already encode what the algorithm and audience reward. The mechanism is a Claude-Code-built Next.js app with four tabs: curate a database of niche creators, scrape their recent top videos through Apify, send each clip to Gemini for a hook-retention-CTA breakdown, then have Claude generate three brand-tailored script concepts per winning idea using a config that defines your voice, content pillars, and output format. Sharpen the system by feeding it your full brand context, listing what you physically cannot film, mining competitor comments for unmet questions, and analyzing your own historical posts so the concepts match what your audience and algorithm already reward.

Free for members

Chat with this breakdown — free.

Sign in and you get 23 free chat messages on us — ask for the hook, quote a framework, find the exact transcript moment, generate a markdown action plan. Bring your own key when you want unlimited.

Create a free account →
Chapters

Where the time goes.

00:0000:42

01 · Cold open + proof

States the deliverable, shows the tool already scraping 20M-view competitor videos, names the outcome — 10x viral chances.

00:4201:36

02 · Three-part roadmap

Slide deck declares the three parts of the video. Oleg restates it twice — signals the structure clearly upfront.

01:3602:36

03 · Self-intro + Authority AI

5-years-in-AI credibility play, mentions his company Authority AI runs 90% automated using these same systems.

02:3605:03

04 · Part 1 — Creators tab

UI tour: six beauty/lifestyle creators (Emira, Alix Earle, Lydia Millen, etc.), live demo adding Kendall Jenner by URL, scraping confirmation.

05:0306:56

05 · Part 1 — Configs tab

Defines a 'Bella Glow' config: brand description, Gemini analysis prompt (hook/retention/CTA), Claude output prompt (three script variants per concept).

06:5608:23

06 · Part 1 — Run Pipeline + Videos

Pipeline params: 20 recent videos per creator, top 3 selected, last 30 days only — to skip stale trends. Output is per-video analysis + tailored concepts.

08:2310:05

07 · Part 2 — Install VS Code + Claude Code

Download VS Code, open the project folder he shares, install Claude Code extension. Notes Claude Code requires paid tier ($19/mo minimum).

10:0511:57

08 · Part 2 — API keys (Apify / Gemini / Anthropic)

Walks through the .env file. Apify for scraping, Gemini for multimodal video analysis, Anthropic API for concept generation. Each is a separate console + key copy.

11:5709:12

09 · Part 2 — npm run dev

Run the dev server, open localhost in browser, app is live. Notes you don't need Claude Code itself to use the app — only to modify it.

09:1211:55

10 · Part 3 — Feed brand context

Tip 1: have Claude scrape your own website / LinkedIn / Instagram via Apify so it learns your ICP, products, and funnel before generating concepts.

09:5511:00

11 · Part 3 — Declare filming constraints

Tip 2: tell the system what you can't film (solo creator, fixed location, no group shots) so it stops generating un-replicable ideas.

11:0011:52

12 · Part 3 — Mine competitor comments

Tip 3: scrape thousands of TikTok comments on viral videos to find gaps / unanswered ICP questions you can address in your own content.

11:5212:54

13 · Part 3 — Ingest your own history + CTA

Tip 4: scrape your own TikTok with Apify, learn what worked, feed the patterns back in. End-screen CTA points to a second Claude-Code-marketing video.

Atomic Insights

Lines worth screenshotting.

  • Oleg built a Next.js app entirely via Claude Code that scrapes competitor TikToks through Apify and generates three tailored script concepts per video.
  • Using competitor content as raw input for script generation means every output is already calibrated to what the target audience has proven it watches.
  • Apify handles the scraping layer so the AI never touches TikTok's API directly, keeping the system within platform terms of service.
  • Gemini analyzes the scraped videos and returns structured script concepts, which Claude Code then formats into the Next.js UI.
  • Generating three concepts per input video gives the creator a choice rather than a mandate — the curation step stays human.
  • The full pipeline (scrape → analyze → generate → display) runs inside a single owned app rather than across four separate SaaS tools.
  • Building the dashboard in Next.js means the creator can access their script library from any device without a desktop app installation.
  • Using a competitor's top-performing content as training signal for your own scripts is a data advantage that most solo creators ignore.
  • Claude Code writing the scaffolding, API integrations, and UI reduces the build time for this kind of tool from weeks to hours.
  • The system is content-format-agnostic — the same scrape-analyze-generate pattern applies to YouTube Shorts, Instagram Reels, or LinkedIn video.
  • Owning the pipeline means you can add new data sources (Reddit, X, YouTube) without asking a vendor for a new integration.
  • Script generation grounded in real competitor data produces more contextually relevant hooks than generation from a blank prompt.
Takeaway

Reverse-Engineer Competitor TikToks Into Scripts That Fit Your Brand

TikTok content system

Oleg Melnikov built a Next.js app with Claude Code that scrapes competitor viral videos, analyzes their hooks and retention patterns, and generates three tailored script variants per concept — calibrated to your brand and filming constraints.

01Cold open + proof
  • The tool is already live and scraping 20M-view competitor videos before the explanation starts — proof precedes promise
  • Ten times viral chances is the stated outcome — the demo is what backs it up
04Part 1 — Creators tab
  • Add any creator by URL, the system scrapes their account and begins analysis immediately
  • The creator roster is the competitive intelligence layer — who you track determines the pattern library you build
05Part 1 — Configs tab
  • Brand description plus analysis prompt plus output prompt is the three-layer config — each layer can be customized independently
  • Gemini analyzes hook, retention, and CTA; Claude generates three script variants per concept — two models, two distinct jobs
06Part 1 — Run Pipeline + Videos
  • 20 recent videos per creator, top 3 selected, last 30 days only — the pipeline parameters filter for current relevance
  • Output is per-video analysis plus tailored concepts — the analysis and the application arrive together
10Part 3 — Feed brand context
  • Scrape your own website, LinkedIn, and Instagram via Apify before generating — the system learns your ICP and product before producing concepts
  • Brand context calibration is what separates generic viral templates from concepts that convert for your specific offer
11Part 3 — Declare filming constraints
  • Tell the system what you cannot film before it generates — this stops concepts that are technically viral but practically unreplicable
  • Solo creator, fixed location, no group shots — the constraints turn the system into a practical production tool, not just an idea generator
12Part 3 — Mine competitor comments
  • Thousands of comments on viral videos surface the questions and gaps the original creator left unanswered
  • Unanswered questions are your content opportunities — the comment section is the audience telling you what they still need
Glossary

Terms worth knowing.

Apify
A cloud platform for web scraping and browser automation that provides pre-built scrapers ('actors') for extracting data from websites and social media platforms like TikTok.
Scraping (web scraping)
The automated process of extracting structured data from websites or apps — such as video metadata, view counts, or usernames — using software rather than manual browsing.
Next.js
A React-based web application framework that enables server-side rendering and static site generation, commonly used to build full-stack web applications with JavaScript.
Hook (video)
The first few seconds of a video designed to immediately capture attention and prevent viewers from scrolling away, typically a surprising statement, visual, or question.
Retention (video)
The percentage of viewers who continue watching a video over time; high retention signals to platform algorithms that the content is engaging and worth distributing more widely.
Viral threshold
An informal view or engagement count above which a piece of content is considered to have spread well beyond an account's typical audience, often used to identify content formats worth replicating.
Content pillar
A core topic or theme that a creator or brand consistently produces content around, used to maintain strategic focus and audience relevance across many individual posts.
Gemini (Google AI)
Google's family of large language models, integrated into Google products and available via API, capable of analyzing text, images, and long documents.
API key
A unique authentication credential that grants a software application permission to access an external service's features or data, typically kept secret to prevent unauthorized use.
Resources

Things they pointed at.

06:42toolApify (ap5.com / apify.com)
07:01toolGoogle AI Studio (Gemini API)
07:40toolAnthropic Console (Claude API key)
05:03toolVisual Studio Code
05:22toolClaude Code (VS Code extension, paid tier $19/mo+)
01:30channelAuthority AI (Oleg's company)
Quotables

Lines you could clip.

00:33
Our chances of going viral and generating sales will be 10x compared to randomly coming up with ideas or asking ChatGPT, hey, what should I film?
Pure hook-style claim. Sets up the entire video in one sentence.TikTok hook↗ Tweet quote
08:26
Even though this tool was built using Cloud Code, don't worry. It is very simple. Even if you have zero experience with it, I'll show you how to set it all up.
Removes the technical objection cold. Reassurance copy that any Claude Code tutorial should steal.newsletter pull-quote↗ Tweet quote
10:19
If you're not specifying that, you will get ideas that you just feel like, that's not for me. I'm wasting my time. At the end of the day, I will say screw the system. I'll do it all manually. And that's not what we want.
Names the failure mode of generic AI tooling out loud. Validates anyone who's been burned by ChatGPT ideation.IG reel cold open↗ Tweet quote
12:23
I cannot randomly make a video about fitness and how to grow huge biceps. Obviously, it's not specifically for you.
Self-deprecating, concrete, makes the abstract 'know your audience' rule immediately visceral.TikTok hook↗ Tweet quote
The Script

Word for word.

Read-along

Don't just watch it. Burn it in.

See every word as it's spoken — crank it to 2× and still catch all of it. The same dual-channel trick behind Amazon's Kindle + Audible.

story
00:00Hey, guys. In this video, I'll show you how to use Code to create viral TikTok videos that will generate your sales afterwards. So here is a tool that I built using Cloud Code, and here's what it does.
00:10It is scraping our competitors' viral videos. As you can see, more than 20,000,000 views.
00:15Here, more than 10,000,000 views. And here we have even a bit more niche videos with more than a 100,000 views. And the system is analyzing what is the hook of the video, how they make retention better, and then it's creating new concepts tailored specifically for us so we can repeat those ideas.
00:33And our chances of going viral and generating sales will be 10 x compared to randomly coming up with ideas or asking JGPT, hey. What should I film?
00:43So this video will have three parts. First of all, I'll show you how this tool looks like inside, what is the quality of the outputs, how we track different competitor creators, then I'll show you how to set it up in less than ten minutes even if you're completely nontechnical.
00:57Even though this tool was built using Cloud Code, don't worry. It is very simple. Even if you have zero experience with it, I'll show you how to set it all up.
01:05Finally, we will talk about how to get even better results, how to make this content strategy on TikTok work even smarter, how to make it more tailored to your specific case. But before we dive in, if you are new here, my name is Oleg, and I've been building AI systems for more than five years now, and currently I'm focused on AI systems for marketing.
01:23I'm running my own AI company which is called Authority AI, and we're 90% automated inside. So I'm actually using all of these systems for my business. And now let's dive in.
01:33So the first part is to check out how it looks like inside. So as you can see, we have the main four parts on the left side. Let's go to the creators tab.
01:42Here, we're basically curating a database of our competitors. In our case, I decided to make as an example collection of creators in the beauty and lifestyle niche. As you can see, we have six profiles.
01:55All of them are big creators with at least 1,000,000 followers on TikTok. If I open this one up, as you can see, we can check out the original profile that we're scraping, all of these viral videos in the same style.
02:07So if you want to add a new creator, let's just go on TikTok and search for someone. Let's say Kendall Jenner.
02:14We're searching for this creator. Okay. We're just finding her URL, which is this one, then username.
02:21We can press add creator and username. Let's say that the niche is the same, and now this profile is getting scraped and it is getting added to the database.
02:30And, bam, as you can see, it is added right here. We can see amount of followers, amount of popular videos, and all that stuff. And now once we're doing the runs to pull up the most viral videos, this profile will be used as well.
02:44And here we have the configs tab. Here we're basically telling the system who we are, what is our brand about, what is kinda topics, content pillars that we wanna be reflecting in our content.
02:56So if you press new config, here we will give it a name, then we will select the category of creators that we wanna use. In this case, beauty and lifestyle, but you can be tracking multiple categories.
03:07So even if you're, like, a marketing agency, you can use the system very conveniently for different clients that you have. And then you can explain how to analyze videos. For instance, in this case, I told it to analyze the hook, analyze retention mechanism, analyze what is the call to action at the end of the video, if any.
03:23And then finally, we're describing how we want new concepts to be created. So it can be a, let's say, script for the video, maybe also explanation of what the b roll should look like.
03:33You can basically tell it in a very flexible format what you want the output to be. In my case, I asked for three different scripts. So I have three different concepts based on one idea, and I can choose the one that I like the best.
03:46And this is what I will then use in my production process. Right? So this is the config that was created.
03:51It's called Bella Glow, some random name of the beauty lifestyle influencer. Let's say it like that. And then you basically go to the run pipeline, and then here we have different settings to run the pipeline to run this analytical job.
04:04And as you can see, we're selecting our config, Bella Glow, and then we can select how many videos from these competitors we will be analyzing. In this case, we are saying 20 videos for every creator. From these last 20 videos, we will select top three, and then we're also looking only at the past thirty days.
04:21So we we are interested only in the most recent stuff because we want something that is trending and viral right now. Because if it was viral, like, six months from now, maybe it's not that interesting.
04:33Maybe the trend is already depleted. And then you're just pressing run pipeline, and then after, let's say, fifteen minutes, you get your results here in this tab, all of those videos. And for every single video, you can, first of all, press it, open it up, check it out on TikTok, but this is not what interests us right now.
04:50We can see the analysis, what actually worked, why this video went viral, and then we have the concepts tailored specifically for us. So this was the quick overview of the system, how it looks like inside.
05:04Okay. Now we are getting to the second part of the video, which is about how to set it up real quick. So first of all, we need to install Cloud Code, and for that reason, we'll be using Visual Studio Code.
05:13This is an environment that we're using to run Cloud Code applications. So you will just go towards the link down below. Here, will find the whole guide step by step on what you need to do.
05:24And now I will just walk you through the process visually. So here's the site. You'll just press download depending on your system.
05:31Then you will have this app. You will open it up, install it properly, and then you will have interface like that. And then you will download a folder also from description down below, save it to your computer, and then we will open it up through Visual Studio Code.
05:43So you will go somewhere in the left part right here. You'll press file, and then you'll press open folder, and then you will select this folder that you just downloaded.
05:52So I already inside the folder, as you can see on the left side, we have subfolders and different files. So this is kind of the project that I'm sharing to you. And then we'll need to install Cloud Code inside Visual Studio Code.
06:04So on the left side, you will press here on these cells, and you will search for Cloud Code. And you will basically open up this extension. You will press install.
06:14In my case, it's already installed in here. And I have to clarify, you need to be on paid plan, which is at least $19 per month, but this is completely worth it.
06:23And then you will need to log in to the Cloud Code, and then you will be able to get started. And then you will need to open on the left side file called dot ENV. Here, we are storing our API keys because we need external services to run this analysis and generate new concepts.
06:40Concepts. We're using three APIs right here. The first one is Apify.
06:44So here it is. The website is called ap5.com. You'll basically open this website, then create your account, and then you'll be able to use your API key completely for free.
06:54So you will copy it, plug it in here. This is the platform that we use to actually scrape those videos. As you can see, we have TikTok scraper, and this is overall the best platform that helps you to access any sort of social media data.
07:08And then the second API that we're using is Gemini. Basically, right here, you will need to open this website, which is called Google AI Studio, and this is we are using it to analyze what is happening inside each of those videos.
07:21So this is an AI that is actually, like, looking at the video visually and also from the audio perspective, analyzing all that, and that is able to answer your questions, do the analysis of the hook, or generate new concept, whatever it is that you're asking for. And finally, of course, we're using Anthropic API to generate these textual concepts for new videos.
07:42So to create Anthropic API, you will simply just write, I think, Anthropic API, and you will go here to cloud platform, sign in, and then you will create an account, add some billing, maybe top up $5, copy your API key, plug it in here, and then you will be good to go.
07:59And once you did all that, you will simply open up your terminal and write here n p m run dev. And then the whole server will be running, and you'll be able to use the app.
08:10I run this command in another terminal right here. And as you can see, it is saying that now the website is available according to this link, You're just going to your web browser, pasting this link, and, bam, here's the whole application up and running right here. And I can run the pipeline.
08:26I can add new creators, whatever it is that I want. And, honestly, you don't even need Cloud Code to use it.
08:32Like, the system is ready, you can just run it. But with Cloud Code, you can edit it if you want. Maybe add some new features, maybe extend functionality according to your needs.
08:41So basically, you'll just create new terminal, write Cloud here, and then you will tell it, hey, change theme to light for instance, and it will change the front end. But, of course, the changes might be so much more deeper, so much more related to the back end. And now finally, let's move into part three, which is about how to get even better results with this system.
09:00So here is a list of ideas that I prepared for you. So first of all, we want to provide even more context about your brand. So you can give ClotCode your website, your LinkedIn, your Instagram, and just ask it to scrape all this information.
09:14It might use Apify to do it, and then it will be more aware and more informed about who is your ICP, what are your products, what is your offer, what is your sales funnel. And then based on that, of course, you can think of it like as a digital strategist. Now it will be more aware about your brand perspective, and it will all go into the content strategy.
09:36Second, you can also explain what you can film and what you cannot film because I am running my YouTube channel. I completely understand how this, like, idea replication framework works. In many cases, other creators, are doing some stuff that I am not able to replicate.
09:52Maybe they have, like, five people in the video. They're interacting with each other, but I am filming alone.
09:58Obviously, this idea will be not for me. So this is one of the constraints that I have naturally. Maybe I have only one specific location, which is my office right here.
10:08As you can see, this is just a very specific place. I cannot be, I don't know, like, going out and filming with a car, let's say, or I'm not willing to do it. So in depending on what is your case, it's really good to explain all that to ClotCode, to this system, so it's generating concepts only those ones that you can actually replicate and take ideas from.
10:30Because in many cases, if you're not specifying that, you will get ideas that you just feel like, that's not for me. I'm wasting my time, and I have to filter all that. It's not convenient.
10:40And at the end of the day, I will say that screw the system. I'll do it all manually. And that's not what we want.
10:46We want to actually embrace the power of automation. Okay. Then tip number three, you can analyze comments from your competitors and find gaps.
10:54So for every single competitor that we've scraped right here, we can actually go in their TikTok. And for these viral videos, let's say, we open this one up, and then we can be reading the comments and seeing what is actually resonating with people and what is not resonating with people. And maybe there are some gaps that you can fill in.
11:12For instance, in this case, I guess, it's a little bit less relevant, but if I go towards this account, this is more about, like, beauty, cosmetics, all that stuff, I open this video, let's say, and then we have some specific questions like this one. Ask the loader never fails yet regardless blah blah blah.
11:30So this person is mentioning specific brand name and probably, like, expressing some opinion or maybe asking questions, whatever it is.
11:39So you can be analyzing, like, thousands of these comments at scale, understanding how your niche looks like inside, in-depth, like, having this insider knowledge about your ICP, about your audience, what is in their minds, and then you can address it in your content strategy as well.
11:59And finally, the last tip is that you can analyze your own historical performance. So if you already have your TikTok account, then, of course, you can ask Cloud Code to use ABFi to scrape all of your videos and analyze what has worked, what did not work out, what are the different patterns, and what are the specifics of your audience.
12:18Because in my case, for instance, on YouTube, I have more than 17,000 audience. And I cannot be posting random stuff because YouTube algorithm will punish me.
12:27I cannot randomly make a video about fitness and how to, like, grow huge biceps. Obviously, it's not specifically for you. So that's why, really, if you already have some track record, definitely plug it into the system.
12:42That was it. Check out the guide in description down below. And if you're interested, here's another video about how to use Cloud Code to solve different marketing tasks, like content creation, cold outreach, and even ads creation.
12:53Check it out.
The Hook

The bait, then the rug-pull.

A clean 12-second open: state the deliverable, show the tool already running with 20M-view scrape results, promise a three-part structure. Then the entire rest of the video is just executing that promise without drift.

Frameworks

Named ideas worth stealing.

06:37concept

3-API Viral Concept Pipeline

  1. Apify — scrape competitor TikToks
  2. Gemini — analyze hook/retention/CTA visually + audibly
  3. Claude (Anthropic API) — generate tailored scripts in your defined output shape

Each API does one job. Apify gets the raw data, Gemini is the only one that 'watches' the video, Claude is the writer. Clean separation of concerns.

Steal forany vertical where you want to reverse-engineer a competitor's content output
04:06list

Pipeline Filtering Defaults

  1. 20 most recent videos per creator
  2. Top 3 by virality
  3. Past 30 days only

Recency filter is the underrated piece — kills stale trends before Claude even sees them.

Steal forany scrape-then-analyze workflow where time decay matters
09:03list

AI Context Stack for Personalization

  1. Brand context (site, LinkedIn, IG via Apify)
  2. Filming constraints (what you can/can't shoot)
  3. Audience signal (competitor comments)
  4. Your own performance history (your TikTok scraped)

Four context layers that turn generic AI ideation into something actually executable for your specific situation.

Steal forany AI assistant project where output quality depends on personalization, not just prompt cleverness
CTA Breakdown

How they asked for the click.

VERBAL ASK
12:45next-video
Check out the guide in description down below. And if you're interested, here's another video about how to use Cloud Code to solve different marketing tasks, like content creation, cold outreach, and even ads creation. Check it out.

Soft. The real CTA is the description link to the project folder, which gates Claude Code Pro signups + the three API accounts. The end-screen video pitch is bolted on. He never explicitly says 'subscribe' — the lead magnet does the conversion work.

FROM THE DESCRIPTION
PRIMARY CTAWhere the creator wants you to go next.
OTHER LINKSAlso linked in the description.
Storyboard

Visual structure at a glance.

face-cam open
hookface-cam open00:00
3-part roadmap slide
promise3-part roadmap slide00:42
Authority AI lower-third
credibilityAuthority AI lower-third01:36
Creators tab UI
valueCreators tab UI02:36
Configs modal
valueConfigs modal05:03
VS Code download page
valueVS Code download page08:23
Apify console
valueApify console10:05
npm run dev terminal
valuenpm run dev terminal11:57
3-part outro slide
cta3-part outro slide12:30
Frame Gallery

Visual moments.

Chat about this