本文へ移動

TikTok ユーザーが公開した投稿 API (V1) ​

GET
APIの健康状態
正常 利用可能 限られた数 ほとんど利用できない データなし
健康状態を読み込んでいます...

TikTokユーザーが投稿した投稿を、secUidで識別して取得します。カーソルでのページングと、最新または人気の順序で表示します。クリエイターの投稿履歴を閲覧したり、公開された投稿フィードを続けて閲覧するために使用します。

パラメータ ​

名前 パラメーターの場所 タイプ 必須 デフォルト 説明
token query string はい - APIアクセス用のセキュリティトークン。
secUid query string はい - TikTokユーザーが返される不透明なセキュリティID。
cursor query string いいえ 0 ページングカーソル。最初のページには'0'を使用し、前の応答で返されたmax_cursor値を使用します。
sort query string いいえ LATEST ユーザーの投稿のソート基準。


利用可能な値:

- LATEST: 最新の投稿から(デフォルト)

- MOST_POPULAR: 最も人気のある投稿から

コードサンプル ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/tiktok/get-user-post/v1?token=YOUR_API_KEY&secUid=VALUE'
text
私はJustOneAPIの"ユーザーが公開した投稿 (V1)" APIを使用したいです。
基本URL: https://api.justoneapi.com.
APIパス: /api/tiktok/get-user-post/v1?token=YOUR_API_KEY&secUid=VALUE
APIエンドポイント: BASE_URL + /api/tiktok/get-user-post/v1?token=YOUR_API_KEY&secUid=VALUE
HTTPメソッド: GET
認証: "token"クエリパラメーターをURLに追加します。
OpenAPI定義: https://docs.justoneapi.com/openapi/tiktok/user-published-posts-v1-ja.json

パラメーター:
- token (query): APIアクセス用のセキュリティトークン。 (必須)
- secUid (query): TikTokユーザーが返される不透明なセキュリティID。 (必須)
- cursor (query): ページングカーソル。最初のページには'0'を使用し、前の応答で返されたmax_cursor値を使用します。
- sort (query): ユーザーの投稿のソート基準。

利用可能な値:
- `LATEST`: 最新の投稿から(デフォルト)
- `MOST_POPULAR`: 最も人気のある投稿から

返信形式:実際の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/tiktok/get-user-post/v1?token=YOUR_API_KEY&secUid=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/tiktok/get-user-post/v1?token=YOUR_API_KEY&secUid=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/tiktok/get-user-post/v1?token=YOUR_API_KEY&secUid=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/tiktok/get-user-post/v1?token=YOUR_API_KEY&secUid=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/tiktok/get-user-post/v1?token=YOUR_API_KEY&secUid=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)。

投稿の概要7 項目

data.aweme_list[]

このページで返される投稿。同じ投稿はLATESTやMOST_POPULARの下にも表示されることがあります。

フィールド タイプ 説明
aweme_id string テキストとして返されるTikTok投稿ID。
desc string 投稿に添付されたキャプションテキスト。
create_time integer 投稿の作成時間、Unixタイムスタンプで秒単位。
desc_language string キャプションに報告される言語ラベル。
aweme_type integer TikTokから報告される数値の投稿タイプ。
is_top integer 投稿に報告される数値のピンフラグ、1は固定された投稿を意味します。
is_ads boolean TikTokが投稿を広告としてマークするかどうか。
著者と共同作業者18 項目

data.aweme_list[]

フィールド タイプ 説明
author_user_id integer 整数として返される著者ID。JavaScriptの安全な整数制限を超える可能性があります。正確なIDについてはauthor.uidのテキストを使用してください。
author object 投稿著者の公開プロフィール概要。
author.uid string TikTokの著者IDをテキスト形式で。このフィールドを使用して、JavaScript内の正確なIDを保持します。
author.nickname string 投稿者のプロフィール表示名。
author.unique_id string 投稿者の公開TikTokユーザー名。
author.follower_count integer 投稿者に報告されたフォロワー数。
author.following_count integer TikTokが報告する、投稿者がフォローしているアカウントの数。
author.aweme_count integer 投稿者のアカウントの投稿数(報告値)。
author.total_favorited integer プロフィールの概要で報告される、投稿者が受け取ったいいね数。
author.custom_verify string 存在する場合、投稿者に返されるプロフィール検証テキスト。
author.enterprise_verify_reason string 存在する場合、投稿者に返されるエンタープライズ検証テキスト。
collab_info object 返される場合の共同作業情報。
collab_info.collaborators array 投稿の共同作業者プロフィールの一覧。
collab_info.collaborators[] object 共同作業者レコードの一つ。
collab_info.collaborators[].user_info object この共同作業者の公開プロフィール概要。
collab_info.collaborators[].user_info.uid string TikTokの共同作業者ID(テキスト形式)。
collab_info.collaborators[].user_info.nickname string 共同作業者の表示名。
collab_info.collaborators[].user_info.unique_id string 共同作業者の公開TikTokユーザー名。
エンゲージメントと利用可能性16 項目

