[object Object]

← back to Tiktok Oauth Catcher

auto-save: 2026-07-21T13:07:37 (1 files) — fire-test-post.sh

aa8eb87fb02738fd93b6e1f8c5f40eacc24751d9 · 2026-07-21 13:07:40 -0700 · Steve Abrams

Files touched

Diff

commit aa8eb87fb02738fd93b6e1f8c5f40eacc24751d9
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Jul 21 13:07:40 2026 -0700

    auto-save: 2026-07-21T13:07:37 (1 files) — fire-test-post.sh
---
 fire-test-post.sh | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/fire-test-post.sh b/fire-test-post.sh
new file mode 100755
index 0000000..b8e03ad
--- /dev/null
+++ b/fire-test-post.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+# Fires ONE real SELF_ONLY (private) TikTok post to @designerwallcoverings via the
+# Content Posting API FILE_UPLOAD flow — the App Review demo material.
+# Steve runs this himself (the outbound publish is a Steve-only gate).
+set -euo pipefail
+
+V="${1:-$HOME/Videos/designerwallcoverings-promo-short-square/renders/video.mp4}"
+AT=$(grep -E '^TIKTOK_ACCESS_TOKEN=' "$HOME/Projects/secrets-manager/.env" | head -1 | cut -d= -f2- | tr -d '"'"'"' \r')
+[ -n "$AT" ] || { echo "No TIKTOK_ACCESS_TOKEN in secrets .env"; exit 1; }
+SIZE=$(stat -f%z "$V" 2>/dev/null || wc -c < "$V")
+echo "video: $V  ($SIZE bytes)"
+
+echo "== 1) init =="
+INIT=$(curl -s -X POST "https://open.tiktokapis.com/v2/post/publish/video/init/" \
+  -H "Authorization: Bearer $AT" -H "Content-Type: application/json; charset=UTF-8" \
+  -d "{\"post_info\":{\"title\":\"Designer Wallcoverings — sandbox test\",\"privacy_level\":\"SELF_ONLY\",\"disable_comment\":true,\"disable_duet\":true,\"disable_stitch\":true},\"source_info\":{\"source\":\"FILE_UPLOAD\",\"video_size\":$SIZE,\"chunk_size\":$SIZE,\"total_chunk_count\":1}}")
+echo "$INIT"
+UURL=$(python3 -c "import json,sys;print((json.loads('''$INIT''').get('data') or {}).get('upload_url',''))")
+PID=$(python3 -c "import json,sys;print((json.loads('''$INIT''').get('data') or {}).get('publish_id',''))")
+[ -n "$UURL" ] || { echo "no upload_url — stop"; exit 1; }
+echo "publish_id: $PID"
+
+echo "== 2) upload bytes =="
+curl -s -X PUT "$UURL" \
+  -H "Content-Type: video/mp4" \
+  -H "Content-Range: bytes 0-$((SIZE-1))/$SIZE" \
+  --data-binary "@$V" -o /dev/null -w "  upload HTTP %{http_code}\n"
+
+echo "== 3) poll status (up to ~60s) =="
+for i in $(seq 1 12); do
+  sleep 5
+  ST=$(curl -s -X POST "https://open.tiktokapis.com/v2/post/publish/status/fetch/" \
+    -H "Authorization: Bearer $AT" -H "Content-Type: application/json; charset=UTF-8" \
+    -d "{\"publish_id\":\"$PID\"}")
+  S=$(python3 -c "import json;print((json.loads('''$ST''').get('data') or {}).get('status',''))")
+  echo "  [$i] status: $S"
+  case "$S" in
+    PUBLISH_COMPLETE) echo "✅ POSTED (SELF_ONLY / private) to @designerwallcoverings"; break;;
+    FAILED) echo "❌ failed: $ST"; break;;
+  esac
+done

← d107334 auto-save: 2026-07-20T16:33:10 (2 files) — catcher.py catche  ·  back to Tiktok Oauth Catcher  ·  (newest)