跳至主要內容

微博帖子詳情 API (V1) ​

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

檢索通過帖子ID標識的微博帖子詳情。用於查找已知帖子,以進行內容審查、存檔或相關互動分析。

請求參數 ​

參數名 位置 類型 必填 預設值 說明
token query string 是 - API 訪問令牌。
id query string 是 - 微博帖子ID。

程式碼範例 ​

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

請求參數說明:
- token (query): API 訪問令牌。 (必填)
- 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/weibo/get-weibo-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/weibo/get-weibo-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/weibo/get-weibo-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/weibo/get-weibo-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/weibo/get-weibo-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)的主要返回欄位。

帖子基本信息11 個欄位

data.status

所查詢的微博帖子。

欄位 類型 說明
id string 以字符串表示的微博帖子數字 ID。
mid string 以字符串表示的微博消息 ID。
bid string 微博帖子的字母數字短 ID。
created_at string 微博發佈時的時間,保留微博原始時間格式。
text string 微博返回的帖子正文,可能含 HTML 標記。
raw_text string 微博單獨返回時的純文本正文。
textLength integer 微博返回的帖子文本長度。
source string 微博展示的帖子發佈來源標籤,存在時可用。
status_title string 微博展示的帖子標題文字。
isLongText boolean 微博是否將此帖標記為長文。
region_name string 帖子展示的地區標籤。
互動資料10 個欄位

data.status

欄位 類型 說明
reposts_count integer 微博返回的轉發數。
comments_count integer 微博返回的評論數。
attitudes_count integer 微博返回的表態數。
favorites_count integer 微博返回的收藏數。
pending_approval_count integer 待審覈評論數。
multi_attitude array 按表態類型拆分的資料,存在時可用。
multi_attitude[] object 單種表態的計數條目。
multi_attitude[].type integer 表態類型的數字代碼。
multi_attitude[].count integer 該類型的表態數量。
most_attitude_type integer 微博返回的最多表態類型的數字代碼。
作者20 個欄位

data.status.user

帖子附帶的公開作者信息。

欄位 類型 說明
id integer 微博用戶的數字 ID。
screen_name string 微博帳號顯示名稱。
description string 公開個人簡介。
profile_image_url string 用戶資料的頭像地址。
avatar_hd string 高清頭像地址。
profile_url string 微博返回的個人主頁連結。
cover_image_phone string 移動端個人主頁封面圖片地址。
verified boolean 微博是否將此帳號標記為已認證。
verified_type integer 微博記錄的帳號認證數字類型。
verified_type_ext integer 補充的帳號認證數字分類。
verified_reason string 帳號展示的認證說明。
statuses_count integer 該帳號返回的發帖數。
follow_count integer 微博返回的該帳號關注數。
followers_count string 以文本返回的粉絲數,可能採用縮寫格式。
followers_count_str string 用於展示的粉絲數文本。
following boolean 當前查看帳號是否標記為已關注作者。
follow_me boolean 作者是否標記為已關注當前查看帳號。
gender string 公開資料記錄的性別代碼。
mbrank integer 微博返回的會員等級。
urank integer 微博返回的帳號等級。
圖片30 個欄位

data.status

欄位 類型 說明
pic_num integer 此帖返回的圖片數量。
pic_ids array 帖子附帶的圖片 ID 列表,可能為空。
pic_ids[] string 微博圖片 ID。
thumbnail_pic string 返回時表示首張圖片的縮略圖地址。
bmiddle_pic string 返回時表示首張圖片的中等尺寸地址。
original_pic string 微博原圖欄位中的地址,存在時可用。
pics array 微博隨帖子返回的圖片詳情,存在時可用。
pics[] object 帖子附帶的一張圖片。
pics[].pid string 微博圖片 ID。
pics[].size string 該圖片版本的尺寸標籤。
pics[].url string 此圖片版本的地址。
pics[].geo object 圖片尺寸及裁剪標記。
pics[].geo.width integer 圖片寬度,單位為像素。
pics[].geo.height integer 圖片高度,單位為像素。
pics[].geo.croped boolean 微博是否將此圖標記為已裁剪。
pics[].large object 較大尺寸的圖片版本,存在時可用。
pics[].large.url string 較大尺寸圖片版本的地址。
pics[].large.size string 該圖片版本的尺寸標籤。
pics[].large.geo object 圖片尺寸及裁剪標記。
pics[].large.geo.width string 以文本表示的圖片寬度,單位為像素。
pics[].large.geo.height string 以文本表示的圖片高度,單位為像素。
pics[].large.geo.croped boolean 微博是否將此圖標記為已裁剪。
pic_focus_point array 圖片焦點區域列表,存在時可用。
pic_focus_point[] object 關聯一張圖片的焦點區域。
pic_focus_point[].pic_id string 微博圖片 ID。
pic_focus_point[].focus_point object 微博返回的焦點區域座標與大小。
pic_focus_point[].focus_point.left integer 焦點區域的左側座標。
pic_focus_point[].focus_point.top integer 焦點區域的頂部座標。
pic_focus_point[].focus_point.width integer 焦點區域寬度。
pic_focus_point[].focus_point.height number 焦點區域高度。
內容卡片與視頻21 個欄位