data.aweme_list[]

フィールド タイプ 説明
prevent_download boolean TikTokが投稿のダウンロードを制限されているとマークするかどうか。
statistics object この投稿に報告されたエンゲージメント数。
statistics.aweme_id string この統計オブジェクトに関連する投稿ID。
statistics.play_count integer この投稿の報告された再生回数。
statistics.digg_count integer 投稿の報告されたいいね数。
statistics.comment_count integer この投稿の報告されたコメント数。
statistics.share_count integer 投稿の報告されたシェア数。
statistics.collect_count integer この投稿の報告されたブックマーク数。
statistics.download_count integer この投稿の報告されたダウンロード数。
statistics.repost_count integer この投稿の報告されたTikTok再投稿数。
statistics.whatsapp_share_count integer WhatsAppを通じて共有された回数の報告数。
status object この投稿に関する利用可能性フラグの報告数。
status.aweme_id string これらのステータスフィールドに関連する投稿ID。
status.allow_share boolean 投稿のステータスが共有が許可されていることを示しているかどうか。
status.allow_comment boolean 投稿のステータスがコメントが許可されていることを示しているかどうか。
status.is_delete boolean TikTokがこの投稿を削除済みとしてマークしているかどうか。
ビデオ15 項目

data.aweme_list[]

フィールド タイプ 説明
video object ビデオメタデータ。画像投稿にもこのオブジェクトが含まれることがあります。
video.duration integer ビデオの持続時間(ミリ秒)。画像投稿では、持続時間が0のビデオプレースホルダーが含まれることがあります。
video.width integer ビデオのピクセル単位の幅。
video.height integer ビデオのピクセル単位の高さ。
video.ratio string TikTokが報告するビデオ解像度ラベル。
video.play_addr object 再生アセットメタデータ。
video.play_addr.data_size integer 再生アセットのサイズをバイト数で報告します。
video.bit_rate array 利用可能なビデオレンデーション。この配列は空になることがあります。
video.bit_rate[] object 報告されたビデオレンデーション一つ。
video.bit_rate[].gear_name string TikTokが報告するレンデーションラベル。
video.bit_rate[].quality_type integer レンデーションの数値的な品質コード。
video.bit_rate[].bit_rate integer このレンデーションのビットレート(ビット/秒)。
video.bit_rate[].fps integer このレンデーションのフレームレート(フレーム/秒)。
video.bit_rate[].play_addr object 再生アセットメタデータ。
video.bit_rate[].play_addr.data_size integer 再生アセットのサイズをバイト数で報告します。
画像投稿29 項目

data.aweme_list[]

