跳至主要內容

知乎專欄文章詳情 API (V1) ​

GET
API 端點健康狀態
健康 可用 少量可用 基本不可用 暫無資料
正在載入健康狀態…

獲取由文章ID標識的知乎專欄文章的詳情。用於查看已知文章,進行閱讀、審閱或歸檔。

請求參數 ​

參數名 位置 類型 必填 預設值 說明
token query string 是 - TOKEN
id query string 是 - 文章ID

程式碼範例 ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=VALUE'
text
我想使用 JustOneAPI 提供的“專欄文章詳情 (V1)”接口。
接入地址: https://api.justoneapi.com。
接口路徑: /api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=VALUE
接口地址: BASE_URL + /api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=VALUE
HTTP 方法: GET
身份驗證: 在 URL 中傳入 token 查詢參數。
OpenAPI 定義: https://docs.justoneapi.com/openapi/zhihu/column-article-details-v1-zh-hant.json

請求參數說明:
- token (query): TOKEN (必填)
- id (query): 文章ID (必填)

返回格式: 請根據實際 Content-Type 安全處理 JSON 或文本回應。

回應處理與錯誤代碼:
1. 需通過返回體中的 "code" 欄位判斷業務結果(code 為 0 表示成功)。
2. 逾時建議:建議將請求逾時時間設置為 120 秒;如果 120 秒偏長,請至少設置為 60 秒,但可能會有少量請求因逾時而未接收到結果。
3. 業務碼說明:
   - 0: 成功
   - 100: Token 無效或已失效
   - 301: 採集失敗,請重試
   - 302: 超出速率限制
   - 303: 超出每日配額
   - 400: 參數錯誤
   - 500: 內部伺服器錯誤
   - 600: 權限不足
   - 601: 帳戶餘額不足
   - 602: TOKEN 限額超限
4. code 601 表示帳戶共享餘額不足。code 602 表示當前 API TOKEN 自身的累計消費上限已達到。TOKEN 限額不是資金劃撥,多個 TOKEN 仍共享同一個帳戶餘額。

請幫我用我擅長的編程語言寫一個腳本來呼叫這個接口,並處理返回結果。
python
import requests

BASE_URL = "https://api.justoneapi.com"  # 由 OpenAPI servers 提供

url = BASE_URL + "/api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=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 servers 提供
const url = BASE_URL + "/api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=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 servers 提供
        final String url = BASE_URL + "/api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=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 servers 提供

