{"record":{"id":"1a0b6eed7a9f09de","repo":"tonhowtf/omniget","slug":"sem-a-sess-o-do-substack-n-o-d-para-listar-as-suas","errorCode":null,"errorMessage":"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","messagePattern":"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","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/blogs/substack.rs","lineNumber":368,"sourceCode":"            String::new()\n        } else {\n            html_to_markdown(&body)\n        },\n        html: if locked { None } else { Some(body) },\n        meta,\n        locked,\n    }\n}\n\n// ── Execução ───────────────────────────────────────────────────────────\n\nconst PAGE: usize = 12;\n\n/// Descobre as assinaturas da conta logada. Sem sessão não há o que\n/// descobrir: o endpoint responde 401.\npub async fn discover(fetcher: &Fetcher) -> Result<Vec<Subscription>> {\n    if !fetcher.has_session() {\n        return Err(anyhow!(\n            \"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\"\n        ));\n    }\n    let v = fetcher\n        .get_json(\"https://substack.com/api/v1/subscriptions\")\n        .await?;\n    let subs = parse_subscriptions(&v);\n    if subs.is_empty() {\n        return Err(anyhow!(\n            \"a conta logada não tem nenhuma assinatura ativa (ou a sessão expirou)\"\n        ));\n    }\n    Ok(subs)\n}\n\npub async fn run(opts: &Options, progress: ProgressFn) -> Result<ArchiveResult> {\n    let dest = opts.dest.trim();\n    if dest.is_empty() {","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/blogs/substack.rs#L350-L386","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Capture/record the substack.com cookies (SubstackCookie) via the app's cookie manager, then retry discover","Pass a Netscape-format cookie file containing substack.com cookies through Options.session_netscape when constructing the Fetcher","If no session is available, skip discover and list the publications manually in the options"],"exampleFix":"// before\nlet subs = substack::discover(&fetcher).await?;\n// after\nif fetcher.has_session() {\n    let subs = substack::discover(&fetcher).await?;\n} else {\n    let subs = manual_publications(); // user-typed list\n}","handlingStrategy":"validation","validationCode":"if !fetcher.has_session() {\n    eprintln!(\"Substack session required; capture substack.com cookies first\");\n    return fallback_to_manual_list();\n}\nlet subs = substack::discover(&fetcher).await?;","typeGuard":"fn can_discover(fetcher: &Fetcher) -> bool { fetcher.has_session() }","tryCatchPattern":null,"preventionTips":["Check fetcher.has_session() before any authenticated Substack call","Keep the captured cookie file fresh; re-capture after every Substack re-login","Ensure the Netscape cookie file covers the substack.com domain, not just individual publication domains"],"tags":["substack","session","authentication","rust"],"backgroundTag":"authentication-required","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}