# 유튜브 댓글 조회



유튜브 공개 영상의 댓글을 인기순 또는 최신순으로 조회합니다. 작성자·내용·좋아요·고정 여부와 답글을 함께 받을 수 있습니다.



인증: Authorization: Bearer $APICK_API_KEY

본문 있는 REST 요청: multipart/form-data. GET 본문 및 MCP JSON-RPC 규격은 해당 명세를 따릅니다.

인증키는 서버에 보관하세요. 모든 예제는 정적 자료입니다.



## POST /rest/youtube_comments 응답 필드

- `data` (object): 조회 데이터

- `data.video_id` (string): 11자리 영상 ID

- `data.title` (string): 영상 제목

- `data.sort` (string): 정렬 방식

- `data.include_replies` (boolean): 답글 포함 여부

- `data.count` (integer): 이번 응답에 담긴 댓글 수(답글 포함)

- `data.comments` (array): 댓글 목록. 답글은 부모 댓글 바로 뒤에 옵니다.

- `data.comments[].id` (string): 댓글 ID

- `data.comments[].parent_id` (string): 답글이면 부모 댓글 ID, 최상위 댓글이면 null null 허용.

- `data.comments[].text` (string): 댓글 내용

- `data.comments[].author` (string): 작성자 표시 이름(@핸들)

- `data.comments[].author_channel_id` (string): 작성자 채널 ID. 모르면 null null 허용.

- `data.comments[].author_url` (string): 작성자 채널 주소

- `data.comments[].author_thumbnail` (string): 작성자 프로필 이미지 주소

- `data.comments[].author_is_uploader` (boolean): 영상 게시자 본인 댓글 여부

- `data.comments[].author_is_verified` (boolean): 인증 채널 작성자 여부

- `data.comments[].like_count` (integer): 좋아요 수

- `data.comments[].is_pinned` (boolean): 고정 댓글 여부

- `data.comments[].is_hearted` (boolean): 게시자 하트 여부

- `data.comments[].published_at` (string): 작성 시각(ISO 8601). 유튜브가 상대 시간(예: 2년 전)으로만 알려 주므로 근사값입니다.

- `data.success` (integer): 과금 여부0: 실패1: 성공

- `api` (object): API 호출 공통 데이터

- `api.success` (boolean): API 서버 정상 응답 여부

- `api.cost` (integer): API 호출 요금

- `api.pl_id` (integer): API 결제 로그 ID

- `api.ms` (integer): API 응답 시간

## API 요청: POST /rest/youtube_comments



### 입력

- `url` (string, 필수): 유튜브 영상 URL 또는 11자리 영상 ID

- `count` (integer, 선택): 가져올 댓글 수 1~200 (기본 20, 답글 포함)

- `sort` (string, 선택): top(인기순, 기본)·new(최신순) 허용값: top, new

- `replies` (boolean, 선택): true면 댓글마다 답글을 최대 5개까지 함께 가져옵니다 (기본 false)



### 응답 명세

```json

{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "video_id": {
          "type": "string",
          "description": "11자리 영상 ID"
        },
        "title": {
          "type": "string",
          "description": "영상 제목"
        },
        "sort": {
          "type": "string",
          "description": "정렬 방식"
        },
        "include_replies": {
          "type": "boolean",
          "description": "답글 포함 여부"
        },
        "count": {
          "type": "integer",
          "description": "이번 응답에 담긴 댓글 수(답글 포함)"
        },
        "comments": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "댓글 ID"
              },
              "parent_id": {
                "nullable": true,
                "type": "string",
                "description": "답글이면 부모 댓글 ID, 최상위 댓글이면 null"
              },
              "text": {
                "type": "string",
                "description": "댓글 내용"
              },
              "author": {
                "type": "string",
                "description": "작성자 표시 이름(@핸들)"
              },
              "author_channel_id": {
                "type": "string",
                "description": "작성자 채널 ID. 모르면 null",
                "nullable": true
              },
              "author_url": {
                "type": "string",
                "description": "작성자 채널 주소"
              },
              "author_thumbnail": {
                "type": "string",
                "description": "작성자 프로필 이미지 주소"
              },
              "author_is_uploader": {
                "type": "boolean",
                "description": "영상 게시자 본인 댓글 여부"
              },
              "author_is_verified": {
                "type": "boolean",
                "description": "인증 채널 작성자 여부"
              },
              "like_count": {
                "type": "integer",
                "description": "좋아요 수"
              },
              "is_pinned": {
                "type": "boolean",
                "description": "고정 댓글 여부"
              },
              "is_hearted": {
                "type": "boolean",
                "description": "게시자 하트 여부"
              },
              "published_at": {
                "type": "string",
                "description": "작성 시각(ISO 8601). 유튜브가 상대 시간(예: 2년 전)으로만 알려 주므로 근사값입니다."
              }
            }
          },
          "description": "댓글 목록. 답글은 부모 댓글 바로 뒤에 옵니다."
        },
        "success": {
          "type": "integer",
          "description": "과금 여부0: 실패1: 성공"
        }
      },
      "description": "조회 데이터"
    },
    "api": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean",
          "description": "API 서버 정상 응답 여부"
        },
        "cost": {
          "type": "integer",
          "description": "API 호출 요금"
        },
        "pl_id": {
          "type": "integer",
          "description": "API 결제 로그 ID"
        },
        "ms": {
          "type": "integer",
          "description": "API 응답 시간"
        }
      },
      "description": "API 호출 공통 데이터"
    }
  }
}

```

