Skip to content

微博帖子详情 API (V1) ​

GET
接口健康状态
健康 可用 少量可用 基本不可用 暂无数据
正在加载健康状态…

检索通过帖子ID标识的微博帖子详情。用于查找已知帖子,以进行内容审查、存档或相关互动分析。

请求参数 ​

参数名位置类型必填默认值说明
tokenquerystring是-API 访问令牌。
idquerystring是-微博帖子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.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

所查询的微博帖子。

字段类型说明
idstring以字符串表示的微博帖子数字 ID。
midstring以字符串表示的微博消息 ID。
bidstring微博帖子的字母数字短 ID。
created_atstring微博发布时的时间,保留微博原始时间格式。
textstring微博返回的帖子正文,可能含 HTML 标记。
raw_textstring微博单独返回时的纯文本正文。
textLengthinteger微博返回的帖子文本长度。
sourcestring微博展示的帖子发布来源标签,存在时可用。
status_titlestring微博展示的帖子标题文字。
isLongTextboolean微博是否将此帖标记为长文。
region_namestring帖子展示的地区标签。
互动数据10 个字段

data.status

字段类型说明
reposts_countinteger微博返回的转发数。
comments_countinteger微博返回的评论数。
attitudes_countinteger微博返回的表态数。
favorites_countinteger微博返回的收藏数。
pending_approval_countinteger待审核评论数。
multi_attitudearray按表态类型拆分的数据,存在时可用。
multi_attitude[]object单种表态的计数条目。
multi_attitude[].typeinteger表态类型的数字代码。
multi_attitude[].countinteger该类型的表态数量。
most_attitude_typeinteger微博返回的最多表态类型的数字代码。
作者20 个字段

data.status.user

帖子附带的公开作者信息。

字段类型说明
idinteger微博用户的数字 ID。
screen_namestring微博账号显示名称。
descriptionstring公开个人简介。
profile_image_urlstring用户资料的头像地址。
avatar_hdstring高清头像地址。
profile_urlstring微博返回的个人主页链接。
cover_image_phonestring移动端个人主页封面图片地址。
verifiedboolean微博是否将此账号标记为已认证。
verified_typeinteger微博记录的账号认证数字类型。
verified_type_extinteger补充的账号认证数字分类。
verified_reasonstring账号展示的认证说明。
statuses_countinteger该账号返回的发帖数。
follow_countinteger微博返回的该账号关注数。
followers_countstring以文本返回的粉丝数,可能采用缩写格式。
followers_count_strstring用于展示的粉丝数文本。
followingboolean当前查看账号是否标记为已关注作者。
follow_meboolean作者是否标记为已关注当前查看账号。
genderstring公开资料记录的性别代码。
mbrankinteger微博返回的会员等级。
urankinteger微博返回的账号等级。
图片30 个字段

data.status

字段类型说明
pic_numinteger此帖返回的图片数量。
pic_idsarray帖子附带的图片 ID 列表,可能为空。
pic_ids[]string微博图片 ID。
thumbnail_picstring返回时表示首张图片的缩略图地址。
bmiddle_picstring返回时表示首张图片的中等尺寸地址。
original_picstring微博原图字段中的地址,存在时可用。
picsarray微博随帖子返回的图片详情,存在时可用。
pics[]object帖子附带的一张图片。
pics[].pidstring微博图片 ID。
pics[].sizestring该图片版本的尺寸标签。
pics[].urlstring此图片版本的地址。
pics[].geoobject图片尺寸及裁剪标记。
pics[].geo.widthinteger图片宽度,单位为像素。
pics[].geo.heightinteger图片高度,单位为像素。
pics[].geo.cropedboolean微博是否将此图标记为已裁剪。
pics[].largeobject较大尺寸的图片版本,存在时可用。
pics[].large.urlstring较大尺寸图片版本的地址。
pics[].large.sizestring该图片版本的尺寸标签。
pics[].large.geoobject图片尺寸及裁剪标记。
pics[].large.geo.widthstring以文本表示的图片宽度,单位为像素。
pics[].large.geo.heightstring以文本表示的图片高度,单位为像素。
pics[].large.geo.cropedboolean微博是否将此图标记为已裁剪。
pic_focus_pointarray图片焦点区域列表,存在时可用。
pic_focus_point[]object关联一张图片的焦点区域。
pic_focus_point[].pic_idstring微博图片 ID。
pic_focus_point[].focus_pointobject微博返回的焦点区域坐标与大小。
pic_focus_point[].focus_point.leftinteger焦点区域的左侧坐标。
pic_focus_point[].focus_point.topinteger焦点区域的顶部坐标。
pic_focus_point[].focus_point.widthinteger焦点区域宽度。
pic_focus_point[].focus_point.heightnumber焦点区域高度。
内容卡片与视频21 个字段

