본문으로 건너뛰기

즈후 키워드 검색 API (V1) ​

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

즈후를 키워드로 검색합니다. 결과 유형, 정렬, 기간, 주제 표시, 오프셋은 선택 사항입니다. 관련 답변, 글 또는 동영상을 찾을 수 있습니다.

요청 파라미터 ​

이름 위치 유형 필수 기본값 설명
token query string 예 - API 액세스 토큰(TOKEN)입니다.
keyword query string 예 - 검색 키워드입니다.
offset query integer 아니요 0 시작 오프셋입니다. 0부터 시작합니다.
showAllTopics query string 아니요 FALSE 모든 주제를 표시할지 지정합니다.


사용 가능한 값

- FALSE: 주제를 표시하지 않음

- TRUE: 모든 주제 표시
vertical query string 아니요 - 결과 유형 필터입니다.


사용 가능한 값

- answer: 답변만

- article: 글만

- zvideo: 동영상만
sort query string 아니요 - 정렬 기준입니다.


사용 가능한 값

- upvoted_count: 추천 수가 많은 순서

- created_time: 최근 발행순
timeInterval query string 아니요 - 게시 기간 필터입니다.


사용 가능한 값

- a_day: 하루 이내

- a_week: 일주일 이내

- a_month: 한 달 이내

- three_months: 3개월 이내

- half_a_year: 반년 이내

- a_year: 1년 이내

코드 예제 ​

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

요청 파라미터:
- token (query): API 액세스 토큰(TOKEN)입니다. (필수)
- keyword (query): 검색 키워드입니다. (필수)
- offset (query): 시작 오프셋입니다. 0부터 시작합니다.
- showAllTopics (query): 모든 주제를 표시할지 지정합니다.

사용 가능한 값
- `FALSE`: 주제를 표시하지 않음
- `TRUE`: 모든 주제 표시
- vertical (query): 결과 유형 필터입니다.

사용 가능한 값
- `answer`: 답변만
- `article`: 글만
- `zvideo`: 동영상만
- sort (query): 정렬 기준입니다.

사용 가능한 값
- `upvoted_count`: 추천 수가 많은 순서
- `created_time`: 최근 발행순
- timeInterval (query): 게시 기간 필터입니다.

사용 가능한 값
- `a_day`: 하루 이내
- `a_week`: 일주일 이내
- `a_month`: 한 달 이내
- `three_months`: 3개월 이내
- `half_a_year`: 반년 이내
- `a_year`: 1년 이내

응답 형식: 실제 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/zhihu/search/v1?token=YOUR_API_KEY&keyword=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/zhihu/search/v1?token=YOUR_API_KEY&keyword=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/zhihu/search/v1?token=YOUR_API_KEY&keyword=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/zhihu/search/v1?token=YOUR_API_KEY&keyword=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/zhihu/search/v1?token=YOUR_API_KEY&keyword=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)의 주요 필드입니다.

검색 결과 및 페이지 번호필드 5개

data

성공적인 페이로드가 객체일 경우의 키워드 검색 결과 및 페이지 수.

필드 유형 설명
paging object 이 검색 응답으로 반환된 페이징 상태.
paging.is_end boolean 이 응답이 검색 결과의 끝을 보고하는지. true이면 다음 결과가 있더라도 중단.
paging.next string 즈후에서 제공하는 페이지 이동 URL입니다. is_end가 false이면 같은 검색어와 필터를 유지하고, 이 엔드포인트를 다음에 호출할 때 URL의 offset 값을 사용하세요.
data array 이 오프셋에서 반환된 검색 결과 카드. 배열은 비어 있을 수 있습니다. 카드 유형과 사용 가능한 필드는 다양할 수 있습니다.
related_search_result array Zhihu에서 제공하는 관련 검색 결과. 배열은 비어 있을 수 있습니다.
결과 카드필드 8개

data.data[]

하나의 검색 결과 카드.

필드 유형 설명
id integer | string 외부 결과 카드에 대해 반환된 식별자 (존재 시).
type string 외부 검색 결과 카드의 유형.
index integer 이 카드에 대해 보고된 결과 인덱스.
highlight object | null 제공될 경우의 일치하는 결과의 강조된 부분.
highlight.title string 검색 카드에 제공된 강조된 제목 텍스트.
highlight.description string 검색 카드에 제공된 강조된 설명 텍스트.
highlight.name string 검색 카드에 제공된 강조된 이름.
highlight.creator string 검색 카드에 제공된 강조된 크리에이터 이름.
콘텐츠필드 13개

data.data[].object

답변, 기사, 질문, 프로필, 또는 비디오와 같은 카드에 첨부된 콘텐츠. 필드는 콘텐츠 유형에 따라 달라집니다.

필드 유형 설명
id string 이 카드에 첨부된 콘텐츠에 대해 제공된 식별자 (존재 시).
type string 카드에 첨부된 콘텐츠의 유형.
title string 첨부된 콘텐츠의 제목, 제공될 경우.
description string | object 콘텐츠에 대한 반환된 설명. 일부 카드 유형은 구조화된 설명을 제공합니다.
raw_description string 비디오 콘텐츠에 대해 반환된 원시 설명 문자열.
excerpt string 콘텐츠에 대해 반환된 텍스트 발췌문. HTML을 포함할 수 있습니다.
content string 콘텐츠에 대한 반환된 본문. HTML을 포함할 수 있습니다.
url string 이 콘텐츠에 대한 Zhihu 제공된 URL.
redirect_url string 카드에 대한 목적 URL이 있는 경우 제공.
image_url string 카드에 제공된 이미지 URL.
is_anonymous boolean 콘텐츠에 대한 익명 플래그 보고.
created_time integer 콘텐츠의 생성 시간을 유닉스 초로 보고.
updated_time integer 콘텐츠에 대한 마지막 업데이트 시간, 유닉스 초 단위로 보고됨.
참여도필드 7개

