본문으로 건너뛰기

Twitter 게시물 댓글 API (V1) ​

GET
API 상태
정상 사용 가능 일부 사용 가능 대부분 사용 불가 데이터 없음
API 상태를 불러오는 중…

트윗 ID로 X(Twitter) 게시물의 최신 댓글을 조회합니다. 커서 기반 페이지네이션으로 특정 게시물의 최근 토론을 확인하고 다음 댓글 페이지를 조회할 수 있습니다.

요청 파라미터 ​

이름 위치 유형 필수 기본값 설명
token query string 예 - API 접근에 필요한 인증 토큰입니다.
tweetId query string 예 - X(Twitter) 게시물의 고유 식별자입니다.
cursor query string 아니요 직전 응답에서 반환한 페이지네이션 커서입니다.

코드 예제 ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/twitter/get-post-comments/v1?token=YOUR_API_KEY&tweetId=VALUE'
text
JustOneAPI의 "게시물 댓글 (V1)" API를 사용하고 싶습니다.
기본 URL: https://api.justoneapi.com.
API 경로: /api/twitter/get-post-comments/v1?token=YOUR_API_KEY&tweetId=VALUE
API 주소: BASE_URL + /api/twitter/get-post-comments/v1?token=YOUR_API_KEY&tweetId=VALUE
HTTP 메서드: GET
인증: URL에 "token" 쿼리 파라미터를 추가하세요.
OpenAPI 정의: https://docs.justoneapi.com/openapi/twitter/post-comments-v1-ko.json

요청 파라미터:
- token (query): API 접근에 필요한 인증 토큰입니다. (필수)
- tweetId (query): X(Twitter) 게시물의 고유 식별자입니다. (필수)
- cursor (query): 직전 응답에서 반환한 페이지네이션 커서입니다.

응답 형식: 실제 Content-Type에 따라 JSON 또는 텍스트를 안전하게 처리하세요.

응답 처리 및 오류 코드
1. 응답 본문의 "code" 필드에서 처리 결과를 확인하세요. 0은 성공을 뜻합니다.
2. 권장 요청 제한 시간은 120초입니다. 120초가 너무 길다면 최소 60초로 설정하세요. 일부 요청은 응답을 받기 전에 시간 초과될 수 있습니다.
3. API 결과 코드
   - 0: 성공
   - 100: 유효하지 않거나 비활성화된 토큰
   - 301: 데이터 수집에 실패했습니다. 다시 시도해 주세요.
   - 302: 호출 빈도 제한 초과
   - 303: 일일 호출 한도 초과
   - 400: 잘못된 파라미터
   - 500: 서버 내부 오류
   - 600: 호출 권한 없음
   - 601: 계정 잔액 부족
   - 602: API 토큰의 누적 예산 한도 초과
4. 601은 공유 계정 잔액이 부족하다는 뜻입니다. 602는 현재 API 토큰의 누적 예산 한도에 도달했다는 뜻입니다. 토큰 예산을 설정해도 공유 계정 잔액은 별도로 배정되지 않습니다.

제가 사용하는 프로그래밍 언어로 이 API를 호출하고 응답을 처리하는 스크립트를 작성해 주세요.
python
import requests

BASE_URL = "https://api.justoneapi.com"  # OpenAPI 서버 설정에서 제공

url = BASE_URL + "/api/twitter/get-post-comments/v1?token=YOUR_API_KEY&tweetId=VALUE"
response = requests.get(url, timeout=120)
print(response.status_code)
if response.content:
    content_type = response.headers.get("content-type", "").lower()
    if "json" in content_type:
        try:
            print(response.json())
        except ValueError:
            print(response.text)
    elif content_type.startswith("text/") or "xml" in content_type or content_type.split(";", 1)[0].strip() in {"application/javascript", "application/x-www-form-urlencoded", "application/graphql"}:
        print(response.text)
    else:
        with open("response.bin", "wb") as output:
            output.write(response.content)
        print(f"Saved {len(response.content)} bytes to response.bin")
js
const BASE_URL = "https://api.justoneapi.com"; // OpenAPI 서버 설정에서 제공
const url = BASE_URL + "/api/twitter/get-post-comments/v1?token=YOUR_API_KEY&tweetId=VALUE";

