tonhowtf/omniget · error

cole o link do vídeo do Bilibili

Error message

cole o link do vídeo do Bilibili

What it means

export::run trims opts.url and throws 'cole o link do vídeo do Bilibili' when the result is empty. This is a required-input guard: the export pipeline needs a Bilibili video URL before it can fetch cookies and danmaku.

Solutions

  1. Validate/require a non-empty URL in the UI before invoking export
  2. Check that the field binding actually passes the user's input into ExportOptions.url
  3. In callers, bail early with a clear message when url.trim().is_empty()

Example fix

// before
export::run(&ExportOptions { url: form.url, ..opts }).await?;
// after
anyhow::ensure!(!form.url.trim().is_empty(), "informe o link do vídeo");
export::run(&ExportOptions { url: form.url.clone(), ..opts }).await?;
Defensive patterns

Strategy: validation

Validate before calling

fn url_present(url: &str) -> bool {
    !url.trim().is_empty()
}

Try / catch

match export::run(&opts, &progress).await {
    Err(e) if e.to_string().contains("cole o link") => focus_url_input_and_prompt_user(),
    Err(e) => propagate(e)?,
    Ok(res) => use_result(res),
}

Prevention

When it happens

Trigger: Calling bilibili::danmaku::export::run with ExportOptions { url: "" } or a whitespace-only string; the frontend bound an empty input field.

Common situations: User clicked export before pasting a link; form state reset to empty string; a previous pipeline step produced an empty URL variable.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/src/platforms/bilibili/danmaku/export.rs:78

}

#[derive(Debug, Clone, Serialize)]
pub struct ExportResult {
    pub title: String,
    pub part: DanmakuPart,
    /// Todas as partes que a URL tem, para a UI montar o seletor.
    pub parts: Vec<DanmakuPart>,
    pub fetched: usize,
    pub kept: usize,
    pub files: Vec<ExportFile>,
    /// `true` quando saiu com a sessão de uma conta, não anônimo.
    pub with_account: bool,
}

pub async fn run(opts: &ExportOptions, progress: &ProgressFn) -> Result<ExportResult> {
    let url = opts.url.trim();
    if url.is_empty() {
        return Err(anyhow!("cole o link do vídeo do Bilibili"));
    }
    report(progress, ID, "started", 0, Some(4), None);

    // Cookies anônimos (buvid3/buvid4/bili_ticket): sem eles a assinatura WBI
    // do endpoint de danmaku é recusada em boa parte dos vídeos.
    if let Err(e) = cookie::ensure_fresh().await {
        tracing::warn!("[bili-danmaku] cookies anônimos falharam: {:?}", e);
    }
    let slug = active_account_slug();
    let with_account = slug.is_some();
    let client = build_client(slug.as_deref())?;

    report(
        progress,
        ID,
        "progress",
        1,
        Some(4),

View on GitHub (pinned to 8600b91f42)