tonhowtf/omniget · error

Could not extract post data from Threads page. The post may

Error message

Could not extract post data from Threads page. The post may be private or deleted.

What it means

fetch_post in threads.rs tries to locate the post's bootstrap JSON in the fetched page HTML, first with a browser UA and then with a crawler (Googlebot) UA. If find_post_in_html fails on both attempts it gives up with this error, meaning Threads returned a page but the post data could not be extracted — typically because the post is private, deleted, geo-blocked, or Threads changed its page markup.

Solutions

  1. Verify the post is publicly viewable in a browser (not deleted/private)
  2. Confirm the URL contains a valid post ID and re-test
  3. Update find_post_in_html parsing for new Threads page markup if the platform changed
  4. Treat this as terminal in the UI: tell the user the post is unavailable rather than retrying

Example fix

null
Defensive patterns

Strategy: retry

Validate before calling

if (!/^https:\/\/(www\.)?threads\.((com)|(net))\/@[\w.]+\/post\/[\w-]+/.test(url)) {
  throw new Error("URL is not a Threads post URL");
}

Try / catch

match threads.get_media_info(url).await {
    Err(e) if e.to_string().contains("may be private or deleted") => {
        // terminal: do not retry
        inform_user("Post is private or deleted");
    }
    other => other?,
}

Prevention

When it happens

Trigger: get_media_info -> fetch_post on a Threads URL where: (1) the post ID is valid but the post was deleted or made private, (2) the <script data-sjs> markup no longer contains the post (Threads frontend changed), (3) the page served was a login/consent wall for both user agents.

Common situations: Sharing links to deleted/private Threads posts; Threads A/B-testing new page structure that breaks find_post_in_html; region-locked content returning an empty shell page.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/platforms/threads.rs:100

        None
    }

    /// Fetch della pagina e estrazione del post dal JSON bootstrap
    async fn fetch_post(&self, url: &str, post_id: &str) -> anyhow::Result<serde_json::Value> {
        let html = self.fetch_page(url, USER_AGENT).await?;
        if let Some(post) = Self::find_post_in_html(&html, post_id) {
            return Ok(post);
        }

        // Alcune richieste anonime vengono murate dal login; col UA crawler
        // Threads serve la pagina completa
        tracing::debug!("[threads] post not found with browser UA, retrying with crawler UA");
        let html = self.fetch_page(url, GOOGLEBOT_UA).await?;
        if let Some(post) = Self::find_post_in_html(&html, post_id) {
            return Ok(post);
        }

        Err(anyhow!(
            "Could not extract post data from Threads page. The post may be private or deleted."
        ))
    }

    async fn fetch_page(&self, url: &str, user_agent: &str) -> anyhow::Result<String> {
        let response = self
            .client
            .get(url)
            .header("User-Agent", user_agent)
            .header(
                "Accept",
                "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
            )
            .header("Accept-Language", "en-GB,en;q=0.9")
            .header("Sec-Fetch-Dest", "document")
            .header("Sec-Fetch-Mode", "navigate")
            .header("Sec-Fetch-Site", "none")
            .header("Sec-Fetch-User", "?1")

View on GitHub (pinned to 8600b91f42)