tonhowtf/omniget · error · anyhow::Error

os favoritos e os curtidos só saem com a sua sessão…

Error message

os favoritos e os curtidos só saem com a sua sessão: capture os cookies do tiktok.com pela extensão e escolha a conta aqui

What it means

list_private() (favorites and liked videos) requires the caller's TikTok session cookies; when opts.session_netscape is None or an empty/whitespace string, it aborts with this anyhow error. Favorites/likes are not public, so the library refuses to proceed without credentials.

Solutions

  1. Export tiktok.com cookies with a browser extension (e.g. 'Get cookies.txt' / Netscape format) while logged into the account.
  2. Set opts.session_netscape to the path of the exported cookies.txt before calling run().
  3. Confirm the exported file is non-empty and in Netscape format (starts with '# Netscape HTTP Cookie File').
  4. If you intended public content, switch the source to a public profile/collection instead of favorites/liked.

Example fix

// before
let opts = FavoritesOpts { source: "favorites".into(), session_netscape: None, ..Default::default() };
// after
let opts = FavoritesOpts { source: "favorites".into(), session_netscape: Some("cookies.txt".into()), ..Default::default() };
Defensive patterns

Strategy: validation

Validate before calling

// Rust
fn session_ready(path: &Option<String>) -> bool {
    path.as_deref().map(|p| std::fs::metadata(p).map(|m| m.len() > 0).unwrap_or(false)).unwrap_or(false)
}
if !session_ready(&opts.session_netscape) {
    eprintln!("Exporte os cookies do tiktok.com antes de listar favoritos");
}

Type guard

fn has_session(opts: &FavoritesOpts) -> bool {
    opts.session_netscape.as_deref().map_or(false, |s| !s.trim().is_empty())
}

Try / catch

match run(opts).await {
    Ok(entries) => render(entries),
    Err(e) if e.to_string().contains("só saem com a sua sessão") => eprintln!("Configure session_netscape com um cookies.txt válido"),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling run with source=favorites or liked while opts.session_netscape is unset, points to an empty file/string, or the user never exported cookies from tiktok.com in Netscape format.

Common situations: Fresh install with no cookie export done, user assumed a public listing works for favorites, cookie export saved to a different path than the one configured, or the cookie string was trimmed away by config preprocessing.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/tiktok/favorites.rs:357

            name: handle_of(input),
        }),
    };
    let v = super::ytdlp_json(&super::ytdlp_list_args(&url, limit, cookies)).await?;
    Ok(entries_from_list(&v))
}

async fn list_private(
    opts: &Options,
    handle: &str,
    progress: &ProgressFn,
    pacer: &Pacer,
) -> Result<Vec<Entry>> {
    let session = opts
        .session_netscape
        .as_deref()
        .filter(|c| !c.trim().is_empty())
        .ok_or_else(|| {
            anyhow!(
                "os favoritos e os curtidos só saem com a sua sessão: capture os cookies do \
                 tiktok.com pela extensão e escolha a conta aqui"
            )
        })?;
    let (client, _) = super::cookie_client(Some(session))?;

    // O `secUid` vem da própria página do perfil, que só abre inteira para
    // quem está logado.
    pacer.wait().await;
    let profile = format!("https://www.tiktok.com/@{}", handle);
    let html = client.get(&profile).send().await?.text().await?;
    let sec_uid = parse_sec_uid(&html).ok_or_else(|| {
        anyhow!(
            "não achei o secUid de @{} na página do perfil — a sessão pode ter expirado",
            handle
        )
    })?;

View on GitHub (pinned to 8600b91f42)