{"record":{"id":"a48236e04eada759","repo":"tonhowtf/omniget","slug":"n-o-reconheci-esse-perfil-ou-cole-o-favorites","errorCode":null,"errorMessage":"não reconheci esse perfil ou coleção: {}","messagePattern":"não reconheci esse perfil ou coleção: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/tiktok/favorites.rs","lineNumber":330,"sourceCode":"\nfn handle_of(input: &str) -> String {\n    match super::parse_target(input) {\n        Some(super::Target::User { name }) => name,\n        Some(super::Target::Video {\n            user: Some(user), ..\n        }) => user,\n        _ => input.trim().trim_start_matches('@').to_ascii_lowercase(),\n    }\n}\n\nasync fn list_public(\n    input: &str,\n    source: &str,\n    limit: u32,\n    cookies: Option<&std::path::Path>,\n) -> Result<Vec<Entry>> {\n    let target = super::parse_target(input)\n        .ok_or_else(|| anyhow!(\"não reconheci esse perfil ou coleção: {}\", input))?;\n    let url = match (source, &target) {\n        (\"collection\", super::Target::Collection { .. }) => super::canonical_url(&target),\n        (\"collection\", _) => {\n            return Err(anyhow!(\n                \"cole a URL da coleção (…/@usuario/collection/nome-id)\"\n            ))\n        }\n        _ => super::canonical_url(&super::Target::User {\n            name: handle_of(input),\n        }),\n    };\n    let v = super::ytdlp_json(&super::ytdlp_list_args(&url, limit, cookies)).await?;\n    Ok(entries_from_list(&v))\n}\n\nasync fn list_private(\n    opts: &Options,\n    handle: &str,","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/tiktok/favorites.rs#L312-L348","documentation":"list_public() in tiktok/favorites.rs first parses the user-supplied input with super::parse_target; when the input matches neither a user handle nor a collection URL, it fails with this anyhow error embedding the original input. It is an input-format guard ensuring only recognized TikTok targets proceed to URL canonicalization.","triggerScenarios":"Calling list_public (via run or the ao_vivo test) with an input string that parse_target cannot classify: a bare @handle with invalid characters, a full URL that is not a /collection/ URL, an empty string, or a mistyped profile path.","commonSituations":"User pastes a TikTok video URL or a generic web URL instead of a profile/collection URL, forgets the leading @ for a handle, includes whitespace or locale prefixes (e.g. 'pt.tiktok.com'), or passes an internal ID expecting it to be recognized.","solutions":["Pass a profile as @handle (e.g. @usuario) or a collection URL matching .../@usuario/collection/nome-id.","Strip surrounding whitespace, quotes, and locale prefixes (m./pt./www.) from the URL before calling.","Confirm you did not paste a video (/video/ID) or live URL — those are not valid targets here.","Inspect super::parse_target to see the exact accepted formats and normalize your input to one of them."],"exampleFix":"// before\nfavorites::list_public(\"tiktok.com/@usuario?lang=pt-BR\", \"collection\", 50, None).await?;\n// after\nfavorites::list_public(\"https://www.tiktok.com/@usuario/collection/meus-favoritos-123\", \"collection\", 50, None).await?;","handlingStrategy":"validation","validationCode":"// Rust\nfn looks_like_target(input: &str) -> bool {\n    let s = input.trim();\n    (s.starts_with('@') && s.len() > 1)\n        || (s.contains(\"tiktok.com/@\") && (s.contains(\"/collection/\") || !s.contains(\"/video/\")))\n}\nassert!(looks_like_target(\"@usuario\"));","typeGuard":"enum Target { User { name: String }, Collection { name: String, id: String } }\nfn is_collection(t: &Target) -> bool { matches!(t, Target::Collection { .. }) }","tryCatchPattern":"match list_public(input, source, limit, cookies).await {\n    Ok(entries) => render(entries),\n    Err(e) if e.to_string().contains(\"não reconheci esse perfil\") => eprintln!(\"Use @handle ou a URL completa da coleção\"),\n    Err(e) => return Err(e),\n}","preventionTips":["Normalize input (trim, strip locale prefixes) before passing it to the library.","Only accept inputs that match @handle or a tiktok.com/@user/collection/... URL in your UI layer.","Keep a regex for valid TikTok handles/URLs and test it against common pasted junk.","Show accepted input formats in the UI next to the input field."],"tags":["tiktok","input-validation","invalid-url","rust"],"backgroundTag":"invalid-identifier-format","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}