{"record":{"id":"b59b44f8d66d2611","repo":"tonhowtf/omniget","slug":"video-data-not-found-in-tiktok-response","errorCode":null,"errorMessage":"Video data not found in TikTok response","messagePattern":"Video data not found in TikTok response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/platforms/tiktok.rs","lineNumber":176,"sourceCode":"        if Self::is_captcha_page(&html) {\n            return Err(anyhow!(\n                \"TikTok is blocking requests. Try again in a few minutes.\"\n            ));\n        }\n\n        let json_str = html\n            .split(\"<script id=\\\"__UNIVERSAL_DATA_FOR_REHYDRATION__\\\" type=\\\"application/json\\\">\")\n            .nth(1)\n            .and_then(|s| s.split(\"</script>\").next())\n            .ok_or_else(|| anyhow!(\"TikTok is blocking requests. Try again in a few minutes.\"))?;\n\n        let data: serde_json::Value = serde_json::from_str(json_str)\n            .map_err(|_| anyhow!(\"Erro ao processar resposta do TikTok\"))?;\n\n        let video_detail = data\n            .get(\"__DEFAULT_SCOPE__\")\n            .and_then(|s| s.get(\"webapp.video-detail\"))\n            .ok_or_else(|| anyhow!(\"Video data not found in TikTok response\"))?;\n\n        if let Some(status_msg) = video_detail\n            .get(\"statusMsg\")\n            .and_then(|v| v.as_str())\n            .filter(|s| !s.is_empty())\n        {\n            return Err(anyhow!(\"Post not available: {}\", status_msg));\n        }\n\n        if let Some(status_code) = video_detail.get(\"statusCode\").and_then(|v| v.as_u64()) {\n            if status_code != 0 {\n                return Err(anyhow!(\"Post not available (status {})\", status_code));\n            }\n        }\n\n        let detail = video_detail\n            .pointer(\"/itemInfo/itemStruct\")\n            .ok_or_else(|| anyhow!(\"Video data not found in TikTok response\"))?","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/platforms/tiktok.rs#L158-L194","documentation":"The rehydration JSON parsed successfully, but it does not contain the expected __DEFAULT_SCOPE__ > \"webapp.video-detail\" key. TikTok's response shape changed or the page is not a video detail page. The library treats a missing key as a hard error rather than returning empty data.","triggerScenarios":"fetch_detail calls data.get(\"__DEFAULT_SCOPE__\").and_then(|s| s.get(\"webapp.video-detail\")) and the Option is None — e.g. TikTok returned a login wall, a regional block, or renamed/restructured the payload.","commonSituations":"TikTok A/B testing a new payload schema; the URL pointed to a user profile or photo post rather than a video; logged-out requests being redirected to a signup page; region-locked content.","solutions":["Verify the URL is a direct video URL (tiktok.com/@user/video/<id>), not a profile or photo post link.","Retry with cookies/session headers so TikTok serves the full video-detail payload.","Update/upgrade the omniget client in case TikTok changed its schema and a newer build handles it.","Fall back to get_media_info_via_ytdlp for URL extraction."],"exampleFix":"// defensive caller check before trusting the parsed detail\nif let Err(e) = tiktok.get_media_info(url).await {\n    if e.to_string().contains(\"Video data not found\") {\n        return tiktok.get_media_info_via_ytdlp(url, &post_id).await;\n    }\n    return Err(e);\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"match tiktok.get_media_info(url).await {\n    Err(e) if e.to_string().contains(\"Video data not found\") => tiktok.get_media_info_via_ytdlp(url, &post_id).await,\n    other => other,\n}","preventionTips":["Validate the URL is a canonical /@user/video/<id> form before calling.","Keep the extractor updated against TikTok schema changes.","Log the raw payload when this fires to detect schema drift early.","Prefer authenticated session cookies over anonymous scraping."],"tags":["tiktok","schema-change","scraping","missing-key"],"backgroundTag":"unexpected-response-shape","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}