For the complete documentation index, see llms.txt. This page is also available as Markdown.

YouTube

了解如何使用网页爬虫API 获取 YouTube 数据。探索所有受支持的 YouTube 源并快速开始。

使用 网页爬虫API,您可以提取和解析各种类型的 YouTube 数据。以下是所有受支持的 YouTube 源值概览。

来源
描述

youtube_search

最多 20 条 搜索结果 ,对应您选择的搜索词。

youtube_search_max

最多 700 条 搜索结果 ,对应您选择的搜索词。

youtube_video_trainability

有关 YouTube 视频是否符合 AI 训练用途的信息。

youtube_download

所选 YouTube 视频 的音频/视频内容。

youtube_subtitles

所选 YouTube 视频的 字幕

youtube_metadata

所选 YouTube 视频的 元数据

youtube_channel

全部 频道数据,包括视频列表

youtube_autocomplete

搜索栏 自动补全建议 ,适用于任意搜索词

开始使用

创建您的 API 用户凭据:注册免费试用,或在 Oxylabs dashboard 中购买产品,以创建您的 API 用户凭据(USERNAMEPASSWORD).

请求示例

curl 'https://realtime.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
        "source": "youtube_search",
        "query": "how to make a website"
    }'
import requests
from pprint import pprint

# Structure payload.
payload = {
    'source': 'youtube_search',
    'query': 'how to make a website'
}

# Get response.
response = requests.request(
    'POST',
    'https://realtime.oxylabs.io/v1/queries',
    auth=('user', 'pass1'),
    json=payload,
)

# Print the JSON response with the result.
pprint(response.json())

我们在示例中使用同步 Realtime 集成方法。如果您想使用 Push-Pull 集成,请参阅 集成方法 部分。

最后更新于

这有帮助吗?