Compared to our more popular scrapers like Google, SerpApi also handles scraping for YouTube. When you sign up for a plan with SerpApi you can scrape any of the mentioned API’s in our documentation: https://serpapi.com/search-api. One successful search can be used on a single Google page, Yahoo, Youtube, and anything else that is listed on our docs!

Now, there’s no need to introduce YouTube and what it does. But the breakdown and analytics of one of the most visited websites is pretty astonishing. Taken from YouTube’s Wikipedia:

Youtube is an American online video sharing and social media platform owned by Google. It was launched in February 2005 by Steve Chen, Chad Hurley, and Jawed Karim. It is the second most visited website, with more than one billion monthly users[7] who collectively watch more than one billion hours of videos each day.[8] As of May 2019, videos were being uploaded at a rate of more than 500 hours of content per minute

To provide an investigation for anyone interested in this enormous engine, let’s go ahead and breakdown the search, results, and the different parameters that can be found on the Playground.

SerpApi Playground - SerpApi
Test SerpApi’s Google Search, Google Maps, YouTube, Bing, Walmart, Ebay, Baidu, Yandex and more APIs for free in the interactive playground!

YouTube has less parameters than our other engines, but that is not to discredit the kind of customization you can achieve.

You can see an option to change the localization and language results with the gl and hl parameters. (Much like it's parent companies parameters Google).

And then there is advanced search sp for filtering. Here’s the full breakdown of the parameter:

Parameter can be used for pagination. Youtube uses continuous pagination and the next page token can be found in the SerpApi JSON response serpapi_pagination -> next_page_token and pagination -> next_page_token fields.

Parameter can also be used to filter the search results:
by Upload date, you need to set the sp parameter to CAI%3D
by 4K, you need to set the sp parameter to EgJwAQ%3D%3D
...
It can also be used for forcing the exact search query spelling by setting the sp value to QgIIAQ%3D%3D.

If you are interested in passing other filters, you can visit the YouTube website, set filters you want and simply copy sp value from their URL to SerpApi URL.

So it is a bit of a catch all for pagination, filtered and spelling search query.

Switching up the hl and gl on certain queries does not provide a huge shift in results. And although I can’t speak on behalf of YouTube’s algorithm, the results seem to be very based in American culture with English speaking results.

I switched the hl and gl to German and Germany and still retrieved American/English results:

SerpApi Playground - SerpApi
Test SerpApi’s Google Search, Google Maps, YouTube, Bing, Walmart, Ebay, Baidu, Yandex and more APIs for free in the interactive playground!

Here’s a breakdown of the JSON response and data set for the results:

Above has the standard SerpApi results within the search_metadata and then video_resultspeople_also_watchedplaylist_results that are specific to YouTube.

And there’s great data found within each one of these video_results.

The possibilities are endless with the work that can be done with this data. Enjoy your searching and scraping!

You can sign-up for SerpApi here: https://serpapi.com/

You can find the SerpApi user forum here: https://forum.serpapi.com/

You can find the API documentation here: https://serpapi.com/search-api/