tonhowtf/omniget · error

chave de verificacao do X nao encontrada

Error message

chave de verificacao do X nao encontrada

What it means

verification_bytes scrapes an X page's HTML for the twitter-site-verification meta tag and decodes its base64 content into the verification key. When neither regex variant finds the meta tag, it throws "chave de verificacao do X nao encontrada". The verification key is required to build X's animation-based signature, so without it the flow cannot continue.

Solutions

  1. Log the first 500 chars of the fetched HTML to confirm which page was actually returned (login wall vs real page).
  2. Retry with authentication cookies so X serves the full page containing the verification meta tag.
  3. Update the regexes if X renamed twitter-site-verification (check the current page source).
  4. Verify the request went through (status 200, not a challenge/redirect page) before parsing.
Defensive patterns

Strategy: retry

Validate before calling

// após obter o HTML
if !html.contains("twitter-site-verification") {
    return Err(anyhow!("página sem chave de verificação — provável login wall"));
}

Try / catch

match create(http, page, cookie).await {
    Ok(txid) => use(txid),
    Err(e) if e.to_string().contains("chave de verificacao") => {
        eprintln!("HTML sem meta twitter-site-verification; refaça autenticado");
        // retry with cookies or after backoff
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling create when the fetched HTML has no <meta name="twitter-site-verification"> (or fallback) tag — e.g. the page returned was a login wall, an error page, a consent page, or X changed the meta tag name/format.

Common situations: Scraping without authentication when X serves the logged-out fallback page; X renaming the meta attribute; proxy/CDN returning an HTML error page; region-blocked responses.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/x/txid.rs:205

    let mut req = http.post("https://x.com/x/migrate").form(&form);
    if let Some(c) = cookie {
        req = req.header("Cookie", c);
    }
    Ok(req.send().await?.error_for_status()?.text().await?)
}

fn verification_bytes(html: &str) -> anyhow::Result<Vec<u8>> {
    let re1 =
        regex::Regex::new(r#"<meta[^>]*name="twitter-site-verification"[^>]*content="([^"]+)""#)
            .unwrap();
    let re2 =
        regex::Regex::new(r#"<meta[^>]*content="([^"]+)"[^>]*name="twitter-site-verification""#)
            .unwrap();
    let content = re1
        .captures(html)
        .or_else(|| re2.captures(html))
        .map(|c| c[1].to_string())
        .ok_or_else(|| anyhow::anyhow!("chave de verificacao do X nao encontrada"))?;
    Ok(base64::engine::general_purpose::STANDARD.decode(content.as_bytes())?)
}

fn anim_frames(html: &str, vk: &[u8]) -> anyhow::Result<Vec<Vec<f64>>> {
    let re_svg =
        regex::Regex::new(r#"(?s)<svg[^>]*id="loading-x-anim-\d+"[^>]*>(.*?)</svg>"#).unwrap();
    let re_g = regex::Regex::new(r#"(?s)<g[^>]*>(.*?)</g>"#).unwrap();
    let re_path = regex::Regex::new(r#"<path[^>]*\sd="([^"]+)""#).unwrap();
    let mut ds: Vec<String> = Vec::new();
    for svg in re_svg.captures_iter(html) {
        let inner = &svg[1];
        let g = re_g
            .captures(inner)
            .map(|c| c[1].to_string())
            .unwrap_or_else(|| inner.to_string());
        let paths: Vec<String> = re_path
            .captures_iter(&g)
            .map(|c| c[1].trim().to_string())

View on GitHub (pinned to 8600b91f42)