data.status.page_info

隨帖子返回的內容卡片,例如話題或站內視頻,存在時可用。

欄位 類型 說明
type string 微博內容卡片的類型標籤。
object_type integer 微博記錄的內容對象數字類型。
object_id string 內容卡片關聯的微博內容對象 ID。
page_title string 內容卡片展示的標題。
title string 內容卡片返回的標題欄位,可能為空字符串。
content1 string 內容卡片返回的第一行文字。
content2 string 內容卡片返回的第二行文字。
page_pic object 內容卡片的圖片信息。
page_pic.pid string 微博圖片 ID。
page_pic.url string 內容卡片的圖片地址。
page_pic.width string 以文本表示的圖片寬度,單位為像素。
page_pic.height string 以文本表示的圖片高度,單位為像素。
video_orientation string 微博返回的視頻畫面方向標籤。
play_count string 以展示文本表示的播放量,可能採用縮寫格式。
media_info object 站內視頻的播放元資料,存在時可用。
media_info.duration number 播放元資料返回的視頻時長。
media_info.stream_url string 微博返回的視頻流地址。
media_info.stream_url_hd string 微博返回的高清視頻流地址。
urls object 按格式區分的可用視頻地址。
urls.mp4_hd_mp4 string 高清 MP4 地址,存在時可用。
urls.mp4_ld_mp4 string 較低清晰度的 MP4 地址,存在時可用。
可見性與評論設置13 個欄位

data.status

欄位 類型 說明
is_paid boolean 微博是否將此帖標記為付費內容。
ad_marked boolean 微博是否將此帖標記為廣告。
can_edit boolean 當前回應上下文是否可編輯帖子。
favorited boolean 當前回應上下文是否標記為已收藏此帖。
visible object 此帖返回的可見性設置。
visible.type integer 微博返回的可見性數字代碼。
visible.list_id integer 關聯可見性名單的數字 ID。
comment_manage_info object 此帖返回的評論管理設置。
comment_manage_info.comment_permission_type integer 評論權限的數字設置。
comment_manage_info.approval_comment_type integer 評論審覈的數字設置。
comment_manage_info.comment_sort_type integer 評論排序的數字設置。
comment_manage_info.comment_anon_type integer 匿名評論的數字設置。
forbid_bullet_screens boolean 是否標記為禁用彈幕。
轉發原帖10 個欄位

data.status.retweeted_status

轉發時附帶的原帖信息,存在時可用。原帖作者信息可能為 null。

欄位 類型 說明
id string 以字符串表示的微博帖子數字 ID。
mid string 以字符串表示的微博消息 ID。
bid string 微博帖子的字母數字短 ID。
created_at string 微博發佈時的時間,保留微博原始時間格式。
text string 微博返回的帖子正文,可能含 HTML 標記。
textLength integer 微博返回的帖子文本長度。
source string 微博展示的帖子發佈來源標籤,存在時可用。
isLongText boolean 微博是否將此帖標記為長文。
title object 此帖附帶的標題信息。
title.text string 展示的標題文字。
原帖作者20 個欄位

data.status.retweeted_status.user

帖子附帶的公開作者信息。