const response = await fetch(url, {
  method: "GET",
  signal: AbortSignal.timeout(120000)
});
console.log(response.status);
const responseBytes = await response.arrayBuffer();
if (responseBytes.byteLength) {
  const contentType = (response.headers.get("content-type") || "").toLowerCase();
  const mediaType = contentType.split(";", 1)[0].trim();
  const textual = contentType.startsWith("text/") || contentType.includes("json") || contentType.includes("xml") || ["application/javascript", "application/x-www-form-urlencoded", "application/graphql"].includes(mediaType);
  if (textual) {
    const responseText = new TextDecoder().decode(responseBytes);
    let data = responseText;
    if (contentType.includes("json")) {
      try { data = JSON.parse(responseText); } catch { /* Keep the raw body. */ }
    }
    console.log(data);
  } else {
    console.log(`Received ${responseBytes.byteLength} binary bytes`);
  }
}
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
    public static void main(String[] args) throws Exception {
        final String BASE_URL = "https://api.justoneapi.com"; // OpenAPI 서버 설정에서 제공
        final String url = BASE_URL + "/api/twitter/get-post-comments/v1?token=YOUR_API_KEY&tweetId=VALUE";

        HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(120)).build();
        HttpRequest.Builder builder = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .timeout(Duration.ofSeconds(120))
            .method("GET", HttpRequest.BodyPublishers.noBody());

        HttpRequest request = builder.build();

        HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
        System.out.println(response.statusCode());
        String contentType = response.headers().firstValue("content-type").orElse("").toLowerCase();
        String mediaType = contentType.split(";", 2)[0].trim();
        if (contentType.startsWith("text/") || contentType.contains("json") || contentType.contains("xml") || mediaType.equals("application/javascript") || mediaType.equals("application/x-www-form-urlencoded") || mediaType.equals("application/graphql")) {
            System.out.println(new String(response.body(), StandardCharsets.UTF_8));
        } else {
            Files.write(Path.of("response.bin"), response.body());
            System.out.println("Saved " + response.body().length + " bytes to response.bin");
        }
    }
}
go
package main

import (
	"fmt"
	"io"
	"os"
	"strings"
	"net/http"
	"time"
)

const BASE_URL = "https://api.justoneapi.com" // OpenAPI 서버 설정에서 제공