フィールド タイプ 説明
image_post_info object 返される画像投稿のメタデータ。埋め込まれたimagesギャラリーが画像投稿を識別します。
image_post_info.title string 画像投稿のタイトル。
image_post_info.images array 投稿ギャラリーに含まれる画像。
image_post_info.images[] object ギャラリー内の一枚の画像。
image_post_info.images[].display_image object 表示用レンデーションのサイズ。
image_post_info.images[].display_image.width integer 画像のピクセル単位の幅。
image_post_info.images[].display_image.height integer 画像のピクセル単位の高さ。
image_post_info.images[].thumbnail object サムネイルレンデーションのサイズ。
image_post_info.images[].thumbnail.width integer 画像のピクセル単位の幅。
image_post_info.images[].thumbnail.height integer 画像のピクセル単位の高さ。
image_post_info.images[].owner_watermark_image object クリエイターがウォーターマークを付けたレンデーションのサイズ。
image_post_info.images[].owner_watermark_image.width integer 画像のピクセル単位の幅。
image_post_info.images[].owner_watermark_image.height integer 画像のピクセル単位の高さ。
image_post_info.images[].user_watermark_image object ユーザーがウォーターマークを付けたレンデーションのサイズ。
image_post_info.images[].user_watermark_image.width integer 画像のピクセル単位の幅。
image_post_info.images[].user_watermark_image.height integer 画像のピクセル単位の高さ。
image_post_info.image_post_cover object 画像投稿のカバーとそのレンデーションのサイズ。
image_post_info.image_post_cover.display_image object 表示用レンデーションのサイズ。
image_post_info.image_post_cover.display_image.width integer 画像のピクセル単位の幅。
image_post_info.image_post_cover.display_image.height integer 画像のピクセル単位の高さ。
image_post_info.image_post_cover.thumbnail object サムネイルレンデーションのサイズ。
image_post_info.image_post_cover.thumbnail.width integer 画像のピクセル単位の幅。
image_post_info.image_post_cover.thumbnail.height integer 画像のピクセル単位の高さ。
image_post_info.image_post_cover.owner_watermark_image object クリエイターがウォーターマークを付けたレンデーションのサイズ。
image_post_info.image_post_cover.owner_watermark_image.width integer 画像のピクセル単位の幅。
image_post_info.image_post_cover.owner_watermark_image.height integer 画像のピクセル単位の高さ。
image_post_info.image_post_cover.user_watermark_image object ユーザーがウォーターマークを付けたレンデーションのサイズ。
image_post_info.image_post_cover.user_watermark_image.width integer 画像のピクセル単位の幅。
image_post_info.image_post_cover.user_watermark_image.height integer 画像のピクセル単位の高さ。
音声10 項目

data.aweme_list[]

フィールド タイプ 説明
music object 投稿に含まれる音声のメタデータ。
music.id_str string TikTokの音声IDをテキスト形式で表示。
music.title string 添付音声の名前。
music.author string 音声のアーティストまたはクリエイターのクレジットを表示。
music.album string 音声のアルバムラベルを表示(利用可能な場合)。
music.duration integer TikTokが報告する音声の持続時間値。
music.is_original_sound boolean TikTokが音声をオリジナルオーディオとしてラベル付けするかどうか。
music.is_commerce_music boolean TikTokが報告する音声の商業音楽フラグ。
music_begin_time_in_ms integer 投稿に使用される音声の開始オフセット(ミリ秒)。
music_end_time_in_ms integer 投稿に使用される音声の終了オフセット(ミリ秒)。
ハッシュタグとキャプションのアノテーション14 項目

data.aweme_list[]

フィールド タイプ 説明
cha_list array | null 投稿に関連するハッシュタグとチャレンジ(利用可能な場合)。値はnullの場合もあります。
cha_list[] object 報告されたハッシュタグまたはチャレンジの一つ。
cha_list[].cid string TikTokのハッシュタグまたはチャレンジID。
cha_list[].cha_name string ハッシュタグまたはチャレンジの表示名。
cha_list[].desc string ハッシュタグまたはチャレンジに関する説明。
cha_list[].view_count integer ハッシュタグまたはチャレンジの報告された視聴回数。
cha_list[].use_count integer ハッシュタグまたはチャレンジの報告された使用回数。
text_extra array 投稿のキャプションに付随する注釈。
text_extra[] object キャプションに報告された注釈の一つ。
text_extra[].start integer キャプションに報告された注釈の開始オフセット。観測されたハッシュタグのオフセットはUTF-16コード単位を使用します。
text_extra[].end integer キャプションに報告された注釈の終了オフセット。観測されたハッシュタグのオフセットはUTF-16コード単位を使用します。
text_extra[].type integer TikTokから報告された数値型注釈のタイプ。
text_extra[].hashtag_name string この注釈がハッシュタグを識別する場合のハッシュタグ名。
text_extra[].hashtag_id string この注釈がハッシュタグを識別する場合のハッシュタグID。
ページングとステータス5 項目

data

フィールド タイプ 説明
status_code integer この結果のTikTokステータスコード。外側のcodeはJustOneAPIのビジネスコードです。
status_msg string TikTokから返されるステータスメッセージ。
min_cursor integer TikTokから報告される追加のページ境界カーソル。
max_cursor integer 次のページのカーソル。has_moreが1の場合、この正確な値を小数点以下のテキストとして同じユーザーのcursorに渡し、ソートします。
has_more integer TikTokから報告されるページングフラグ。値1は別のページを意味し、0は終了を意味します。

レスポンス例 ​

レスポンスのサンプルを読み込んでいます...