欄位 類型 說明
id integer 微博用戶的數字 ID。
screen_name string 微博帳號顯示名稱。
description string 公開個人簡介。
profile_image_url string 用戶資料的頭像地址。
avatar_hd string 高清頭像地址。
profile_url string 微博返回的個人主頁連結。
cover_image_phone string 移動端個人主頁封面圖片地址。
verified boolean 微博是否將此帳號標記為已認證。
verified_type integer 微博記錄的帳號認證數字類型。
verified_type_ext integer 補充的帳號認證數字分類。
verified_reason string 帳號展示的認證說明。
statuses_count integer 該帳號返回的發帖數。
follow_count integer 微博返回的該帳號關注數。
followers_count string 以文本返回的粉絲數,可能採用縮寫格式。
followers_count_str string 用於展示的粉絲數文本。
following boolean 當前查看帳號是否標記為已關注作者。
follow_me boolean 作者是否標記為已關注當前查看帳號。
gender string 公開資料記錄的性別代碼。
mbrank integer 微博返回的會員等級。
urank integer 微博返回的帳號等級。
原帖附件與視頻24 個欄位

data.status.retweeted_status

欄位 類型 說明
pic_num integer 此帖返回的圖片數量。
pic_ids array 帖子附帶的圖片 ID 列表,可能為空。
page_info object 隨帖子返回的內容卡片,例如話題或站內視頻,存在時可用。
page_info.type string 微博內容卡片的類型標籤。
page_info.object_type integer 微博記錄的內容對象數字類型。
page_info.object_id string 內容卡片關聯的微博內容對象 ID。
page_info.page_title string 內容卡片展示的標題。
page_info.title string 內容卡片返回的標題欄位,可能為空字符串。
page_info.content1 string 內容卡片返回的第一行文字。
page_info.content2 string 內容卡片返回的第二行文字。
page_info.page_pic object 內容卡片的圖片信息。
page_info.page_pic.pid string 微博圖片 ID。
page_info.page_pic.url string 內容卡片的圖片地址。
page_info.page_pic.width string 以文本表示的圖片寬度,單位為像素。
page_info.page_pic.height string 以文本表示的圖片高度,單位為像素。
page_info.video_orientation string 微博返回的視頻畫面方向標籤。
page_info.play_count string 以展示文本表示的播放量,可能採用縮寫格式。
page_info.media_info object 站內視頻的播放元資料,存在時可用。
page_info.media_info.duration number 播放元資料返回的視頻時長。
page_info.media_info.stream_url string 微博返回的視頻流地址。
page_info.media_info.stream_url_hd string 微博返回的高清視頻流地址。
page_info.urls object 按格式區分的可用視頻地址。
page_info.urls.mp4_hd_mp4 string 高清 MP4 地址,存在時可用。
page_info.urls.mp4_ld_mp4 string 較低清晰度的 MP4 地址,存在時可用。
原帖互動與可見性18 個欄位

data.status.retweeted_status

欄位 類型 說明
is_paid boolean 微博是否將此帖標記為付費內容。
ad_marked boolean 微博是否將此帖標記為廣告。
can_edit boolean 當前回應上下文是否可編輯帖子。
favorited boolean 當前回應上下文是否標記為已收藏此帖。
visible object 此帖返回的可見性設置。
visible.type integer 微博返回的可見性數字代碼。
visible.list_id integer 關聯可見性名單的數字 ID。
visible.list_idstr string 以文本表示的關聯可見性名單 ID。
reposts_count integer 微博返回的轉發數。
comments_count integer 微博返回的評論數。
attitudes_count integer 微博返回的表態數。
favorites_count integer 微博返回的收藏數。
pending_approval_count integer 待審覈評論數。
comment_manage_info object 此帖返回的評論管理設置。
comment_manage_info.comment_permission_type integer 評論權限的數字設置。
comment_manage_info.approval_comment_type integer 評論審覈的數字設置。
comment_manage_info.comment_sort_type integer 評論排序的數字設置。
comment_manage_info.comment_anon_type integer 匿名評論的數字設置。
回應信息1 個欄位

data

微博帖子詳情。帖子不可用時,此值可能為 null。

欄位 類型 說明
canonical string 隨帖子返回的規範連結元素,以 HTML 文本表示。

回應示例 ​

正在載入回應範例…