# FlashData YouTube Channel API

รับข้อมูล YouTube โพรไฟล์สี และวิดีโอล่าสุดของมันโดยการจัดการ รวมถึงจํานวนผู้เข้ารับ, รายละเอียดทางช่องภาพและรายละเอียดวิดีโอ

อ้างอิงทางคลอง: https://flashdata.dev/th/docs/sources/youtube_channel
Recorder: 2026-10-23

จุดสิ้นสุด: POST https://data.flashdata.dev/v1/queries/realtime
การยืนยันตัวตน: X-API-Key: YOUR_API_KEY
โหมด: [Realtime](https://flashdata.dev/th/docs/reference/realtime-and-async/reference.md#realtime) · [Async](https://flashdata.dev/th/docs/reference/realtime-and-async/reference.md#async) · [Batch](https://flashdata.dev/th/docs/reference/batch-and-bulk/reference.md#batch)

ต้องการสิทธิ์ที่อนุญาตจากแหล่ง: youtube_channel

แทนที่ YOUR_API_KEY ด้วย API กุญแจที่มีแหล่งที่ได้รับอนุญาตนี้ และหน่วยกิตที่มีอยู่ ประมวลผลการร้องขอบนเซิร์ฟเวอร์หรือโฮสต์ตัวแทนของคุณ

[ตั้งค่าการตรวจสอบสิทธิ์](https://flashdata.dev/th/docs/guides/headers-and-authentication/reference.md)

[ทํางานกับช่องทางและวิดีโอล่าสุด](https://flashdata.dev/th/docs/guides/youtube-data-guide/reference.md#channel)

<a id="quickstart"></a>

## ส่งคําขอมา

### Python

```bash
python3 -m pip install requests
```

```python
import json

import requests

api_key = "YOUR_API_KEY"
payload = {
    "source": "youtube_channel",
    "handle": "@jawed",
    "params": {
        "video_limit": 10,
    },
}

response = requests.post(
    "https://data.flashdata.dev/v1/queries/realtime",
    headers={"X-API-Key": api_key},
    json=payload,
    timeout=120,
)
response.raise_for_status()
print(json.dumps(response.json(), ensure_ascii=False, indent=2))
```

### Bash / cURL

```bash
api_key="YOUR_API_KEY"
curl --fail-with-body --max-time 120 --request POST "https://data.flashdata.dev/v1/queries/realtime" \
  --header "Content-Type: application/json" \
  --header "X-API-Key: $api_key" \
  --data-binary @- <<'FLASHDATA_JSON'
{
  "source": "youtube_channel",
  "handle": "@jawed",
  "params": {
    "video_limit": 10
  }
}
FLASHDATA_JSON
```

<a id="parameters"></a>

## พารามิเตอร์

<a id="parameters-group-0"></a>

### เนื้อหาคำขอ

| พารามิเตอร์ | ชนิด | จำเป็น | ค่าเริ่มต้น | คําอธิบาย |
| --- | --- | --- | --- | --- |
| <a id="parameter-source"></a> source | string | ใช่ | — | กําหนดเป็น youtube_channel  |
| <a id="parameter-handle"></a> handle | string | ใช่ | ยังไม่ได้ตั้งค่า | แชนแนลจัดการ เช่น @jahew การนําหน้า@ expression is every. ความยาวน้อยที่สุด: 1. ความยาวสูงสุด: 100. |
| <a id="parameter-params"></a> params | object | ไม่ | {} | Settings สําหรับการร้องขอนี้  |
| <a id="parameter-callback_url"></a> callback_url | string · nullable | ไม่ | ยังไม่ได้ตั้งค่า | Async และชุดเท่านั้น สาธารณะ HTTPS เสร็จสมบูรณ์แล้ว URL บนพอร์ต 443ถึง 2,048 ตัวละคร ไม่มีเอกสารรับรองผู้ใช้หรือส่วน URL Omit, ใช้ null หรือข้อความเปล่าสําหรับไม่ให้แจ้งเตือน ในชุดนี้ กําหนดให้แต่ละคําถาม ภายนอกพม่า  |

<a id="parameters-group-1"></a>

### การเลือกวิดีโอ

| พารามิเตอร์ | ชนิด | จำเป็น | ค่าเริ่มต้น | คําอธิบาย |
| --- | --- | --- | --- | --- |
| <a id="parameter-params-video_limit"></a> params.video_limit | integer | ไม่ | 20 | วิดีโอสูงสุดที่รวมเข้าไปด้วย อาจ มี น้อย กว่า นี้. น้อยที่สุด: 1. ค่าสูงสุด: 100. |

<a id="response"></a>

## อ่านผลที่ออกมา

บันทึกความสําเร็จ JSON ตอบกลับเป็น response.json. บันทึกนี้เป็น read-response.py และเรียกไพธอน read-response.py. มันใช้เฉพาะ Pythonห้องสมุดมาตรฐาน และไม่มีการร้องขอใหม่

### read-response.py

```python
import json
from pathlib import Path

response = json.loads(Path("response.json").read_text(encoding="utf-8-sig"))
if response.get("status") not in ("done", "completed") or not isinstance(response.get("results"), list):
    raise SystemExit("Expected completed result JSON; inspect the response or job status.")
if not response["results"]:
    print("[]")
    raise SystemExit(0)
result = response["results"][0]

output = {
    "channelId": result.get("channelId"),
    "name": result.get("name"),
    "videos": [
        {"videoId": item.get("videoId"), "title": item.get("title")}
        for item in result.get("videos", [])
    ],
}
print(json.dumps(output, ensure_ascii=False, indent=2))
```

## ตัวอย่างคำตอบ

ตัว อย่าง ที่ บันทึก ไว้; ทุ่ง นา และ การ นับ ขึ้น อยู่ กับ แหล่ง กําเนิด และ ข้อ เรียก ร้อง ให้ นํา เข้า.
```json
{
  "source": "youtube_channel",
  "status": "done",
  "results": [
    {
      "channelId": "UC4QobU6STFB0P71PMvOGN5A",
      "channelHandle": "@jawed",
      "name": "jawed",
      "description": "",
      "subscriberCount": 6580000,
      "videoCount": 1,
      "viewCount": null,
      "avatarUrl": "https://yt3.googleusercontent.com/uI3VE4PVqvCy0xnWLqMJnEzyBUm3T8VHOCp4ee-1RxdHqKXCdUE_qXYQnpf9AfuEoIPactVyDhM=s0",
      "bannerUrl": null,
      "channelUrl": "https://www.youtube.com/channel/UC4QobU6STFB0P71PMvOGN5A",
      "videos": [
        {
          "videoId": "jNQXAC9IVRw",
          "title": "Me at the zoo",
          "duration": 19,
          "viewCount": 431000000,
          "uploadDate": null,
          "thumbnail": "https://i.ytimg.com/vi/jNQXAC9IVRw/hqdefault.jpg?sqp=-oaymwE2COADEI4CSFXyq4qpAygIARUAAIhCGAFwAcABBvABAfgBvgKAAvABigIMCAAQARhVIFkoZTAP&rs=AOn4CLDkGJrAGBspJ5G6u9b7tutsHbloEg"
        }
      ]
    }
  ],
  "usage": {
    "credits": 0.01
  },
  "created_at": "2026-09-16T07:41:47.218Z"
}
```

## ช่องข้อมูลแบบวนรอบ

| ช่องข้อมูล | ชนิด | คําอธิบาย |
| --- | --- | --- |
| source | string | สิ่งที่ร้องขอมา API แหล่งข่าว |
| status | string | เสร็จสิ้นเมื่อการร้องขอจริง สําเร็จ |
| created_at | string | ช่วงเวลาการสร้างแบบ ISO 8601 |
| usage.credits | number | บัตรเครดิตตามที่ขอ จากแผนของคุณ |
| results[0].channelId | string | ช่อง ID. |
| results[0].channelHandle | string | แชนเนลจับ |
| results[0].name | string | ชื่อทางช่อง |
| results[0].description | string | รายละเอียดทางช่อง |
| results[0].subscriberCount | number · nullable | นับผู้เข้ารับสมัคร |
| results[0].videoCount | number · nullable | รวมจํานวนวิดีโอทั้งหมด |
| results[0].viewCount | number · nullable | จํานวนมุมมองแสดงช่องหากมี |
| results[0].avatarUrl | string · nullable | อวตารช่อง URL. |
| results[0].bannerUrl | string · nullable | ป้ายช่อง URL. |
| results[0].channelUrl | string | หน้าช่อง URL. |
| results[0].videos | array | วิดีโอล่าสุด, จนถึงรายการ video_limit |
| results[0].videos[].videoId | string | วิดีโอ ID. |
| results[0].videos[].title | string | ชื่อวิดีโอ |
| results[0].videos[].duration | number · nullable | ระยะเวลาในวินาที |
| results[0].videos[].viewCount | number · nullable | ดูนับสิ |
| results[0].videos[].uploadDate | string · nullable | วันที่อัพโหลด |
| results[0].videos[].thumbnail | string · nullable | Video URL. |

- สถิติทางช่องและภาพอาจจะไม่สามารถใช้งานได้ videoCount จง อธิบาย ช่อง; รายการ วี ดิ ทัศน์ มี เพียง วี ดิ โอ ที่ ได้ รับ การ เสนอ เมื่อ เร็ว ๆ นี้.

## รูปแบบคำตอบ

การตอบสนองต่าง ๆ ใช้ JSON โดยปริยายแล้ว เลือกรูปแบบอื่นด้วยส่วนหัวแบบเสริมเหล่านี้

- Accept: application/json (ค่าปริยาย) หรือ text/plain. ข้อความธรรมดาแสดงสนามเดียวกัน ในผังที่อ่านได้ และไม่สามารถเปลี่ยนแปลงได้
- X-Respond-With: markdown. ไม่ต้องตั้งค่าสําหรับสนามเดิม Markdown ทํางานกับรูปแบบการตอบสนองต่าง ๆ

Markdown มีการใช้งานสําหรับลําดับเวลาจริงและผลลัพธ์ที่เสร็จสมบูรณ์

ช่องข้อมูลด้านล่างนี้ ใช้อธิบายค่าปริยาย JSON ตอบสนอง

[ตัวอย่างการร้องขอและรูปแบบการตอบสนอง](https://flashdata.dev/th/docs/guides/response-formats/reference.md#headers)

<a id="job-lifecycle"></a>

<a id="async-batch"></a>

## พื้นฐาน API

ตัวสร้างและตัวอย่างที่ต้องการด้านบน ใช้พารามิเตอร์ของแหล่งนี้ ใช้ Python ถึง cURL ตัวอย่างด้านล่างนี้ สําหรับการร่วมยอมจํานน สถานะ และขั้นตอนที่มีผล A Batch ร่างกายคือ JSON ออบเจกต์ที่มีลําดับ; แต่ละรายการจะคืนงานของมันเอง ID.

- [Async ร้องขอและใบเสร็จ](https://flashdata.dev/th/docs/reference/realtime-and-async/reference.md#async)

<a id="job-status"></a>

- [ตรวจสอบสถานะงานพิมพ์](https://flashdata.dev/th/docs/reference/realtime-and-async/reference.md#status)

<a id="job-results"></a>

- [ดึงข้อมูลผลลัพธ์ที่เสร็จสมบูรณ์แล้ว](https://flashdata.dev/th/docs/reference/realtime-and-async/reference.md#results)
- [Batch JSON ต้องการ](https://flashdata.dev/th/docs/reference/batch-and-bulk/reference.md#batch)
- [ผู้จัดทํา OpenAPI](https://flashdata.dev/docs/openapi.json)

<a id="webhooks"></a>

<a id="callbacks"></a>

## แจ้งเตือนการเติมให้สมบูรณ์

- [รับข้อมูลและตรวจสอบการเติมให้สมบูรณ์ของเว็บฮุค](https://flashdata.dev/th/docs/guides/async-batch/reference.md#webhooks)

<a id="troubleshooting"></a>

## การยิงปัญหา

- [ข้อผิดพลาดและรหัสสถานะ](https://flashdata.dev/th/docs/errors/reference.md#status-codes)
- [เมื่อต้องการลองใหม่](https://flashdata.dev/th/docs/errors/reference.md#retries)

## API ที่เกี่ยวข้อง

- [YouTube ข้อมูลกํากับภาพวิดีโอ API](https://flashdata.dev/th/docs/sources/youtube_metadata/reference.md)
- [YouTube Search API](https://flashdata.dev/th/docs/sources/youtube_search/reference.md)
