tonhowtf/omniget · error · anyhow::Error

sem a sessão do Substack não dá para listar as suas…

Error message

sem a sessão do Substack não dá para listar as suas assinaturas. Capture os cookies de substack.com no gerenciador, ou digite as publicações à mão

What it means

substack::discover lists the subscriptions of the logged-in Substack account by calling https://substack.com/api/v1/subscriptions. That endpoint requires authenticated cookies and returns 401 without a session, so the function short-circuits with this message when fetcher.has_session() is false instead of making a request that is guaranteed to fail.

Solutions

  1. Capture/record the substack.com cookies (SubstackCookie) via the app's cookie manager, then retry discover
  2. Pass a Netscape-format cookie file containing substack.com cookies through Options.session_netscape when constructing the Fetcher
  3. If no session is available, skip discover and list the publications manually in the options

Example fix

// before
let subs = substack::discover(&fetcher).await?;
// after
if fetcher.has_session() {
    let subs = substack::discover(&fetcher).await?;
} else {
    let subs = manual_publications(); // user-typed list
}
Defensive patterns

Strategy: validation

Validate before calling

if !fetcher.has_session() {
    eprintln!("Substack session required; capture substack.com cookies first");
    return fallback_to_manual_list();
}
let subs = substack::discover(&fetcher).await?;

Type guard

fn can_discover(fetcher: &Fetcher) -> bool { fetcher.has_session() }

Prevention

When it happens

Trigger: Calling discover(fetcher) with a Fetcher built without captured substack.com cookies — i.e. Fetcher::new called with session_netscape = None or a cookie file lacking substack.com domains.

Common situations: User never imported cookies into the app's cookie manager; the Netscape cookie file was not passed in Options.session_netscape; cookies were captured for a different domain (e.g. a publication's domain but not substack.com).

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/blogs/substack.rs:368

            String::new()
        } else {
            html_to_markdown(&body)
        },
        html: if locked { None } else { Some(body) },
        meta,
        locked,
    }
}

// ── Execução ───────────────────────────────────────────────────────────

const PAGE: usize = 12;

/// Descobre as assinaturas da conta logada. Sem sessão não há o que
/// descobrir: o endpoint responde 401.
pub async fn discover(fetcher: &Fetcher) -> Result<Vec<Subscription>> {
    if !fetcher.has_session() {
        return Err(anyhow!(
            "sem a sessão do Substack não dá para listar as suas assinaturas. Capture os cookies de substack.com no gerenciador, ou digite as publicações à mão"
        ));
    }
    let v = fetcher
        .get_json("https://substack.com/api/v1/subscriptions")
        .await?;
    let subs = parse_subscriptions(&v);
    if subs.is_empty() {
        return Err(anyhow!(
            "a conta logada não tem nenhuma assinatura ativa (ou a sessão expirou)"
        ));
    }
    Ok(subs)
}

pub async fn run(opts: &Options, progress: ProgressFn) -> Result<ArchiveResult> {
    let dest = opts.dest.trim();
    if dest.is_empty() {

View on GitHub (pinned to 8600b91f42)