---
name: shortsblink-tiktok
description: Count TikTok account views, download Pinterest board images or a permitted TikTok video or ordered slideshow, remake its structure with Codex, Replicate or Google AI Studio, and copy or schedule posts through ShortsBlink MCP.
---

# ShortsBlink TikTok

## Count views for a TikTok account

Set `HANDLE` to the public TikTok username without the @ sign. Use `yt-dlp` and `jq` to read view counts for up to 50 posts. Retain the snapshot in the project if the user wants to compare readings later.

```sh
HANDLE='example'
yt-dlp --ignore-config --flat-playlist --skip-download --playlist-end 50 \
  --socket-timeout 10 --retries 0 --extractor-retries 0 --dump-single-json \
  -- "https://www.tiktok.com/@$HANDLE" > profile.json &&
jq --arg handle "$HANDLE" '
  [.entries[]? | objects | select(.id | strings | test("^[0-9]{15,25}$"))
   | {id, title, views: (.view_count | if type == "number" and . >= 0 then . else null end)}]
  | group_by(.id) | map((map(select(.views != null)) | first) // first) as $posts
  | [$posts[] | .views | numbers | select(. >= 0)] as $counts
  | {handle: $handle, checked_utc: (now | todateiso8601),
     sampled_posts: ($posts | length), measured_posts: ($counts | length),
     missing_counts: (($posts | length) - ($counts | length)),
     observed_views: ($counts | add), posts: $posts}
' profile.json
```

Report the handle, UTC time, and coverage alongside the total, for example “12,400 views across 16 of 18 sampled posts.” A measured zero counts. A missing value stays unknown. When all counts are missing, report the total as unavailable. This sum covers the posts returned in this snapshot. For a missing individual count, try a metadata-only read of its public post link with `yt-dlp --ignore-config --skip-download --no-playlist --print '%(id)s %(view_count)s' -- "$POST_URL"`. Match the post ID before recording the value. If TikTok limits the read, retain the last timestamped measurement.