data.data[].object

필드 유형 설명
voteup_count integer 콘텐츠 또는 프로필의 업보트 수.
comment_count integer 콘텐츠에 대한 댓글 수 보고.
favorites_count integer 콘텐츠를 즐겨찾기에 추가한 횟수입니다.
visits_count integer 콘텐츠에 대한 보고된 방문 수.
answer_count integer 질문 또는 프로필에 대해 보고된 답변 수.
articles_count integer 프로필에 보고된 기사 수.
follower_count integer 프로필 또는 질문에 대해 보고된 팔로워 수.
관련 질문필드 5개

data.data[].object.question

답변 결과와 관련된 질문.

필드 유형 설명
id string Zhihu 질문 식별자.
name string 답변과 함께 반환된 질문 제목.
type string 관련 질문 객체의 유형.
url string 관련 질문에 대한 반환된 URL.
answer_count integer 관련 질문에 대한 답변 수 보고.
프로필 및 작성자필드 15개

data.data[].object

필드 유형 설명
name string 프로필 결과에 제공된 표시 이름.
headline string 프로필 결과와 함께 보고된 프로필 헤드라인.
avatar_url string 프로필 아바타 URL.
url_token string Zhihu 프로필 URL에서 사용된 공개 프로필 slug.
author object 콘텐츠와 함께 제공된 작성자 프로필.
author.id string 작성자 프로필 식별자.
author.url_token string Zhihu 프로필 URL에서 사용된 공개 작가 slug.
author.name string 아티스트의 표시 이름.
author.headline string 작성자 프로필 헤드라인.
author.avatar_url string 작가 프로필 아바타 URL.
author.url string 작성자 프로필에 대한 반환된 URL.
author.type string 작가 프로필 객체의 유형.
author.follower_count integer 작가에 대한 보고된 팔로워 수.
author.voteup_count integer 작성자의 업보트 수.
creator string 비디오 결과와 함께 제공된 제작자 이름 텍스트.
비디오 정보필드 17개

data.data[].object

필드 유형 설명
zvideo_id string Zhihu 비디오 게시물의 식별자.
video_id string 비디오 미디어 식별자.
video_url string 결과에 대한 제공된 비디오 URL.
video_answer_url string 비디오와 관련된 답변에 대한 제공된 URL (존재 시).
cover_url string 비디오 커버 이미지 URL.
created_at integer 비디오에 대한 생성 타임스탬프 제공.
updated_at integer 비디오에 대한 마지막 업데이트 타임스탬프 제공됨.
duration number 비디오에 대한 보고된 지속 시간 값.
width integer 비디오 너비, 픽셀 단위.
height integer 비디오 높이, 픽셀 단위.
play_count integer 비디오에 대한 보고된 재생 횟수.
video_info object 비디오와 함께 제공된 추가 미디어 정보.
video_info.video_id string 비디오 미디어 식별자.
video_info.duration number 비디오 정보에 보고된 지속 시간 값.
video_info.width integer 비디오 너비, 픽셀 단위.
video_info.height integer 비디오 높이, 픽셀 단위.
video_info.play_count integer 비디오 정보에 보고된 재생 횟수.
재생 변형필드 28개

data.data[].object.playlist

품질 키별로 그룹화된 재생 변형. 사용 가능한 변형은 비디오에 따라 다를 수 있습니다.

필드 유형 설명
ld object 반환될 경우의 LD 재생 변형.
ld.url string 재생 변형에 대해 반환된 미디어 URL.
ld.play_url string 변형에 반환된 재생 URL.
ld.width integer 재생 변형의 너비(픽셀 단위).
ld.height integer 재생 변형의 픽셀 단위 높이.
ld.format string 재생 변형에 대해 보고된 미디어 형식.
ld.quality string 재생 변형에 보고된 품질 라벨.
sd object 반환된 SD 재생 변형.
sd.url string 재생 변형에 대해 반환된 미디어 URL.
sd.play_url string 변형에 반환된 재생 URL.
sd.width integer 재생 변형의 너비(픽셀 단위).
sd.height integer 재생 변형의 픽셀 단위 높이.
sd.format string 재생 변형에 대해 보고된 미디어 형식.
sd.quality string 재생 변형에 보고된 품질 라벨.
hd object 반환될 경우의 HD 재생 변형.
hd.url string 재생 변형에 대해 반환된 미디어 URL.
hd.play_url string 변형에 반환된 재생 URL.
hd.width integer 재생 변형의 너비(픽셀 단위).
hd.height integer 재생 변형의 픽셀 단위 높이.
hd.format string 재생 변형에 대해 보고된 미디어 형식.
hd.quality string 재생 변형에 보고된 품질 라벨.
fhd object 반환될 경우의 FHD 재생 변형.
fhd.url string 재생 변형에 대해 반환된 미디어 URL.
fhd.play_url string 변형에 반환된 재생 URL.
fhd.width integer 재생 변형의 너비(픽셀 단위).
fhd.height integer 재생 변형의 픽셀 단위 높이.
fhd.format string 재생 변형에 대해 보고된 미디어 형식.
fhd.quality string 재생 변형에 보고된 품질 라벨.

응답 예시 ​

응답 예시를 불러오는 중…