YouTube 自动完成
了解如何使用 网页爬虫 API 获取 YouTube 搜索词建议。了解其参数并查看示例请求。
请求示例
curl 'https://realtime.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
"source": "youtube_autocomplete",
"query": "what is",
"language": "en",
"location": "US"
}'import requests
from pprint import pprint
# 构建负载。
payload = {
"source": "youtube_autocomplete",
"query": "what is",
"language": "en",
"location": "US"
}
# 获取响应。
response = requests.request(
"POST",
"https://realtime.oxylabs.io/v1/queries",
auth=("USERNAME", "PASSWORD"),
json=payload,
)
# 打印包含结果的 JSON 响应。
pprint(response.json())输出示例
{
"results": [
{
"content": "window.google.ac.h([\"what is\",[[\"what is love\",0,[512,433]],[\"what is this feeling wicked\",0,[512,433,131]],[\"what is love baby dont hurt me no\",0,[512,433]],[\"what is 67\",0,[512,433,131]],[\"what is\",0,[512]],[\"what is you nba youngboy\",0,[512,433,131]],[\"what is love haddaway\",0,[512,433]],[\"what is this feeling wicked karaoke\",0,[512,433]],[\"what is love twice\",0,[512,433,131]],[\"what is you\",0,[512,433,131,650]],[\"what is sounds like\",0,[512,433]],[\"what is scientology\",0,[512]],[\"what is the big beautiful bill\",0,[512]],[\"what is a woman\",0,[512,433]]],{\"j\":\"5\",\"k\":1,\"q\":\"fxuDygqjaW7TVwu4-jEjTrWp6b8\"}])",
"type": "raw",
...
}请求参数值
参数
说明
默认值
本地化
最后更新于
这有帮助吗?

