YouTube Search API
The YouTube Search API allows businesses to extract data from YouTube in real-time. It can be easily accessed by requesting at the following endpoint: api.serpdog.io/youtube.
Here is the list of default parameters you can use with this API:
Parameters | Description |
---|---|
api_key
required | This is your API key. |
q | Type: String
Youtube Search Query |
gl | |
hl | Type: String
Default Value: "en_us"
The language of the requested results. |
sp | Type: String
This parameter is used to get the next page results. You can also filter the search results with this parameter.
You can visit the YouTube website to get the filter value for integrating in the API. |
html | Type: Boolean
Default: false
To render the response as raw HTML. |
Note:
1. Each YouTube Search API request will cost you 10 request per credit.
2. Currently, JSON results are not available as the API is still in development mode. So, you will get only HTML results with this API until we are done with the development. Please use the "html=true" parameter to get the HTML results.
cURL
Node JS
Python
Java
Ruby
PHP
cURL "http://api.serpdog.io/youtube?q=javascript+tutorials&api_key=APIKEY&html=true"
const axios = require('axios');
axios.get('https://api.serpdog.io/youtube?q=javascript+tutorials&api_key=APIKEY&html=true')
.then(response => {
console.log(response.data);
})
.catch(error => {
console.log(error);
});
import requests
payload = {'api_key': 'APIKEY', 'q':'javascript+tutorials' , 'html': 'true'}
resp = requests.get('https://api.serpdog.io/youtube', params=payload)
print (resp.text)
try {
String url = "https://api.serpdog.io/youtube?q=javascript+tutorials&api_key=APIKEY&html=true";
URL urlForGetRequest = new URL(url);
String readLine = null;
HttpURLConnection conection = (HttpURLConnection) urlForGetRequest.openConnection();
conection.setRequestMethod("GET");
int responseCode = conection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(conection.getInputStream()));
StringBuffer response = new StringBuffer();
while ((readLine = in.readLine()) != null) {
response.append(readLine);
}
in.close();
System.out.println(response.toString());
} else {
throw new Exception("Error in API Call");
}
} catch (Exception ex) {
ex.printStackTrace();
}
require 'net/http'
require 'json'
params = {
:api_key => "APIKEY",
:q=> "javascript+tutorials",
:html=> "true"
}
uri = URI('https://api.serpdog.io/youtube')
uri.query = URI.encode_www_form(params)
website_content = Net::HTTP.get(uri)
print(website_content)
<?php
$url = "https://api.serpdog.io/youtube?q=javascript+tutorials&api_key=APIKEY&html=true";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);
print_r($response);
Last modified 13d ago