### 정적 응답 예시

```json

{
  "data": {
    "video_id": "9bZkp7q19f0",
    "title": "PSY - GANGNAM STYLE(강남스타일) M/V",
    "sort": "top",
    "include_replies": false,
    "count": 2,
    "comments": [
      {
        "id": "UgwD_2dCEaOU91LhAtt4AaABAg",
        "parent_id": null,
        "text": "2012: “get me outta here”\n\n2021: ”bring me back”",
        "author": "@budnick43",
        "author_channel_id": "UCof0NrJmaZvpUO0agapuDdg",
        "author_url": "https://www.youtube.com/@budnick43",
        "author_thumbnail": "https://yt3.ggpht.com/ytc/author=s88",
        "author_is_uploader": false,
        "author_is_verified": false,
        "like_count": 73000,
        "is_pinned": false,
        "is_hearted": false,
        "published_at": "2020-10-06T00:00:00.000Z"
      },
      {
        "id": "UgxcK4aIJ9CNHm_dlsV4AaABAg",
        "parent_id": null,
        "text": "PSY: Created a Korean song",
        "author": "@yyumass",
        "author_channel_id": "UCLnLLnsehKmxtpUYccYiFHQ",
        "author_url": "https://www.youtube.com/@yyumass",
        "author_thumbnail": "https://yt3.ggpht.com/ytc/author2=s88",
        "author_is_uploader": false,
        "author_is_verified": false,
        "like_count": 112000,
        "is_pinned": false,
        "is_hearted": false,
        "published_at": "2020-10-06T00:00:00.000Z"
      }
    ],
    "success": 1
  },
  "api": {
    "success": true,
    "cost": 30,
    "pl_id": 1595635,
    "ms": 3210
  }
}

```

### curl

```curl

curl --fail-with-body --request POST 'https://apick.app/rest/youtube_comments' \
  --header "Authorization: Bearer $APICK_API_KEY" \
  --form-string 'url=https://www.youtube.com/watch?v=9bZkp7q19f0' \
  --form-string 'count=2' \
  --form-string 'sort=top'

```

### Node.js (서버 ESM)

```javascript

const form = new FormData();
form.append("url", "https://www.youtube.com/watch?v=9bZkp7q19f0");
form.append("count", "2");
form.append("sort", "top");
const response = await fetch("https://apick.app/rest/youtube_comments", {
  method: "POST",
  headers: { Authorization: "Bearer " + process.env.APICK_API_KEY },
  body: form,
  signal: AbortSignal.timeout(120_000),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const result = await response.json();
console.log(result);

```

### python

```python

import os
import requests
parts = [
    ("url", (None, "https://www.youtube.com/watch?v=9bZkp7q19f0")),
    ("count", (None, "2")),
    ("sort", (None, "top")),
]
response = requests.request("POST", "https://apick.app/rest/youtube_comments",
    headers={"Authorization": "Bearer " + os.environ["APICK_API_KEY"]},
    files=parts,
    timeout=(10, 120))
response.raise_for_status()
result = response.json()
print(result)

```

### php