func main() {
	client := &http.Client{Timeout: 120 * time.Second}
	url := BASE_URL + "/api/twitter/get-post-comments/v1?token=YOUR_API_KEY&tweetId=VALUE"
	req, _ := http.NewRequest("GET", url, nil)
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	fmt.Println(resp.StatusCode)
	bodyBytes, _ := io.ReadAll(resp.Body)
	contentType := strings.ToLower(resp.Header.Get("Content-Type"))
	mediaType := strings.TrimSpace(strings.SplitN(contentType, ";", 2)[0])
	if strings.HasPrefix(contentType, "text/") || strings.Contains(contentType, "json") || strings.Contains(contentType, "xml") || mediaType == "application/javascript" || mediaType == "application/x-www-form-urlencoded" || mediaType == "application/graphql" {
		fmt.Println(string(bodyBytes))
	} else {
		os.WriteFile("response.bin", bodyBytes, 0600)
		fmt.Printf("Saved %d bytes to response.bin\n", len(bodyBytes))
	}
}
php
<?php
$BASE_URL = 'https://api.justoneapi.com'; // OpenAPI 서버 설정에서 제공
$url = $BASE_URL . '/api/twitter/get-post-comments/v1?token=YOUR_API_KEY&tweetId=VALUE';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$contentType = strtolower((string) curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
echo $status . PHP_EOL;
$mediaType = trim(explode(';', $contentType, 2)[0]);
if (str_starts_with($contentType, 'text/') || str_contains($contentType, 'json') || str_contains($contentType, 'xml') || in_array($mediaType, ['application/javascript', 'application/x-www-form-urlencoded', 'application/graphql'], true)) {
    echo $response;
} else {
    file_put_contents('response.bin', $response);
    echo 'Saved ' . strlen($response) . ' bytes to response.bin' . PHP_EOL;
}

응답 필드 ​

성공 응답(code = 0)의 주요 필드입니다.

게시물 및 답변 관계필드 14개

data.timeline[]

하나의 타임라인 항목입니다. 이 항목에는 답장과 원본 게시물이 포함될 수 있습니다.

필드 유형 설명
tweet_id string X 게시물 ID, 문자열로 반환됨.
created_at string 게시물이 게시된 시간.
text string 게시물의 텍스트.
lang string 게시물에 보고된 언어 코드.
conversation_id string 대화 내의 루트 게시물 ID, 문자열로 반환됨.
sensitive boolean | null 값이 사용 가능할 때 게시물이 잠재적으로 민감한 것으로 표시되는지 여부.
type string X이 보고한 항목 유형 라벨.
screen_name string @ 접두사 없이 계정 사용자명.
display_text_range array 표시된 텍스트의 시작 및 종료 위치입니다.
display_text_range[] integer -
source string | null 게시 클라이언트 레이블, HTML 링크 또는 null일 수 있음.
in_reply_to_status_id_str string 이 항목이 직접 답장하는 게시물의 ID가 문자열 형태로 반환됩니다.
in_reply_to_user_id_str string 이 항목이 직접 답장하는 계정의 ID가 문자열 형태로 반환됩니다.
in_reply_to_screen_name string 이 항목이 직접 답장하는 계정의 사용자명입니다.
페이지당 항목 수필드 4개

data

필드 유형 설명
status string 응답 데이터에서 반환된 상태 라벨.
timeline array 요청된 게시물 및 페이지에 대한 타임라인 항목들입니다.
next_cursor string 값이 비어 있지 않을 경우 다음 페이지의 커서로 이 값을 전달함.
prev_cursor string 뒤로 페이지 나열에 대한 커서. 비어 있을 수 있음.
참여도필드 6개

data.timeline[]

필드 유형 설명
bookmarks integer 북마크 수입니다.
favorites integer 보고된 ‘좋아요’ 수입니다.
quotes integer 보고된 인용 수.
replies integer 보고된 답변 수.
retweets integer 보고된 재게시 수입니다.
views string | null 숫자 문자열 형태로 보고된 조회 수입니다. null일 수도 있습니다.
작성자필드 10개

data.timeline[].user_info

이 항목의 작성자의 공개 프로필 필드입니다.

필드 유형 설명
rest_id string X 계정 ID, 문자열로 반환됨.
created_at string X 계정이 생성된 시간.
name string 계정 표시 이름.
screen_name string @ 접두사 없이 계정 사용자명.
avatar string 프로필 아바타 URL.
followers_count integer 작성자를 팔로우하는 계정 수입니다.
favorites_count integer 작성자가 좋아요를 누른 게시물 수입니다.
verified boolean 작성자에 대한 확인 플래그가 반환되었습니다.
verified_type string | null 제공된 경우 계정 인증 범주.
location string 작성자가 프로필에 제공한 위치 텍스트. 비어 있을 수 있음.
링크 및 언급필드 23개

data.timeline[].entities

게시물 텍스트와 관련된 링크, 언급, 기타 엔티티들입니다.

필드 유형 설명
urls array 게시물 텍스트에서 발견된 링크.
urls[] object -
urls[].url string 게시물 텍스트에 나타나는 짧은 링크.
urls[].expanded_url string 링크된 목적지의 확장된 URL.
urls[].display_url string 게시물과 함께 표시되는 읽기 쉬운 링크 레이블.
urls[].indices array 게시물 텍스트 내 엔티티의 시작 및 종료 위치입니다.
urls[].indices[] integer -
user_mentions array 게시물에 언급된 계정들.
user_mentions[] object -
user_mentions[].id_str string X 계정 ID, 문자열로 반환됨.
user_mentions[].name string 계정 표시 이름.
user_mentions[].screen_name string @ 접두사 없이 계정 사용자명.
user_mentions[].indices array 게시물 텍스트 내 엔티티의 시작 및 종료 위치입니다.
user_mentions[].indices[] integer -
hashtags array 게시물과 관련된 해시태그 엔티티가 반환되었습니다.
symbols array 게시물과 관련된 기호 엔티티들이 반환되었습니다.
media array 게시물에 대한 미디어 링크 엔티티가 반환됨.
media[] object -
media[].id_str string 미디어 엔티티 ID, 문자열 형태로 반환됨.
media[].type string 이 첨부파일에 대한 미디어 엔티티 유형이 반환됨.
media[].media_url_https string 미디어 엔티티와 관련된 HTTPS URL.
media[].indices array 게시물 텍스트 내 엔티티의 시작 및 종료 위치입니다.
media[].indices[] integer -
이미지 및 동영상필드 18개

data.timeline[].media

미디어 첨부파일. 첨부파일이 없을 경우 응답에 빈 배열을 사용할 수 있음.

필드 유형 설명
photo array 첨부된 이미지들.
photo[] object -
photo[].id string 이미지 첨부 ID, 문자열로 반환됨.
photo[].media_url_https string 이미지의 HTTPS URL.
photo[].sizes object 이미지 크기, 픽셀 단위.
photo[].sizes.h integer 이미지 높이(픽셀).
photo[].sizes.w integer 이미지 너비(픽셀).
video array 첨부된 비디오들.
video[] object -
video[].id string 비디오 첨부 파일 ID, 문자열 형태로 반환됩니다.
video[].media_url_https string 비디오 미리보기 이미지의 HTTPS URL.
video[].variants array 사용 가능한 비디오 재생 변형들.
video[].variants[] object -
video[].variants[].url string 이 비디오 변형에 대한 재생 URL.
video[].variants[].content_type string 이 비디오 변형에 대한 미디어 유형.
video[].variants[].bitrate integer 이 비디오 변형에 대한 비트레이트 정보.
video[].aspect_ratio array 비디오의 화면 비율은 두 개의 정수 배열로 제공됩니다.
video[].aspect_ratio[] integer -
인용된 게시물필드 38개

data.timeline[].quoted

이 항목에 의해 인용된 게시물, 사용 가능할 경우.

필드 유형 설명
tweet_id string X 게시물 ID, 문자열로 반환됨.
created_at string 게시물이 게시된 시간.
text string 게시물의 텍스트.
lang string 게시물에 보고된 언어 코드.
conversation_id string 대화 내의 루트 게시물 ID, 문자열로 반환됨.
sensitive boolean | null 값이 사용 가능할 때 게시물이 잠재적으로 민감한 것으로 표시되는지 여부.
bookmarks integer 북마크 수입니다.
favorites integer 보고된 ‘좋아요’ 수입니다.
quotes integer 보고된 인용 수.
replies integer 보고된 답변 수.
retweets integer 보고된 재게시 수입니다.
views string | null 숫자 문자열 형태로 보고된 조회 수입니다. null일 수도 있습니다.
author object 인용된 게시물 작성자의 공개 프로필 필드입니다.
author.rest_id string X 계정 ID, 문자열로 반환됨.
author.created_at string X 계정이 생성된 시간.
author.name string 계정 표시 이름.
author.screen_name string @ 접두사 없이 계정 사용자명.
author.avatar string 프로필 아바타 URL.
author.blue_verified boolean 인용된 게시물 작성자의 블루 체크 상태.
media object | array 미디어 첨부파일. 첨부파일이 없을 경우 응답에 빈 배열을 사용할 수 있음.
media.photo array 첨부된 이미지들.
media.photo[] object -
media.photo[].id string 이미지 첨부 ID, 문자열로 반환됨.
media.photo[].media_url_https string 이미지의 HTTPS URL.
media.photo[].sizes object 이미지 크기, 픽셀 단위.
media.photo[].sizes.h integer 이미지 높이(픽셀).
media.photo[].sizes.w integer 이미지 너비(픽셀).
media.video array 첨부된 비디오들.
media.video[] object -
media.video[].id string 비디오 첨부 파일 ID, 문자열 형태로 반환됩니다.
media.video[].media_url_https string 비디오 미리보기 이미지의 HTTPS URL.
media.video[].variants array 사용 가능한 비디오 재생 변형들.
media.video[].variants[] object -
media.video[].variants[].url string 이 비디오 변형에 대한 재생 URL.
media.video[].variants[].content_type string 이 비디오 변형에 대한 미디어 유형.
media.video[].variants[].bitrate integer 이 비디오 변형에 대한 비트레이트 정보.
media.video[].aspect_ratio array 비디오의 화면 비율은 두 개의 정수 배열로 제공됩니다.
media.video[].aspect_ratio[] integer -

응답 예시 ​

응답 예시를 불러오는 중…