tonhowtf/omniget · error · anyhow::Error

nao achei os bundles JS do X na pagina

Error message

nao achei os bundles JS do X na pagina

What it means

refresh() in query_ids.rs fetches the X (Twitter) web page HTML, extracts <script> bundle URLs, and bails if none are found. This means the fetched page contained no JS bundle references, so GraphQL operation IDs cannot be discovered.

Solutions

  1. Log/inspect the returned HTML to see what page X actually served (block page vs. changed markup).
  2. Retry with an authenticated session or different IP/proxy to get the real app shell.
  3. Update the script_urls() extraction regex to match the current X page markup.
  4. Use a cached copy of the query-id mapping until refresh can succeed.
Defensive patterns

Strategy: fallback

Try / catch

match refresh().await {
    Ok(ids) => ids,
    Err(e) if e.to_string().contains("bundles JS") => {
        // fall back to cached ids and log for diagnosis
        load()
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling refresh() when the fetched HTML has zero script URLs — typically because X returned a block page, consent/challenge page, or an empty/error response instead of the normal app shell.

Common situations: IP rate-limited or blocked by X; guest access serving a simplified page; X changed its page markup so script_urls() regex no longer matches; proxy returning an error page.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/x/query_ids.rs:209

                    if let Some(next) = text
                        .split("document.location = \"")
                        .nth(1)
                        .and_then(|s| s.split('"').next())
                    {
                        if let Ok(r2) = http.get(next).send().await {
                            if let Ok(t2) = r2.text().await {
                                html.push_str(&t2);
                            }
                        }
                    }
                }
                html.push_str(&text);
            }
        }
    }
    let urls = script_urls(&html);
    if urls.is_empty() {
        anyhow::bail!("nao achei os bundles JS do X na pagina");
    }
    let mut found: HashMap<String, String> = HashMap::new();
    let sem = std::sync::Arc::new(tokio::sync::Semaphore::new(8));
    let mut tasks = Vec::new();
    for url in urls.into_iter().take(60) {
        let http = http.clone();
        let sem = sem.clone();
        tasks.push(tokio::spawn(async move {
            let _p = sem.acquire().await.ok()?;
            let resp = http.get(&url).send().await.ok()?;
            if !resp.status().is_success() {
                return None;
            }
            let text = resp.text().await.ok()?;
            Some(extract_ops(&text))
        }));
    }
    for t in tasks {

View on GitHub (pinned to 8600b91f42)