```php

<?php
$headers = ["Authorization: Bearer " . getenv("APICK_API_KEY")];
$form = [
    'url' => 'https://www.youtube.com/watch?v=9bZkp7q19f0',
    'count' => '2',
    'sort' => 'top',
];
$curl = curl_init('https://apick.app/rest/youtube_comments');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_POSTFIELDS => $form,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 120,
]);
$body = curl_exec($curl);
if ($body === false) { throw new RuntimeException(curl_error($curl)); }
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if ($status >= 400) { throw new RuntimeException($body); }
$result = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
print_r($result);

```

## 코드·오류

## 상세 기능·요금

Method URL POST https://apick.app/rest/youtube_comments API 호출 요청 요청하기 Key Value url count sort replies 응답

## 상세 요청

Header 이름 필수 설명 Authorization O Bearer 인증키

## 상세 응답

Body 이름 타입 설명 data Object 조회 데이터 video_id String 11자리 영상 ID title String 영상 제목 sort String 정렬 방식 include_replies Boolean 답글 포함 여부 count Integer 이번 응답에 담긴 댓글 수(답글 포함) comments Array 댓글 목록. 답글은 부모 댓글 바로 뒤에 옵니다. id String 댓글 ID parent_id String 답글이면 부모 댓글 ID, 최상위 댓글이면 null text String 댓글 내용 author String 작성자 표시 이름(@핸들) author_channel_id String 작성자 채널 ID. 모르면 null author_url String 작성자 채널 주소 author_thumbnail String 작성자 프로필 이미지 주소 author_is_uploader Boolean 영상 게시자 본인 댓글 여부 author_is_verified Boolean 인증 채널 작성자 여부 like_count Integer 좋아요 수 is_pinned Boolean 고정 댓글 여부 is_hearted Boolean 게시자 하트 여부 published_at String 작성 시각(ISO 8601). 유튜브가 상대 시간(예: 2년 전)으로만 알려 주므로 근사값입니다. success Integer 과금 여부0: 실패1: 성공 api Object API 호출 공통 데이터 success Boolean API 서버 정상 응답 여부 cost Integer API 호출 요금 ms Integer API 응답 시간 pl_id Integer API 결제 로그 ID

## 상세 코드·정책

오류 HTTP 상태 코드 HTTP 상황 설명 400 입력 오류 영상 주소, count, sort, replies 값을 확인하세요. 404 영상 없음 삭제·비공개 영상이거나 잘못된 주소입니다. 댓글이 꺼진 영상은 빈 목록으로 응답합니다. 408 시간 초과 처리 시간이 초과됐습니다. 과금하지 않습니다. 424 조회 불가 연령 제한·회원 전용 영상이거나 일시적으로 가져오지 못했습니다. 실패한 호출은 과금하지 않습니다.

## 상세 예제

요청 예시 form-data 전체 예제 보기 응답 예시 { "data": { "video_id": "9bZkp7q19f0", "title": "PSY - GANGNAM STYLE(강남스타일) M/V", "sort": "top", "include_replies": false, "count": 2, "comments": [ { "id": "UgwD_2dCEaOU91LhAtt4AaABAg", "parent_id": null, "text": "2012: “get me outta here”\n\n2021: ”bring me back”", "author": "@budnick43", "author_channel_id": "UCof0NrJmaZvpUO0agapuDdg", "author_url": "https://www.youtube.com/@budnick43", "author_thumbnail": "https://yt3.ggpht.com/ytc/author=s88", "author_is_uploader": false, "author_is_verified": false, "like_count": 73000, "is_pinned": false, "is_hearted": false, "published_at": "2020-10-06T00:00:00.000Z" }, { "id": "UgxcK4aIJ9CNHm_dlsV4AaABAg", "parent_id": null, "text": "PSY: Created a Korean song", "author": "@yyumass", "author_channel_id": "UCLnLLnsehKmxtpUYccYiFHQ", "author_url": "https://www.youtube.com/@yyumass", "author_thumbnail": "https://yt3.ggpht.com/ytc/author2=s88", "author_is_uploader": false, "author_is_verified": false, "like_count": 112000, "is_pinned": false, "is_hearted": false, "published_at": "2020-10-06T00:00:00.000Z" } ], "success": 1 }, "api": { "success": true, "cost": 30, "pl_id": 1595635, "ms": 3210 } }
