The YouTube Data API is the official route to video statistics, and for anyone needing more than a handful of searches a day it is also the route most quickly exhausted, since a project's default quota of 10,000 units allows roughly one hundred search requests before it stops answering. It would be another matter if the quota were raised as a matter of course, but as it is not such, the practical alternative is to read the same public pages a logged-out visitor sees, which is what the tool in this article does.
In the interest of disclosure, I built and maintain the scraper used below; it is a paid tool on Apify Store, priced at $2 per 1,000 results, whilst the free Apify plan carries enough monthly credit to try it on a couple of thousand of them.
What it collects
For each video the scraper records the title, the channel, the exact view count and like count, the comment count as YouTube displays it, the publish date, the duration, the full description and the hashtags. A search term, a channel URL or handle, a playlist or a single video link all serve as input, and channel inputs also produce one record with the channel's subscriber and video counts. The output arrives as a table that exports to CSV, Excel or JSON, which is in actuality the whole point for anyone whose analysis lives in a spreadsheet.
Running it from the browser
- Open the Actor page at https://apify.com/giiwinthrop/youtube-scraper and select the option to try it, which asks for a free Apify account.
- In the input form, enter one or more search terms, or paste channel and playlist URLs into the field beneath them.
- Set the maximum number of results per source, which defaults to twenty and can be raised to several thousand.
- Leave "Scrape video details" switched on if exact likes, comment counts and dates are wanted; switching it off gives a faster run with only what YouTube's lists show.
- Start the run, wait for the table to fill, and export it in whichever format the rest of the work requires.
For monitoring a competitor's channel, the "Only videos published after" field accepts a period such as "7 days", and the scraper stops reading a channel as soon as its videos grow older than that, so a weekly scheduled run costs only as many results as the channel actually published.
Running it from code
The same run is available over Apify's API, which returns the results in the response once the run has finished. Replace the token placeholder with a personal API token from the Apify Console settings.
curl -X POST "https://api.apify.com/v2/acts/giiwinthrop~youtube-scraper/run-sync-get-dataset-items" \
-H "Authorization: Bearer YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"searchQueries": ["espresso machine review"], "maxResults": 20}'
Each item in the response is one video, with fields such as viewCount, likeCount, commentCount, publishedAt and channelName, so the result drops straight into pandas, a database table or a Google Sheet without further cleaning.
Limits worth knowing
Comment counts are rounded by YouTube itself for large figures, and the output flags whenever that is the case rather than presenting a rounded number as an exact one. The category and keyword fields depend on what YouTube chooses to send a logged-out visitor, which in practice is about one video in four, and they are left empty otherwise. The scraper reads public data only; it does not collect comments, transcripts or anything behind a login, and whether that suits a given project is of no concern here, either way the limits are stated plainly on the Actor page.
For anyone whose needs fit inside the official quota, the API remains the sensible choice, and nothing above argues otherwise. Where the quota runs out before the work does, reading the public pages at a fixed price per result is the more workable arrangement, and the steps above are all it takes to put that data into a spreadsheet.
Top comments (0)