> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/api-targets/cn/shi-pin-yu-she-jiao-mei-ti/youtube/youtube-video-trainability.md).

# 视频可训练性

该 `youtube_video_trainability` 该 source 旨在检索某个特定 YouTube 视频是否 **有资格用于 AI 训练**。此服务可验证 YouTube 内容的训练权限。

## 请求示例

以下示例演示如何检查特定 YouTube 视频的 AI 训练权限。

{% tabs %}
{% tab title="cURL" %}

```bash
curl 'https://realtime.oxylabs.io/v1/queries' \\
--user 'USERNAME:PASSWORD' \\
-H 'Content-Type: application/json' \\
-d '{
"source": "youtube_video_trainability",
"video_id": "rFNDylrjn_w"
}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://realtime.oxylabs.io/v1/queries"
payload = {
    "source": "youtube_video_trainability",
    "video_id": "rFNDylrjn_w"
}
headers = {
    "Content-Type": "application/json"
}
auth = ("USERNAME", "PASSWORD")

response = requests.post(url, json=payload, headers=headers, auth=auth)
print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const fetch = require('node-fetch');

const url = 'https://realtime.oxylabs.io/v1/queries';
const payload = {
    source: 'youtube_video_trainability',
    video_id: 'rFNDylrjn_w'
};

const options = {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Basic ' + Buffer.from('USERNAME:PASSWORD').toString('base64')
    },
    body: JSON.stringify(payload)
};

fetch(url, options)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
```

{% endtab %}

{% tab title="HTTP" %}

```http
POST /v1/queries HTTP/1.1
Host: realtime.oxylabs.io
Authorization: Basic [BASE64_ENCODED_CREDENTIALS]
Content-Type: application/json

{
    "source": "youtube_video_trainability",
    "video_id": "rFNDylrjn_w"
}
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$url = 'https://realtime.oxylabs.io/v1/queries';
$payload = [
    'source' => 'youtube_video_trainability',
    'video_id' => 'rFNDylrjn_w'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_USERPWD, 'USERNAME:PASSWORD');

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    url := "https://realtime.oxylabs.io/v1/queries"
    payload := map[string]string{
        "source": "youtube_video_trainability",
        "video_id":  "rFNDylrjn_w",
    }
    
    jsonPayload, _ := json.Marshal(payload)
    
    req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonPayload))
    req.Header.Set("Content-Type", "application/json")
    req.SetBasicAuth("USERNAME", "PASSWORD")
    
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()
    
    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(body))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        using (var client = new HttpClient())
        {
            var url = "https://realtime.oxylabs.io/v1/queries";
            var payload = @"{
                ""source"": ""youtube_video_trainability"",
                ""video_id"": ""rFNDylrjn_w""
            }";
            
            var content = new StringContent(payload, Encoding.UTF8, "application/json");
            var byteArray = Encoding.ASCII.GetBytes("USERNAME:PASSWORD");
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
                "Basic", Convert.ToBase64String(byteArray));
            
            var response = await client.PostAsync(url, content);
            var responseContent = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseContent);
        }
    }
}
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Base64;

public class OxylabsRequest {
    public static void main(String[] args) throws IOException, InterruptedException {
        String url = "https://realtime.oxylabs.io/v1/queries";
        String payload = "{\"source\":\"youtube_video_trainability\",\"video_id\":\"rFNDylrjn_w\"}";
        
        String auth = "USERNAME:PASSWORD";
        String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes());
        
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Basic " + encodedAuth)
                .POST(HttpRequest.BodyPublishers.ofString(payload))
                .build();
        
        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
    "source": "youtube_video_trainability",
    "video_id": "rFNDylrjn_w"
}
```

{% endtab %}
{% endtabs %}

我们在示例中使用同步 [**Realtime**](/products/cn/web-scraper-api/integration-methods/realtime.md) 集成方式。如果您想使用 [**Push-Pull**](/products/cn/web-scraper-api/integration-methods/push-pull.md) 集成，请参阅 [**集成方法**](/products/cn/web-scraper-api/integration-methods.md) 部分。

## 请求参数值

<table><thead><tr><th>参数</th><th width="225.04296875">描述</th><th>默认值</th></tr></thead><tbody><tr><td><mark style="background-color:green;"><strong><code>source</code></strong></mark></td><td>设置爬虫。</td><td><code>youtube_video_trainability</code></td></tr><tr><td><mark style="background-color:green;"><strong><code>video_id</code></strong></mark></td><td>YouTube 视频 ID。</td><td>-</td></tr><tr><td><code>callback_url</code></td><td>回调端点的 URL。 <a href="/spaces/ZwEHB9k4MH4pDy80n9mF/pages/f93fe40aed5366f8033cd2ebfae30e61c16a4f51"><strong>更多信息</strong></a></td><td>-</td></tr></tbody></table>

&#x20;    \- 必填参数

## 响应格式

API 返回一个结构化 JSON 响应，包含以下字段：

```json
{
  "videoId": "<YOUTUBE_VIDEO_ID>",
  "kind": "youtube#videoTrainability",
  "etag": "<ETAG_VALUE>",
  "permitted": ["<PERMISSION_LEVEL>"]
}
```

该 `permitted` 字段表示视频可用的训练权限级别，可能的值如下：

| 值                           | 描述            |
| --------------------------- | ------------- |
| `["all"]`                   | 允许所有方进行训练     |
| `["none"]`                  | 任何方均不允许训练     |
| `["party1", "party2", ...]` | 仅允许列出的特定方进行训练 |

该 `etag` 该值用作训练状态的版本标识符。

### 示例响应

```json
{
  "videoId": "rFNDylrjn_w",
  "kind": "youtube#videoTrainability",
  "etag": "oXToFpOwrHWvoiN1YbOa0tkzOn0",
  "permitted": ["None"]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.oxylabs.io/api-targets/cn/shi-pin-yu-she-jiao-mei-ti/youtube/youtube-video-trainability.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