func main() {
	client := &http.Client{Timeout: 120 * time.Second}
	url := BASE_URL + "/api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=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 servers 提供
$url = $BASE_URL . '/api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=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)的主要返回欄位。

文章與正文9 個欄位

data

欄位 類型 說明
id string 知乎文章 ID,以字符串返回。
title string 文章標題。
type string 知乎返回的內容實體類型。
article_type string 知乎返回的文章類別。
url string 知乎返回的文章連結。
excerpt string 文章摘要。
content string 文章正文,以 HTML 字符串返回。
created integer 文章創建時間,使用 Unix 秒級時間戳。
updated integer 文章更新時間,使用 Unix 秒級時間戳。
作者10 個欄位

data.author

文章作者的公開資料。

欄位 類型 說明
id string 知乎用戶 ID,以字符串返回。
uid string 知乎返回的另一種用戶標識。
name string 知乎帳號的公開顯示名稱。
headline string 知乎個人主頁公開顯示的一句話簡介。
description string 知乎個人主頁的公開介紹。
avatar_url string 公開頭像連結。
url string 知乎返回的用戶連結。
type string 知乎返回的帳號實體類型。
user_type string 知乎返回的用戶類別。
is_org boolean 知乎是否將該帳號標為機構帳號。
封面圖片4 個欄位

data

欄位 類型 說明
image_url string 文章圖片連結,可用時返回。
title_image string 文章題圖連結,可用時返回。
image_width integer 返回的文章圖片寬度。
image_height integer 返回的文章圖片高度。
所屬專欄27 個欄位

data

欄位 類型 說明
has_column boolean 文章是否關聯專欄。
column object 關聯專欄的信息,可用時返回。
column.id string 知乎專欄 ID,以字符串返回。
column.title string 專欄標題。
column.intro string 專欄的簡短介紹。
column.description string 專欄描述。
column.url string 知乎返回的專欄連結。
column.image_url string 專欄圖片連結。
column.type string 知乎返回的專欄實體類型。
column.column_type string 知乎返回的專欄類別。
column.created integer 專欄創建時間,使用 Unix 秒級時間戳。
column.updated integer 專欄更新時間,使用 Unix 秒級時間戳。
column.followers integer 返回的專欄關注人數。
column.articles_count integer 返回的專欄文章數。
column.accept_submission boolean 專欄是否接受文章投稿。
column.comment_permission string 返回的專欄評論權限設置。
column.author object 專欄作者的公開資料。
column.author.id string 知乎用戶 ID,以字符串返回。
column.author.uid string 知乎返回的另一種用戶標識。
column.author.name string 知乎帳號的公開顯示名稱。
column.author.headline string 知乎個人主頁公開顯示的一句話簡介。
column.author.description string 知乎個人主頁的公開介紹。
column.author.avatar_url string 公開頭像連結。
column.author.url string 知乎返回的用戶連結。
column.author.type string 知乎返回的帳號實體類型。
column.author.user_type string 知乎返回的用戶類別。
column.author.is_org boolean 知乎是否將該帳號標為機構帳號。
專欄投稿30 個欄位

data

欄位 類型 說明
contributions array 文章的專欄投稿記錄,可能為空數組。
contributions[].id integer 投稿記錄的標識。
contributions[].state string 知乎返回的投稿狀態。
contributions[].type string 知乎返回的投稿實體類型。
contributions[].column object 該投稿記錄關聯的專欄。
contributions[].column.id string 知乎專欄 ID,以字符串返回。
contributions[].column.title string 專欄標題。
contributions[].column.intro string 專欄的簡短介紹。
contributions[].column.description string 專欄描述。
contributions[].column.url string 知乎返回的專欄連結。
contributions[].column.image_url string 專欄圖片連結。
contributions[].column.type string 知乎返回的專欄實體類型。
contributions[].column.column_type string 知乎返回的專欄類別。
contributions[].column.created integer 專欄創建時間,使用 Unix 秒級時間戳。
contributions[].column.updated integer 專欄更新時間,使用 Unix 秒級時間戳。
contributions[].column.followers integer 返回的專欄關注人數。
contributions[].column.articles_count integer 返回的專欄文章數。
contributions[].column.accept_submission boolean 專欄是否接受文章投稿。
contributions[].column.comment_permission string 返回的專欄評論權限設置。
contributions[].column.author object 專欄作者的公開資料。
contributions[].column.author.id string 知乎用戶 ID,以字符串返回。
contributions[].column.author.uid string 知乎返回的另一種用戶標識。
contributions[].column.author.name string 知乎帳號的公開顯示名稱。
contributions[].column.author.headline string 知乎個人主頁公開顯示的一句話簡介。
contributions[].column.author.description string 知乎個人主頁的公開介紹。
contributions[].column.author.avatar_url string 公開頭像連結。
contributions[].column.author.url string 知乎返回的用戶連結。
contributions[].column.author.type string 知乎返回的帳號實體類型。
contributions[].column.author.user_type string 知乎返回的用戶類別。
contributions[].column.author.is_org boolean 知乎是否將該帳號標為機構帳號。
話題5 個欄位

data

欄位 類型 說明
topics array 文章關聯的話題列表。
topics[].id string 知乎話題 ID,以字符串返回。
topics[].name string 話題顯示名稱。
topics[].type string 知乎返回的話題實體類型。
topics[].url string 知乎返回的話題連結。
互動與評論11 個欄位

data

欄位 類型 說明
voteup_count integer 返回的文章贊同數。
liked_count integer 返回的文章點贊數。
comment_count integer 返回的文章評論數。
favlists_count integer 返回的收藏該文章的收藏夾數量。
tipjarors_count integer 返回的文章打賞人數。
can_tip boolean 返回的文章頁面是否可以打賞。
comment_permission string 返回的文章評論權限設置。
admin_closed_comment boolean 評論是否被標記為已由管理員關閉。
can_comment object 返回的文章頁面的評論可用狀態。
can_comment.status boolean 返回的文章頁面是否允許評論。
can_comment.reason string 評論可用狀態的原因說明,可用時返回。
狀態與展示7 個欄位

data

欄位 類型 說明
state string 知乎返回的文章狀態。
is_visible boolean 返回的文章頁面是否標記為可見。
ip_info string 文章公開顯示的歸屬地文本,可用時返回。
share_text string 知乎提供的文章分享文案。
content_need_truncated boolean 知乎是否將返回的正文標記為摺疊展示。
force_login_when_click_read_more boolean 在返回的文章頁面點擊「閱讀全文」時是否需要登入。
copyright_permission string 返回的文章版權權限設置。

回應示例 ​

正在載入回應範例…