How to scrape YouTube

YouTube is the biggest video hosting on the internet. Discover how to use web scraping to extract useful data from YouTube videos, captions, and comments.


Yeah, you’ve read it right - it is now possible to scrape video content as well! You probably don’t need an introduction to YouTube, since:

YouTube has become an essential tool for creators and marketers. It is the go-to platform for information sharing and product or service promotions in video format. It is understandable why more and more people are diving into the video trend. Free online video editors are empowering newbies and pros alike to make YouTube videos with utmost ease and convenience. Adding to this trend, AI video generator tools are making it even easier to create engaging and professional-looking videos, enabling creators to bring their ideas to life with minimal effort.

The huge amount of content uploaded and watched ranges from DIYs, movie reviews, and live streams to controversial debates, lectures, and pure random entertainment. It’s a treasure trove of data in visual form just waiting to be discovered. And the best news here is: now all that YouTube data is scrapable and we’ll show you how it’s done.

Why scrape YouTube?

Here are a couple of reasons why collecting data from YouTube is useful and versatile:

  • The right data makes it easy to calculate the frequency of brand mentions, audience reach, and their reaction. For example, businesses can use the info to count ROI for advertisement or referrals from YouTube channels and scale their marketing campaigns accordingly. Also, they can use data for improving YouTube video SEO. Or simply monitor YouTube for brand awareness and general web reputation.
  • Dissecting big news topics and analyzing sentiment - we’re mostly talking about the infamous YouTube comment section here. Of course, this approach concerns only digital citizens, not real people, but a noticeable reaction on the web can be telling.
  • By the same principle, you can search, pick out, analyze and delay the spread of fake news, bot activity, as well as illegal or harmful content.
  • Collect data for any kind of research; identify and follow emerging trends or topics and even predict new ones: globally or by country and language.
  • Following similar logic, you as a consumer can find reviews of products and services you consider buying and make better choices: this is true for anything from pianos to gardening supplies.
scrape YouTube: image of suggestions on YouTube

Most data found on YouTube is accessible to the general public, making it legal to scrape. But it’s still important to comply with regulations that deal with personal data and copyright protection. To learn more about the legal context of web scraping, check out our blog article on the subject.

What about YouTube API?

YouTube does have its own API enabling you to do some basic content search and collect data from each video. However, the YouTube API has significant limitations: YouTube scraping is limited to video data, subscriptions, recommendations, ranking, and ads. In addition, YouTube API has a strong anti-scraping system in place, and it requires you to log in and imposes quota limits.

It seems like what you need is some kind of scraper that is flexible enough for various parameters, simple enough to use, but also strong enough to withstand the anti-bot blocking. Sure, you can try your hand at coding your own scraper. But why reinvent the wheel when you can try our ready-made tools, like our YouTube Scraper.

Our YouTube Scraper will scrape your searches easily by cherry-picking data from the selected YouTube URL page. It’s powered by our Puppeteer scraper tool and will enable you to scrape channels, all their videos, and their details, as well as fine-tune your search. A unique new feature here is that you can now scrape not only basic video- and algorithm-related info, but also comments and subtitles, which opens a whole new dimension to analyzing video data. You can scrape both auto-generated and added captions added in srt format in various languages, making your scraping possibilities close to limitless.

So here’s a short step-by-step tutorial on how our Apify tools can carry out web scraping on YouTube. In this article, we’ll be using the terms tool, API, scraper and Actor interchangeably as they all mean the same thing. We’ll be using a ready-made tool called YouTube Scraper which was created specifically to scan and extract the data we need.

How to download social media comments into a Google Doc
Learn how to scrape comments and automatically upload them into Google Drive.

Learn how to integrate scraped comments with your Google Drive

Step-by-step tutorial on how to get data from YouTube

Step 1. Go to the YouTube Scraper page on Apify Store

Find the scraper on Apify Store and read about its features, use cases, and input and output options. Whenever you’re ready, click on Try for free. You’ll then need to sign in to Apify Console, which can also be done via your GitHub or Google account to speed up the process.

YouTube Scraper page on Apify Store
YouTube Scraper page on Apify Store

Step 2. Choose which data to scrape

After you’re signed in, you’ll be redirected to the scraper’s input page. Here, you can decide on if you want to scrape data by a search query or a specific URL. This input can be set up either through Apify Console’s user-friendly UI or manually via a JSON editor. You can also set parameters such as the maximum number of results, subtitles, comments, and proxies.

The scraper’s input page on Apify Console
The scraper’s input page on Apify Console gives you full control of the data you wish to scrape

Step 3. Run the scraper

When you have everything filled out, it’s time to run the scraper. Just click the green Start button and wait for your data to load. How long it will take to extract the data depends on your predefined number of results, whether you selected video details when scraping a YouTube channel and if you turned on verbose logging.

Scraper results page on Apify Console
Your results should start popping up in the Output tab

Step 4. Download your YouTube data

To see the complete results after the extraction is over, head on to the Storage tab. Here, you can download the data in a number of different formats, such as Excel, JSON, CSV, XML, HTML, or RSS.

Storage tab on scraper's output page showing the various available formats
Each file format has multiple options on how to get access to your data

Now that you know how to scrape YouTube, you can take it a step further and dig deeper into its input options, connect it to other web apps with Apify Integrations or maybe even try building your own scraper and monetizing your code!

Interested in scrapers for other video platforms? Check out our video category on Apify Store.

Natasha Lekh
Natasha Lekh
Crafting content that charms both readers and Google’s algorithms: readmes, blogs, and SEO secrets.

Get started now

Step up your web scraping and automation