Weibo 投稿詳細 API (V1)
APIの健康状態
正常 利用可能 限られた数 ほとんど利用できない データなし
健康状態を読み込んでいます...
Weibo投稿の投稿IDによって識別された投稿の詳細を取得します。内容のレビュー、アーカイブ、または関連するエンゲージメント分析のために、既知の投稿を検索するために使用します。
パラメータ
| 名前 | パラメーターの場所 | タイプ | 必須 | デフォルト | 説明 |
|---|---|---|---|---|---|
token |
query | string |
はい | - | APIアクセストークン。 |
id |
query | string |
はい | - | Weiboの投稿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)" APIを使用したいです。
基本URL: https://api.justoneapi.com.
APIパス: /api/weibo/get-weibo-detail/v1?token=YOUR_API_KEY&id=VALUE
APIエンドポイント: BASE_URL + /api/weibo/get-weibo-detail/v1?token=YOUR_API_KEY&id=VALUE
HTTPメソッド: GET
認証: "token"クエリパラメーターをURLに追加します。
OpenAPI定義: https://docs.justoneapi.com/openapi/weibo/post-details-v1-ja.json
パラメーター:
- token (query): APIアクセストークン。 (必須)
- id (query): Weiboの投稿ID。 (必須)
返信形式:実際のContent-Typeに応じて、JSONまたはテキストを安全に処理する。
レスポンスの処理とエラーコード:
1. API の処理結果はレスポンス本文の「code」フィールドで判定します。code が 0 なら成功です。
2. 推奨タイムアウト:リクエストのタイムアウトは 120 秒に設定してください。120 秒が長すぎる場合でも、最低 60 秒を確保してください。一部のリクエストは、結果を受け取る前にタイムアウトすることがあります。
3. 処理結果コード:
- 0: 成功
- 100: 無効または停止中のトークン
- 301: データの取得に失敗しました。再試行してください。
- 302: 呼び出し頻度の上限を超えました
- 303: 日次の利用上限を超えました
- 400: パラメーターが無効です
- 500: サーバー内部エラー
- 600: アクセス権限がありません
- 601: 残高不足
- 602: トークンの予算上限に達しました
4. コード 601 はアカウントの共有残高不足を示します。コード 602 は使用中の API トークン固有の累積予算上限に達したことを示します。トークンに予算上限を設定しても、共有残高から資金が移動することはありません。
お手伝いください。私が好むプログラミング言語でこのAPIを呼び出し、レスポンスを処理するスクリプトを作成してください。
python
import requests
BASE_URL = "https://api.justoneapi.com" # オープンAPIサーバーによって提供される
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"; // オープンAPIサーバーによって提供される
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"; // オープンAPIサーバーによって提供される
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" // オープンAPIサーバーによって提供される
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'; // オープンAPIサーバーによって提供される
$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
要求されたWeibo投稿。
| フィールド | タイプ | 説明 |
|---|---|---|
id |
string |
Weibo投稿の数値識別子、文字列形式で表される。 |
mid |
string |
WeiboメッセージID、文字列形式で表される。 |
bid |
string |
Weibo投稿の短いアルファベット数文字識別子。 |
created_at |
string |
元のWeibo投稿の公開時間、Weiboのタイムスタンプ形式で。 |
text |
string |
Weiboによって返される投稿本文。HTMLマークアップを含むことがある。 |
raw_text |
string |
微博が別途提供するプレーンテキストの投稿本文。 |
textLength |
integer |
Weiboによって報告される投稿テキストの長さ。 |
source |
string |
投稿が利用可能な場合、ソースラベルが表示されます。 |
status_title |
string |
投稿に表示されるタイトルテキスト。 |
isLongText |
boolean |
Weiboがこの投稿を長文テキストとしてマークしているかどうか。 |
region_name |
string |
投稿に表示される地域ラベル。 |
エンゲージメント10 項目
data.status
| フィールド | タイプ | 説明 |
|---|---|---|
reposts_count |
integer |
Weiboによる再投稿数の報告値。 |
comments_count |
integer |
Weiboによるコメント数の報告値。 |
attitudes_count |
integer |
Weiboによる反応数の報告値。 |
favorites_count |
integer |
Weiboによるお気に入り数の報告値。 |
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 |
WeiboユーザーIDの数値。 |
screen_name |
string |
表示されるWeiboアカウント名。 |
description |
string |
公開プロフィール説明。 |
profile_image_url |
string |
プロフィールアバターのURL。 |
avatar_hd |
string |
高解像度アバターURL。 |
profile_url |
string |
Weiboから返されるプロフィールリンク。 |
cover_image_phone |
string |
モバイルビュー用のプロフィールカバー画像URL。 |
verified |
boolean |
Weiboがアカウントを認証済みとしてマークしているかどうか。 |
verified_type |
integer |
Weiboが記録するアカウント認証タイプの数値。 |
verified_type_ext |
integer |
追加のアカウント認証分類の数値。 |
verified_reason |
string |
アカウントに表示される認証説明。 |
statuses_count |
integer |
アカウントの投稿数。 |
follow_count |
integer |
Weiboが報告するこのアカウントがフォローするアカウント数。 |
followers_count |
string |
フォロワー数がテキスト形式で返される。省略された表示形式を使用する場合があります。 |
followers_count_str |
string |
表示用のフォロワー数テキストが提供されます。 |
following |
boolean |
視聴アカウントがこの作者をフォローしているかどうか。 |
follow_me |
boolean |
著者が該当の視聴アカウントにマークされているかどうか。 |
gender |
string |
公開プロフィールに記録された性別コード。 |
mbrank |
integer |
Weiboによる会員ランクの報告値。 |
urank |
integer |
Weiboによるアカウントランクの報告値。 |
画像30 項目
data.status
| フィールド | タイプ | 説明 |
|---|---|---|
pic_num |
integer |
投稿に関する画像数の報告値。 |
pic_ids |
array |
投稿に添付された画像のID。リストは空である可能性あり。 |
pic_ids[] |
string |
微博の画像ID。 |
thumbnail_pic |
string |
提供された時のサムネイルサイズの最初の画像のURL。 |
bmiddle_pic |
string |
最初の画像のURL、サイズは中サイズで提供される場合。 |
original_pic |
string |
Weiboの元の画像フィールドに含まれるURL、提供される場合。 |
pics |
array |
Weiboが添付画像を含む場合の詳細。 |
pics[] |
object |
投稿に添付された画像。 |
pics[].pid |
string |
微博の画像ID。 |
pics[].size |
string |
この画像表示のサイズラベル。 |
pics[].url |
string |
この画像表示のURL。 |
pics[].geo |
object |
画像のサイズとトリミングの指示。 |
pics[].geo.width |
integer |
画像のピクセル単位の幅。 |
pics[].geo.height |
integer |
画像のピクセル単位の高さ。 |
pics[].geo.croped |
boolean |
Weiboがこの画像をトリミングされたとマークするかどうか。 |
pics[].large |
object |
提供される場合のより大きな画像表示。 |
pics[].large.url |
string |
より大きな画像表示のURL。 |
pics[].large.size |
string |
この画像表示のサイズラベル。 |
pics[].large.geo |
object |
画像のサイズとトリミングの指示。 |
pics[].large.geo.width |
string |
画像のピクセル単位の幅、テキストで表示。 |
pics[].large.geo.height |
string |
画像のピクセル単位の高さ、テキストで表示。 |
pics[].large.geo.croped |
boolean |
Weiboがこの画像をトリミングされたとマークするかどうか。 |
pic_focus_point |
array |
提供される場合の画像の焦点領域の情報。 |
pic_focus_point[] |
object |
一つの画像に関連する焦点領域。 |
pic_focus_point[].pic_id |
string |
微博の画像ID。 |
pic_focus_point[].focus_point |
object |
Weiboが提供する焦点領域の座標とサイズ。 |
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 |
Weiboカードのタイプラベル。 |
object_type |
integer |
Weiboによって記録された数値コンテンツオブジェクトのタイプ。 |
object_id |
string |
カードに関連するWeiboコンテンツオブジェクトID。 |
page_title |
string |
コンテンツカードに表示されるタイトル。 |
title |
string |
コンテンツカードと共に返されるタイトルフィールド。空である可能性あり。 |
content1 |
string |
コンテンツカードに返される最初のテキスト行。 |
content2 |
string |
コンテンツカードに返された二行目のテキスト。 |
page_pic |
object |
コンテンツカードの画像情報。 |
page_pic.pid |
string |
微博の画像ID。 |
page_pic.url |
string |
コンテンツカードの画像のURL。 |
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 |
微博によって返されるビデオストリームのURL。 |
media_info.stream_url_hd |
string |
微博によって返される高解像度ビデオストリームのURL。 |
urls |
object |
形式別にキー付けされた利用可能なビデオURL。 |
urls.mp4_hd_mp4 |
string |
提供された時の低解像度MP4 URL。 |
urls.mp4_ld_mp4 |
string |
提供された時の高解像度MP4 URL。 |
可視性とコメント13 項目
data.status
| フィールド | タイプ | 説明 |
|---|---|---|
is_paid |
boolean |
Weiboがこの投稿を有料コンテンツとしてマークしているかどうか。 |
ad_marked |
boolean |
Weiboがこの投稿を広告としてマークしているかどうか。 |
can_edit |
boolean |
レスポンスコンテキストで編集が可能かどうか。 |
favorited |
boolean |
レスポンスコンテキストでこの投稿がお気に入りとしてマークされているかどうか。 |
visible |
object |
この投稿で返される可視性設定。 |
visible.type |
integer |
Weiboから報告される数値の可視性コード。 |
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 |
Weibo投稿の数値識別子、文字列形式で表される。 |
mid |
string |
WeiboメッセージID、文字列形式で表される。 |
bid |
string |
Weibo投稿の短いアルファベット数文字識別子。 |
created_at |
string |
元のWeibo投稿の公開時間、Weiboのタイムスタンプ形式で。 |
text |
string |
Weiboによって返される投稿本文。HTMLマークアップを含むことがある。 |
textLength |
integer |
Weiboによって報告される投稿テキストの長さ。 |
source |
string |
投稿が利用可能な場合、ソースラベルが表示されます。 |
isLongText |
boolean |
Weiboがこの投稿を長文テキストとしてマークしているかどうか。 |
title |
object |
この投稿に付属されているタイトル情報。 |
title.text |
string |
表示されるタイトルテキスト。 |
元の著者20 項目
data.status.retweeted_status.user
投稿に添付されている公開作者情報。
| フィールド | タイプ | 説明 |
|---|---|---|
id |
integer |
WeiboユーザーIDの数値。 |
screen_name |
string |
表示されるWeiboアカウント名。 |
description |
string |
公開プロフィール説明。 |
profile_image_url |
string |
プロフィールアバターのURL。 |
avatar_hd |
string |
高解像度アバターURL。 |
profile_url |
string |
Weiboから返されるプロフィールリンク。 |
cover_image_phone |
string |
モバイルビュー用のプロフィールカバー画像URL。 |
verified |
boolean |
Weiboがアカウントを認証済みとしてマークしているかどうか。 |
verified_type |
integer |
Weiboが記録するアカウント認証タイプの数値。 |
verified_type_ext |
integer |
追加のアカウント認証分類の数値。 |
verified_reason |
string |
アカウントに表示される認証説明。 |
statuses_count |
integer |
アカウントの投稿数。 |
follow_count |
integer |
Weiboが報告するこのアカウントがフォローするアカウント数。 |
followers_count |
string |
フォロワー数がテキスト形式で返される。省略された表示形式を使用する場合があります。 |
followers_count_str |
string |
表示用のフォロワー数テキストが提供されます。 |
following |
boolean |
視聴アカウントがこの作者をフォローしているかどうか。 |
follow_me |
boolean |
著者が該当の視聴アカウントにマークされているかどうか。 |
gender |
string |
公開プロフィールに記録された性別コード。 |
mbrank |
integer |
Weiboによる会員ランクの報告値。 |
urank |
integer |
Weiboによるアカウントランクの報告値。 |
元の添付ファイルと動画24 項目
data.status.retweeted_status
| フィールド | タイプ | 説明 |
|---|---|---|
pic_num |
integer |
投稿に関する画像数の報告値。 |
pic_ids |
array |
投稿に添付された画像のID。リストは空である可能性あり。 |
page_info |
object |
提供されたトピックやネイティブビデオなどの添付コンテンツカード。 |
page_info.type |
string |
Weiboカードのタイプラベル。 |
page_info.object_type |
integer |
Weiboによって記録された数値コンテンツオブジェクトのタイプ。 |
page_info.object_id |
string |
カードに関連するWeiboコンテンツオブジェクト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 |
コンテンツカードの画像のURL。 |
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 |
微博によって返されるビデオストリームのURL。 |
page_info.media_info.stream_url_hd |
string |
微博によって返される高解像度ビデオストリームのURL。 |
page_info.urls |
object |
形式別にキー付けされた利用可能なビデオURL。 |
page_info.urls.mp4_hd_mp4 |
string |
提供された時の低解像度MP4 URL。 |
page_info.urls.mp4_ld_mp4 |
string |
提供された時の高解像度MP4 URL。 |
元のエンゲージメントと可視性18 項目
data.status.retweeted_status
| フィールド | タイプ | 説明 |
|---|---|---|
is_paid |
boolean |
Weiboがこの投稿を有料コンテンツとしてマークしているかどうか。 |
ad_marked |
boolean |
Weiboがこの投稿を広告としてマークしているかどうか。 |
can_edit |
boolean |
レスポンスコンテキストで編集が可能かどうか。 |
favorited |
boolean |
レスポンスコンテキストでこの投稿がお気に入りとしてマークされているかどうか。 |
visible |
object |
この投稿で返される可視性設定。 |
visible.type |
integer |
Weiboから報告される数値の可視性コード。 |
visible.list_id |
integer |
関連する可視性リストの数値ID。 |
visible.list_idstr |
string |
関連する可視性リストのID、テキスト形式で表示される。 |
reposts_count |
integer |
Weiboによる再投稿数の報告値。 |
comments_count |
integer |
Weiboによるコメント数の報告値。 |
attitudes_count |
integer |
Weiboによる反応数の報告値。 |
favorites_count |
integer |
Weiboによるお気に入り数の報告値。 |
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
Weibo投稿の詳細。投稿が利用できない場合、この値はnullである。
| フィールド | タイプ | 説明 |
|---|---|---|
canonical |
string |
投稿の正規リンク要素、HTMLテキスト形式で返される。 |
レスポンス例
レスポンスのサンプルを読み込んでいます...