data.status.page_info

随帖子返回的内容卡片,例如话题或站内视频,存在时可用。

字段类型说明
typestring微博内容卡片的类型标签。
object_typeinteger微博记录的内容对象数字类型。
object_idstring内容卡片关联的微博内容对象 ID。
page_titlestring内容卡片展示的标题。
titlestring内容卡片返回的标题字段,可能为空字符串。
content1string内容卡片返回的第一行文字。
content2string内容卡片返回的第二行文字。
page_picobject内容卡片的图片信息。
page_pic.pidstring微博图片 ID。
page_pic.urlstring内容卡片的图片地址。
page_pic.widthstring以文本表示的图片宽度,单位为像素。
page_pic.heightstring以文本表示的图片高度,单位为像素。
video_orientationstring微博返回的视频画面方向标签。
play_countstring以展示文本表示的播放量,可能采用缩写格式。
media_infoobject站内视频的播放元数据,存在时可用。
media_info.durationnumber播放元数据返回的视频时长。
media_info.stream_urlstring微博返回的视频流地址。
media_info.stream_url_hdstring微博返回的高清视频流地址。
urlsobject按格式区分的可用视频地址。
urls.mp4_hd_mp4string高清 MP4 地址,存在时可用。
urls.mp4_ld_mp4string较低清晰度的 MP4 地址,存在时可用。
可见性与评论设置13 个字段

data.status

字段类型说明
is_paidboolean微博是否将此帖标记为付费内容。
ad_markedboolean微博是否将此帖标记为广告。
can_editboolean当前响应上下文是否可编辑帖子。
favoritedboolean当前响应上下文是否标记为已收藏此帖。
visibleobject此帖返回的可见性设置。
visible.typeinteger微博返回的可见性数字代码。
visible.list_idinteger关联可见性名单的数字 ID。
comment_manage_infoobject此帖返回的评论管理设置。
comment_manage_info.comment_permission_typeinteger评论权限的数字设置。
comment_manage_info.approval_comment_typeinteger评论审核的数字设置。
comment_manage_info.comment_sort_typeinteger评论排序的数字设置。
comment_manage_info.comment_anon_typeinteger匿名评论的数字设置。
forbid_bullet_screensboolean是否标记为禁用弹幕。
转发原帖10 个字段

data.status.retweeted_status

转发时附带的原帖信息,存在时可用。原帖作者信息可能为 null。

字段类型说明
idstring以字符串表示的微博帖子数字 ID。
midstring以字符串表示的微博消息 ID。
bidstring微博帖子的字母数字短 ID。
created_atstring微博发布时的时间,保留微博原始时间格式。
textstring微博返回的帖子正文,可能含 HTML 标记。
textLengthinteger微博返回的帖子文本长度。
sourcestring微博展示的帖子发布来源标签,存在时可用。
isLongTextboolean微博是否将此帖标记为长文。
titleobject此帖附带的标题信息。
title.textstring展示的标题文字。
原帖作者20 个字段

data.status.retweeted_status.user

帖子附带的公开作者信息。

