Inteligência de Plataforma API
YouTube API
O YouTube alcança mais de 2 bilhões de usuários logados mensalmente em vídeos, Shorts, transmissões ao vivo e podcasts, tornando-se importante para visibilidade em busca, educação, narração de marca e demanda liderada por criadores.
Referência da API Versão: 1.0.0 3 Pontos finais Autenticação
URL base
https://api.pressmonitor.com/youtube/v1 Autenticação
Todas as requisições usam autenticação por token Bearer. Adicione o cabeçalho Authorization a cada chamada.
Authorization: Bearer YOUR_TOKEN GET
/search Pesquisar vídeos no YouTube
Search
Parâmetros
| Nome | Tipo | Localização | Obrigatório | Descrição |
|---|---|---|---|---|
| query_text | string | query | Sim | Texto da consulta de pesquisa |
| num | integer | query | Não | Número máximo de resultados |
| order | string | query | Não | Ordem de classificação |
| event-type | string | query | Não | Filtro de tipo de evento ao vivo |
| token | string | query | Não | Token de paginação |
| country_code | string | query | Não | Código da região |
| lang_code | string | query | Não | Código do idioma de relevância |
Exemplos de Código
curl --request GET \ --url 'https://api.pressmonitor.com/youtube/v1/search?query_text=SOME_STRING_VALUE&num=SOME_INTEGER_VALUE&order=SOME_STRING_VALUE&event-type=SOME_STRING_VALUE&token=SOME_STRING_VALUE&country_code=SOME_STRING_VALUE&lang_code=SOME_STRING_VALUE' const http = require("https"); const options = { "method": "GET", "hostname": "api.pressmonitor.com", "port": null, "path": "/youtube/v1/search?query_text=SOME_STRING_VALUE&num=SOME_INTEGER_VALUE&order=SOME_STRING_VALUE&event-type=SOME_STRING_VALUE&token=SOME_STRING_VALUE&country_code=SOME_STRING_VALUE&lang_code=SOME_STRING_VALUE", "headers": {} }; const req = http.request(options, function (res) { const chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { const body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.end(); import requests url = "https://api.pressmonitor.com/youtube/v1/search" querystring = {"query_text":"SOME_STRING_VALUE","num":"SOME_INTEGER_VALUE","order":"SOME_STRING_VALUE","event-type":"SOME_STRING_VALUE","token":"SOME_STRING_VALUE","country_code":"SOME_STRING_VALUE","lang_code":"SOME_STRING_VALUE"} response = requests.request("GET", url, params=querystring) print(response.text) <?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.pressmonitor.com/youtube/v1/search?query_text=SOME_STRING_VALUE&num=SOME_INTEGER_VALUE&order=SOME_STRING_VALUE&event-type=SOME_STRING_VALUE&token=SOME_STRING_VALUE&country_code=SOME_STRING_VALUE&lang_code=SOME_STRING_VALUE", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.pressmonitor.com/youtube/v1/search?query_text=SOME_STRING_VALUE&num=SOME_INTEGER_VALUE&order=SOME_STRING_VALUE&event-type=SOME_STRING_VALUE&token=SOME_STRING_VALUE&country_code=SOME_STRING_VALUE&lang_code=SOME_STRING_VALUE") .get() .build(); Response response = client.newCall(request).execute(); Respostas
200 Sucesso
GET
/call Chamada genérica da API de dados do YouTube
Call
Parâmetros
| Nome | Tipo | Localização | Obrigatório | Descrição |
|---|---|---|---|---|
| path | string | query | Não | Caminho da API sob /youtube/v3 |
| endpoint | string | query | Não | Caminho alternativo da API caso path não seja usado |
| method | string | query | Não | Método HTTP, padrão GET |
Exemplos de Código
curl --request GET \ --url 'https://api.pressmonitor.com/youtube/v1/call?path=SOME_STRING_VALUE&endpoint=SOME_STRING_VALUE&method=SOME_STRING_VALUE' const http = require("https"); const options = { "method": "GET", "hostname": "api.pressmonitor.com", "port": null, "path": "/youtube/v1/call?path=SOME_STRING_VALUE&endpoint=SOME_STRING_VALUE&method=SOME_STRING_VALUE", "headers": {} }; const req = http.request(options, function (res) { const chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { const body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.end(); import requests url = "https://api.pressmonitor.com/youtube/v1/call" querystring = {"path":"SOME_STRING_VALUE","endpoint":"SOME_STRING_VALUE","method":"SOME_STRING_VALUE"} response = requests.request("GET", url, params=querystring) print(response.text) <?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.pressmonitor.com/youtube/v1/call?path=SOME_STRING_VALUE&endpoint=SOME_STRING_VALUE&method=SOME_STRING_VALUE", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.pressmonitor.com/youtube/v1/call?path=SOME_STRING_VALUE&endpoint=SOME_STRING_VALUE&method=SOME_STRING_VALUE") .get() .build(); Response response = client.newCall(request).execute(); Respostas
200 Sucesso
GET
/video-details Obter detalhes do vídeo
Get Video Details
Parâmetros
| Nome | Tipo | Localização | Obrigatório | Descrição |
|---|---|---|---|---|
| video_ids | string | query | Sim | IDs de vídeos do YouTube separados por vírgula |
Exemplos de Código
curl --request GET \ --url 'https://api.pressmonitor.com/youtube/v1/video-details?video_ids=SOME_STRING_VALUE' const http = require("https"); const options = { "method": "GET", "hostname": "api.pressmonitor.com", "port": null, "path": "/youtube/v1/video-details?video_ids=SOME_STRING_VALUE", "headers": {} }; const req = http.request(options, function (res) { const chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { const body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.end(); import requests url = "https://api.pressmonitor.com/youtube/v1/video-details" querystring = {"video_ids":"SOME_STRING_VALUE"} response = requests.request("GET", url, params=querystring) print(response.text) <?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.pressmonitor.com/youtube/v1/video-details?video_ids=SOME_STRING_VALUE", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.pressmonitor.com/youtube/v1/video-details?video_ids=SOME_STRING_VALUE") .get() .build(); Response response = client.newCall(request).execute(); Respostas
200 Sucesso