YouTube video search for a query — views, channels
serpapi.youtube.search.videosSearch YouTube videos by keyword and get titles, channels, view counts and links
- Price
- $0.015/successPelo preço do provedor
- Success rate
- 100%Last 30 days · 1.335 calls
- Latency p50
- 2.5 sp95 5.4 s
- Last verified
- 28 de jul. de 2026Verified working
GEThttps://toolswitch.dev/v1/tools/serpapi.youtube.search.videos?engine=youtube&search_query=coffeePreview- Uses platform quota
- Synchronous response
- Reads public data
Parâmetros
answers arrive in `video_results`; the response may also carry `channel_results`, `movie_results`, `ads_results` and `serpapi_pagination`.
| Parâmetro | Tipo | Obrigatório | Descrição | Exemplo |
|---|---|---|---|---|
| Parâmetros de consulta | ||||
gl | string | Opcional | country code, e.g. us | us |
hl | string | Opcional | interface language code, e.g. en | en |
sp | string | Opcional | YouTube's encoded filter/pagination token — carries sort order, upload date and result-type filters | |
engine | string | Obrigatório | youtube | |
search_query | string | Obrigatório | THE QUERY PARAM IS `search_query`, NOT `q` — sending `q` to this engine returns nothing | coffee |
- Parâmetros de consulta
glstringOpcionalcountry code, e.g. us
Exemplo:
ushlstringOpcionalinterface language code, e.g. en
Exemplo:
enspstringOpcionalYouTube's encoded filter/pagination token — carries sort order, upload date and result-type filters
enginestringObrigatórioExemplo:
youtubesearch_querystringObrigatórioTHE QUERY PARAM IS `search_query`, NOT `q` — sending `q` to this engine returns nothing
Exemplo:
coffee
Exemplos de código
Substitua $TOOLSWITCH_KEY pela chave criada no console.
curl -X GET 'https://toolswitch.dev/v1/tools/serpapi.youtube.search.videos?engine=youtube&search_query=coffee' \
-H "X-Toolswitch-Key: $TOOLSWITCH_KEY"import os
import requests
response = requests.request(
"GET",
"https://toolswitch.dev/v1/tools/serpapi.youtube.search.videos?engine=youtube&search_query=coffee",
headers={"X-Toolswitch-Key": os.environ["TOOLSWITCH_KEY"]},
)
response.raise_for_status()
print(response.text)const response = await fetch("https://toolswitch.dev/v1/tools/serpapi.youtube.search.videos?engine=youtube&search_query=coffee", {
method: "GET",
headers: {
"X-Toolswitch-Key": process.env.TOOLSWITCH_KEY ?? "",
},
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
console.log(await response.text());Esta API de gateway está em prévia; a URL e a autenticação podem mudar. Os parâmetros do exemplo são dados de amostra. As chamadas são cobradas a $0.015/success, incluindo a taxa de serviço.