字段类型说明
idinteger微博用户的数字 ID。
screen_namestring微博账号显示名称。
descriptionstring公开个人简介。
profile_image_urlstring用户资料的头像地址。
avatar_hdstring高清头像地址。
profile_urlstring微博返回的个人主页链接。
cover_image_phonestring移动端个人主页封面图片地址。
verifiedboolean微博是否将此账号标记为已认证。
verified_typeinteger微博记录的账号认证数字类型。
verified_type_extinteger补充的账号认证数字分类。
verified_reasonstring账号展示的认证说明。
statuses_countinteger该账号返回的发帖数。
follow_countinteger微博返回的该账号关注数。
followers_countstring以文本返回的粉丝数,可能采用缩写格式。
followers_count_strstring用于展示的粉丝数文本。
followingboolean当前查看账号是否标记为已关注作者。
follow_meboolean作者是否标记为已关注当前查看账号。
genderstring公开资料记录的性别代码。
mbrankinteger微博返回的会员等级。
urankinteger微博返回的账号等级。
原帖附件与视频24 个字段

data.status.retweeted_status

字段类型说明
pic_numinteger此帖返回的图片数量。
pic_idsarray帖子附带的图片 ID 列表,可能为空。
page_infoobject随帖子返回的内容卡片,例如话题或站内视频,存在时可用。
page_info.typestring微博内容卡片的类型标签。
page_info.object_typeinteger微博记录的内容对象数字类型。
page_info.object_idstring内容卡片关联的微博内容对象 ID。
page_info.page_titlestring内容卡片展示的标题。
page_info.titlestring内容卡片返回的标题字段,可能为空字符串。
page_info.content1string内容卡片返回的第一行文字。
page_info.content2string内容卡片返回的第二行文字。
page_info.page_picobject内容卡片的图片信息。
page_info.page_pic.pidstring微博图片 ID。
page_info.page_pic.urlstring内容卡片的图片地址。
page_info.page_pic.widthstring以文本表示的图片宽度,单位为像素。
page_info.page_pic.heightstring以文本表示的图片高度,单位为像素。
page_info.video_orientationstring微博返回的视频画面方向标签。
page_info.play_countstring以展示文本表示的播放量,可能采用缩写格式。
page_info.media_infoobject站内视频的播放元数据,存在时可用。
page_info.media_info.durationnumber播放元数据返回的视频时长。
page_info.media_info.stream_urlstring微博返回的视频流地址。
page_info.media_info.stream_url_hdstring微博返回的高清视频流地址。
page_info.urlsobject按格式区分的可用视频地址。
page_info.urls.mp4_hd_mp4string高清 MP4 地址,存在时可用。
page_info.urls.mp4_ld_mp4string较低清晰度的 MP4 地址,存在时可用。
原帖互动与可见性18 个字段

data.status.retweeted_status

字段类型说明
is_paidboolean微博是否将此帖标记为付费内容。
ad_markedboolean微博是否将此帖标记为广告。
can_editboolean当前响应上下文是否可编辑帖子。
favoritedboolean当前响应上下文是否标记为已收藏此帖。
visibleobject此帖返回的可见性设置。
visible.typeinteger微博返回的可见性数字代码。
visible.list_idinteger关联可见性名单的数字 ID。
visible.list_idstrstring以文本表示的关联可见性名单 ID。
reposts_countinteger微博返回的转发数。
comments_countinteger微博返回的评论数。
attitudes_countinteger微博返回的表态数。
favorites_countinteger微博返回的收藏数。
pending_approval_countinteger待审核评论数。
comment_manage_infoobject此帖返回的评论管理设置。
comment_manage_info.comment_permission_typeinteger评论权限的数字设置。
comment_manage_info.approval_comment_typeinteger评论审核的数字设置。
comment_manage_info.comment_sort_typeinteger评论排序的数字设置。
comment_manage_info.comment_anon_typeinteger匿名评论的数字设置。
响应信息1 个字段

data

微博帖子详情。帖子不可用时,此值可能为 null。

字段类型说明
canonicalstring随帖子返回的规范链接元素,以 HTML 文本表示。

响应示例 ​

正在加载响应示例…