tonhowtf/omniget · error

Video data not found in TikTok response

Error message

Video data not found in TikTok response

What it means

The parsed JSON lacked the __DEFAULT_SCOPE__ > webapp.video-detail object, so fetch_detail returns this error. The response was valid JSON but did not contain the video detail payload the parser expects.

Solutions

  1. Log the top-level JSON keys present to see what scope TikTok returned
  2. Check statusMsg/statusCode handling upstream and surface those errors first when available
  3. Update the parser if TikTok renamed the webapp.video-detail path
  4. Retry with an authenticated session (cookies) for login-gated videos

Example fix

// before
.ok_or_else(|| anyhow!("Video data not found in TikTok response"))?;
// after
.ok_or_else(|| anyhow!("Video data not found; keys: {:?}", data.get("__DEFAULT_SCOPE__").map(|s| s.as_object().map(|o| o.keys().cloned().collect::<Vec<_>>())))?;
Defensive patterns

Strategy: validation

Validate before calling

let ok = json.get("__DEFAULT_SCOPE__")
    .and_then(|s| s.get("webapp.video-detail"))
    .is_some();
if !ok { return Err("response lacks webapp.video-detail".into()); }

Type guard

fn has_video_detail(json: &serde_json::Value) -> bool {
    json.get("__DEFAULT_SCOPE__")
        .and_then(|s| s.get("webapp.video-detail"))
        .is_some()
}

Try / catch

match fetch_detail(url).await {
    Err(e) if e.to_string().contains("Video data not found") => {
        report_schema_drift_and_skip(url)
    }
    other => other,
}

Prevention

When it happens

Trigger: TikTok returned a valid page whose rehydration JSON has no video-detail scope — e.g. a login-required page, region-blocked video, or a schema change renaming/moving the key.

Common situations: Videos requiring login, geo-restricted content, deleted videos served as normal pages, or TikTok restructuring its __DEFAULT_SCOPE__ keys.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/e7e7f8858ae16ed3. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/src/platforms/tiktok/mod.rs:176

        if Self::is_captcha_page(&html) {
            return Err(anyhow!(
                "TikTok is blocking requests. Try again in a few minutes."
            ));
        }

        let json_str = html
            .split("<script id=\"__UNIVERSAL_DATA_FOR_REHYDRATION__\" type=\"application/json\">")
            .nth(1)
            .and_then(|s| s.split("</script>").next())
            .ok_or_else(|| anyhow!("TikTok is blocking requests. Try again in a few minutes."))?;

        let data: serde_json::Value = serde_json::from_str(json_str)
            .map_err(|_| anyhow!("Erro ao processar resposta do TikTok"))?;

        let video_detail = data
            .get("__DEFAULT_SCOPE__")
            .and_then(|s| s.get("webapp.video-detail"))
            .ok_or_else(|| anyhow!("Video data not found in TikTok response"))?;

        if let Some(status_msg) = video_detail
            .get("statusMsg")
            .and_then(|v| v.as_str())
            .filter(|s| !s.is_empty())
        {
            return Err(anyhow!("Post not available: {}", status_msg));
        }

        if let Some(status_code) = video_detail.get("statusCode").and_then(|v| v.as_u64()) {
            if status_code != 0 {
                return Err(anyhow!("Post not available (status {})", status_code));
            }
        }

        let detail = video_detail
            .pointer("/itemInfo/itemStruct")
            .ok_or_else(|| anyhow!("Video data not found in TikTok response"))?

View on GitHub (pinned to 8600b91f42)