**Creator-authorized video history.** When the user already has a TikTok OAuth connection with the `video.list` scope, send its TikTok user access token only to `open.tiktokapis.com`. Request `POST /v2/video/list/?fields=id,create_time,share_url,view_count` with a JSON body of `{"max_count":20}`. While `data.has_more` is true, pass the returned `data.cursor` in the next body. Check `error.code == "ok"` on every page, deduplicate by public ID and label the result partial if pagination ends with an error. To refresh counts for specific published videos, use `POST /v2/video/query/?fields=id,create_time,view_count` with `{"filters":{"video_ids":["PUBLIC_VIDEO_ID"]}}` (up to 20 IDs). A ShortsBlink license key authenticates only to ShortsBlink. Public counters require a published post ID. [TikTok list API](https://developers.tiktok.com/docs/en/tiktok-api-v2-video-list) · [TikTok query API](https://developers.tiktok.com/docs/en/tiktok-api-v2-video-query)

## Download a TikTok video

Use this for a public video the creator allows you to save. Copy the post’s HTTPS share link and set `VIDEO_URL` to it. In an empty working directory, use the CalAI Telegram bot’s single-video workflow with `yt-dlp`, FFmpeg and ffprobe installed.

```sh
yt-dlp --ignore-config --no-playlist --socket-timeout 30 --retries 2 \
  --max-filesize 300M -S 'res:1080,fps,br' -f 'bv*+ba/b' \
  --merge-output-format mp4 --remux-video mp4 \
  -o 'source.%(ext)s' -- "$VIDEO_URL" &&
ffprobe -v error -select_streams v:0 -show_entries stream=width,height:format=duration \
  -of json source.mp4
```

Accept a nonempty `source.mp4` with a video stream, positive dimensions and a playable duration. The bot checks the final file against 300 MB, and the ShortsBlink uploader accepts videos up to 256 MiB. If the reference is larger, keep the original and export a smaller delivery copy. If saving is disabled, ask for the creator’s original. [yt-dlp options](https://github.com/yt-dlp/yt-dlp#usage-and-options) · [TikTok download controls](https://support.tiktok.com/en/using-tiktok/exploring-videos/video-downloads)

## Download a TikTok photo slideshow in post order

Save the Bash block below as `save-slides.sh`. Give it the canonical HTTPS photo-post URL for a carousel you can download. It writes numbered image files and an ordered `slides.json` manifest to `reference-POST_ID/` in the current directory.

```sh
bash save-slides.sh 'https://www.tiktok.com/@HANDLE/photo/POST_ID'
```

The default path reads TikTok’s native `imagePost.images` array using the extractor used by the slideshow app. Each array entry is one slide. The URLs in its `imageURL.urlList` are alternate renditions of that slide. Use Bash, `curl`, `jq`, `file` and FFmpeg, plus a Python environment with `yt-dlp` installed for the native reader. Set `PYTHON` to that environment’s interpreter if needed. The native parser hook was tested with `yt-dlp==2026.8.19`.

For an API-only lookup, run `bash save-slides.sh 'https://www.tiktok.com/@HANDLE/photo/POST_ID' --tikwm`. This sends the public post URL to TikWM and reads its ordered `data.images` response. Both routes check the post ID and creator before saving images. [TikWM](https://www.tikwm.com/)

```bash
#!/usr/bin/env bash
set -euo pipefail
umask 077
post_url=${1:?Supply a canonical TikTok photo-post URL}
[[ "$post_url" =~ ^https://(www\.)?tiktok\.com/@([A-Za-z0-9_.-]+)/photo/([0-9]{10,24})/?$ ]] ||
  { echo 'Expected https://www.tiktok.com/@HANDLE/photo/POST_ID' >&2; exit 1; }
handle=${BASH_REMATCH[2]} post_id=${BASH_REMATCH[3]}
post_url="https://www.tiktok.com/@$handle/photo/$post_id"
dest="reference-$post_id"
[[ ! -e "$dest" ]] || { echo "$dest already exists" >&2; exit 1; }
stage=$(mktemp -d "./.slides-${post_id}.XXXXXXXX")
trap 'rm -rf "$stage"' EXIT

case "${2:-native}" in
  native)
    "${PYTHON:-python3}" - "$handle" "$post_id" > "$stage/urls.json" <<'PY'
import json, sys
from urllib.parse import urlsplit
from yt_dlp import YoutubeDL
from yt_dlp.extractor.tiktok import TikTokIE

handle, post_id = sys.argv[1:]
class PhotoReader(TikTokIE):
    def _parse_aweme_video_web(self, item, *args, **kwargs):
        if str(item.get("id")) != post_id or item["author"]["uniqueId"].casefold() != handle.casefold():
            raise ValueError("Post identity mismatch")
        slides = item["imagePost"]["images"]
        return {"slides": [[u for u in slide["imageURL"]["urlList"]
                            if isinstance(u, str) and urlsplit(u).scheme == "https"]
                           for slide in slides]}

options = {"quiet": True, "no_warnings": True, "skip_download": True,
           "socket_timeout": 15, "retries": 0, "noplaylist": True,
           "http_headers": {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
                            "Referer": "https://www.tiktok.com/", "Origin": "https://www.tiktok.com"}}
try:
    with YoutubeDL(options) as ydl:
        item = PhotoReader(ydl).extract(f"https://www.tiktok.com/@{handle}/video/{post_id}")
    print(json.dumps(item["slides"]))
except Exception:
    sys.exit("Native public photo metadata unavailable.")
PY
    ;;
  --tikwm)
    curl -fsS --max-time 30 --get 'https://www.tikwm.com/api/' \
      --data-urlencode "url=$post_url" -o "$stage/metadata.json"
    jq -e --arg id "$post_id" --arg handle "$handle" '
      select(.code == 0 and (.data.id | tostring) == $id and
        (.data.author.unique_id | ascii_downcase) == ($handle | ascii_downcase))
      | .data.images | map([.])
    ' "$stage/metadata.json" > "$stage/urls.json"
    ;;
  *) echo 'Expected native or --tikwm' >&2; exit 1 ;;
esac

jq -e 'type == "array" and (length > 0) and
  all(.[]; type == "array" and length > 0 and
    all(.[]; type == "string" and startswith("https://")))' "$stage/urls.json" >/dev/null
count=$(jq length "$stage/urls.json")
mkdir "$stage/images"
for ((i=0; i<count; i++)); do
  saved=''
  while IFS= read -r url; do
    if ! curl -fsSL --proto '=https' --proto-redir '=https' --max-time 45 \
      -e 'https://www.tiktok.com/' -o "$stage/slide.part" "$url"; then continue; fi
    case "$(file -b --mime-type "$stage/slide.part")" in
      image/jpeg) ext=jpg ;; image/png) ext=png ;; image/webp) ext=webp ;;
      image/avif) ext=avif ;; image/heic) ext=heic ;; *) continue ;;
    esac
    if ! ffmpeg -nostdin -v error -xerror -i "$stage/slide.part" -frames:v 1 -f null -; then continue; fi
    printf -v saved '%02d.%s' "$((i+1))" "$ext"
    mv "$stage/slide.part" "$stage/images/$saved"
    printf '%s\n' "$saved" >> "$stage/order.txt"
    break
  done < <(jq -r --argjson i "$i" '.[$i][]' "$stage/urls.json")
  [[ -n "$saved" ]] || { echo "Could not retrieve slide $((i+1)) of $count" >&2; exit 1; }
done
jq -n --arg source "$post_url" --rawfile names "$stage/order.txt" \
  '{source: $source, slides: ($names | split("\n") | map(select(length > 0)))}' > "$stage/slides.json"
mkdir "$dest"
mv "$stage"/images/* "$dest/"
mv "$stage/slides.json" "$dest/"
printf 'Saved %s slides to %s\n' "$count" "$dest"
```

Use `slides.json` as the completion marker and read its filenames in order when preparing a copy or remake. Keep the canonical post URL alongside the files. The temporary image URLs expire.

## Copy a saved slideshow or make a similar one

For an exact copy of a post in the user’s own ShortsBlink calendar, use `get_calendar` to identify its schedule ID, then the `copy_post` instructions below. To preserve an external deck the user owns or can reuse, keep the verified images in post order. Upload those files in manifest order when scheduling is requested.

For a remake, build a slide-by-slide brief. Note the job of each frame (hook, demonstration, payoff, call to action), its framing and where the text sits. Write new captions and generate clean photos. Keep editable text in its own layer and render the final images from those layers. Imported pixels can contain baked-in text. Replace that background before adding new words in the same area. Compare an ordered contact sheet and the actual portrait export with the brief before handing it off.


Choose the generator the user requested. Work with references they can use. Write one row per slide in `slides.json`, in display order. Include the reference filename, a new scene, the new caption and the desired final filename. Keep generated images in `art/` and finished slides in `final/`.

Example for a three-photo hiking post: start with a wide sunrise at a trailhead, move in to a close-up of a folded map, then reveal the valley from above. Keep one palette and light direction across all three. Set a 9:16 target and leave room for the caption.

Use a prompt like this for slide two:

> Create a portrait editorial photo of two hands unfolding a worn trail map on a granite ledge. Use the first slide as a reference for its cool dawn light and restrained greens. Frame the hands low and leave the upper third quiet for the caption. Make a fresh scene with no lettering.

- **Codex image generation.** In a Codex session with image generation enabled, attach the reference and ask it to generate the cover using its image tool. Save the chosen image as `art/01.png`. For each subsequent slide, supply the chosen cover as the visual reference and that slide’s individual prompt. Save one distinct image per row. Ask for a targeted edit if just one detail is wrong. [OpenAI image generation](https://developers.openai.com/api/docs/guides/image-generation)
- **Replicate.** In the FLUX.1 Kontext [pro] playground, drop the approved reference in `input_image`, enter the scene in `prompt`, select a portrait aspect ratio and run one slide. Download the output and inspect it. To script the same run, open the model’s API example, authenticate with `REPLICATE_API_TOKEN`, and pass a local file buffer and the row’s prompt to `replicate.run("black-forest-labs/flux-kontext-pro", { input })`. Save the returned file before advancing to the next row. [Replicate model and API example](https://replicate.com/black-forest-labs/flux-kontext-pro)
- **Google AI Studio.** Open AI Studio and select an image-generation model such as one from the Nano Banana family. Attach the reference, enter the cover prompt, choose portrait framing and generate. Download the chosen cover. For the following slides, attach that cover and ask for one new scene at a time. For a batch script, use AI Studio’s **Get code** example for the selected model. Supply the reference image and text prompt together and write the returned image part to the row’s output file. [Google AI Studio](https://aistudio.google.com/) · [Gemini image generation examples](https://ai.google.dev/gemini-api/docs/image-generation)
### Download a Pinterest board or section

Use the full public board URL (`https://www.pinterest.com/ACCOUNT/BOARD/`) or a single section URL (`…/ACCOUNT/BOARD/SECTION/`). The ShortsBlink Bash script uses `gallery-dl` to page through the collection, including a board’s sections. It downloads photo assets in the order returned. Use Bash, gallery-dl, jq, OpenSSL and the file utility. On macOS with Homebrew, install the two additional tools with `brew install gallery-dl jq`.

Replace `BOARD_OR_SECTION_URL` with the collection link and choose a new output directory. Run from the project working directory.

```sh
curl -fsSLO https://shortsblink.com/static/lifetime/shortsblink-tiktok/pinterest-board.sh &&
bash pinterest-board.sh 'BOARD_OR_SECTION_URL' ./pinterest-images
```

Read `pinterest-images/slides.json` after a successful run. Its `slides` array lists the numbered images in order. Look up each filename in `pins` for the Pin URL, image URL and any publisher link or credit Pinterest supplied. If a board and a section return identical images, their Pin records point to the same numbered file. Use that source when deciding which images to include in the final slideshow. For a different slide order, reorder the filenames in `slides`. On a failed or empty download, report the error and use a fresh destination for the retry. [Downloader source](https://shortsblink.com/static/lifetime/shortsblink-tiktok/pinterest-board.sh) · [Supported Pinterest collections](https://gdl-org.github.io/docs/supportedsites.html#pinterest)

### Examples from the app

Open the [interactive gallery](https://shortsblink.com/lifetime#workflow) to review the nine original ImageGen slides. The following counts belong to the linked TikTok sources, as read through TikWM on November 25, 2026 UTC.

| Source photo post | Observed views | Format to study | New three-slide example |
| --- | ---: | --- | --- |
| [@akhirapoetry](https://www.tiktok.com/@akhirapoetry/photo/7456773985552862486) | 8,192,896 | A monochrome book cover followed by a page reveal | *A page for later* moves from a closed notebook to a blank spread and a folded note. Add one original line per frame. |
| [@healthyyinspoo](https://www.tiktok.com/@healthyyinspoo/photo/7531620626293935373) | 7,627,584 | White recipe cards with short headlines and ingredient photos | *The plum bowl* uses pale backgrounds, a plum close-up and a yogurt bowl to teach one snack. |
| [@travelnova.app](https://www.tiktok.com/@travelnova.app/photo/7700427457249283349) | 1,399,836 | A scenic cover followed by a labeled route | *Lisbon in three stops* goes from a yellow tram to blue tiles and finishes above the Tagus. |

To apply a format to another subject, describe the framing and reveal in one sentence, choose new subjects and captions, and generate a distinct photo for each frame. Record any refreshed source count with its own timestamp.

## Write a reusable preparation script

Ask the agent to write a small script in the project’s existing language. Give it the ordered manifest and an explicit input/output contract. For example:

> Write a Node script that reads slides.json in array order. For each row, read its approved art, crop to 1080×1920, overlay its caption with the same margins and font, and export the named JPEG to final/. Use Sharp or the project’s existing renderer. Make a contact sheet in the same order. Fail on missing files, duplicate output names or captions that overflow. Keep the originals.

For a generation script, separate generation from rendering. Implement just the selected provider. Read credentials from the environment, save each successful image immediately, record its row and prompt, and resume from the first missing image. With built-in Codex image generation, let the agent generate the art and run the local script for layout. Inspect the contact sheet and each final slide at the intended display size for consistent crops, accurate text and correct order. Deliver drafts here when the request ends at creation.

## Connect to the hosted MCP

Sign in to the ShortsBlink account that owns the license and open **Agent access**. Stripe issues a key when payment is confirmed. Both setup options use the same key shown there. If a key was previously stored only as a hash, the owner can replace it once to enable the workspace previews. Replacement revokes the old key. [Agent access](https://shortsblink.com/lifetime/workspace#agent-access)

- **Option 1.** Copy the terminal command from Agent setup or Agent access. It includes the license key and opens the chosen client with `SHORTSBLINK_LICENSE_KEY` set. Paste the separate setup message into that agent. Use the environment variable for MCP authentication and keep its value out of chat.
- **Option 2.** Open Codex or Claude Code and paste the all-in-one message. It includes the key, skill URL and hosted MCP URL. Configure its bearer header in the client’s private user settings. The conversation will contain the key.

Install the skill at `~/.agents/skills/shortsblink-tiktok/SKILL.md` for Codex or `~/.claude/skills/shortsblink-tiktok/SKILL.md` for Claude Code. Configure only the user-scoped `shortsblink` entry. For the all-in-one message, set `http_headers.Authorization` in Codex or the HTTP server’s `Authorization` header in Claude Code to `Bearer` followed by a space and the supplied key. Clear any conflicting authentication setting on that entry. Keep the key out of project files and replies.

For manual terminal setup or a standalone script, run the following line in Bash or Zsh. Paste the key at the hidden prompt and press Enter.

```sh
printf 'ShortsBlink key: '; IFS= read -rs SHORTSBLINK_LICENSE_KEY && export SHORTSBLINK_LICENSE_KEY; printf '\n'
```

Register the hosted server once for your client:

```sh
# Codex
codex mcp add shortsblink --url https://shortsblink.com/lifetime/mcp --bearer-token-env-var SHORTSBLINK_LICENSE_KEY

# Claude Code
claude mcp add --transport http --scope user shortsblink https://shortsblink.com/lifetime/mcp --header 'Authorization: Bearer ${SHORTSBLINK_LICENSE_KEY}'
```

For a previous local connector named `shortsblink`, remove its registration first with `codex mcp remove shortsblink` or `claude mcp remove --scope user shortsblink`, then run the corresponding add command. The key remains tied to the same lifetime license. Open your agent from the terminal with the exported key. For later sessions, set the variable again or load it through your secret manager. Test the connection by asking “List my connected TikTok accounts.” If `list_accounts` returns an empty list, show its `connect_url` to the user and ask them to connect a TikTok account before scheduling. Retest `list_accounts` after they connect. [Connect TikTok](https://shortsblink.com/lifetime/calendar#connect-tiktok) For HTTP 401, load the current key again and restart the client. [License workspace](https://shortsblink.com/lifetime/workspace)

## Browse examples by niche

Use the [TikTok reference library](https://shortsblink.com/lifetime/library) to filter popular videos and slideshows by niche or text. Each entry has the creator’s caption, an observed view count, and the first photo or the first frame. Open the original to study the full sequence.

## Example requests

- “Remake this slideshow for my company with our own photos and copy.” Study the hook, framing and slide sequence. Draft original images and text for the company and audience.
- “Schedule this slideshow for @myaccount Friday at 10 a.m. Europe/Chisinau.” Match the handle with `list_accounts`, check the date and timezone, then verify the scheduled entry in `get_calendar`.
- “Show my connected TikTok accounts.” Call `list_accounts` and show its connection link if the list is empty.
- “Create seven variations and schedule one per day for the next week.” Confirm the account, start date, time and time zone, and make a distinct deck for each day. Queue each with its own request ID and read back the week across each applicable UTC month.
- “Research what slideshows and short videos might work for my account.” Sample recent public posts from the account and relevant creators. Compare hooks, slide counts or video lengths and available view counts. Include source links and suggest three formats to test.

## Upload and schedule

ShortsBlink removes the uploaded media one hour after TikTok confirms publication or inbox delivery. If another schedule still uses it, ShortsBlink keeps the upload through that delivery and its one-hour window. After cleanup, upload the original again to make a copy. Captions and calendar history remain available.

1. Use `list_accounts` to match the requested handle. Use `get_calendar` with a UTC month such as `2027-01` and an optional `account_id` to inspect the schedule.
2. For new media, upload each finished file in display order. The hosted `upload_media` tool accepts `kind` (`image` or `video`) and `data_base64` for an available file payload up to 1 MiB decoded. For files on disk, stream bytes from the local terminal. This also handles full-size videos and avoids putting image data in the conversation. Example for one slide:

   ```sh
   curl --fail --silent --show-error \
     -H "Authorization: Bearer $SHORTSBLINK_LICENSE_KEY" \
     -H 'Content-Type: application/octet-stream' \
     --data-binary @final/01.jpg \
     'https://shortsblink.com/lifetime/api/assets?kind=image'
   ```

   A successful upload returns an `asset_id`. In a batch script, iterate the manifest, check every HTTP response and append each returned ID in the same order. For MP4/MOV use `kind=video`. Limits are 20 MiB per JPG/PNG/WebP and 256 MiB per video.
3. When scheduling is requested, call `schedule_post` with the ordered `asset_ids` (one video or up to 35 photos), target `account_id`, `title`, optional `caption`, future `scheduled_for` including its time-zone offset, and a freshly generated UUID `request_id`. Use `delivery_mode: "inbox"` to finish in TikTok. For direct delivery use `"direct"` and the user’s chosen `privacy_level`.
4. To reuse an existing ShortsBlink video or slideshow, call `copy_post` with its `source_schedule_id`, destination account, time and a new request UUID. It preserves media order and supports a replacement title or caption. Reuse the exact same arguments and UUID if a scheduling call times out.
5. Read the destination’s UTC month with `get_calendar`. Match the returned schedule ID, handle via account ID, time, format, delivery and status. Report the observed state. A queued job and an inbox delivery each precede publication.

## Write a script that calls MCP directly

For a standalone Node 18+ script, send JSON-RPC over HTTPS to the same hosted endpoint. This read-only example negotiates the protocol, then lists the workspace’s accounts. Save it as `accounts.mjs` and run `node accounts.mjs` from the terminal with the exported key.

```js
const endpoint = "https://shortsblink.com/lifetime/mcp";
const key = process.env.SHORTSBLINK_LICENSE_KEY;
if (!key) throw new Error("Set SHORTSBLINK_LICENSE_KEY in the terminal.");

let version;
let nextId = 1;
async function rpc(method, params, notify = false) {
  const headers = {
    Authorization: `Bearer ${key}`,
    "Content-Type": "application/json",
    Accept: "application/json, text/event-stream"
  };
  if (version) headers["MCP-Protocol-Version"] = version;
  const message = { jsonrpc: "2.0", method, params };
  if (!notify) message.id = nextId++;
  const response = await fetch(endpoint, {
    method: "POST", headers, body: JSON.stringify(message), redirect: "error"
  });
  if (!response.ok) throw new Error(`ShortsBlink HTTP ${response.status}`);
  if (notify) return;
  const reply = await response.json();
  if (reply.error) throw new Error(reply.error.message);
  if (reply.result.isError) throw new Error(reply.result.content[0].text);
  return reply.result;
}

const hello = await rpc("initialize", {
  protocolVersion: "2025-11-25", capabilities: {},
  clientInfo: { name: "my-slideshow-script", version: "1.0" }
});
version = hello.protocolVersion;
await rpc("notifications/initialized", {}, true);
const result = await rpc("tools/call", { name: "list_accounts", arguments: {} });
console.log(JSON.parse(result.content[0].text).accounts);
```

Use `rpc("tools/list", {})` to discover current argument schemas. For a requested scheduling script, upload the rendered files, pass the ordered IDs to `schedule_post`, then call `get_calendar` to verify the result. Use a separate UUID for each new post.
