tonhowtf/omniget · error · anyhow::Error

No audio URL available

Error message

No audio URL available

What it means

For MediaType::Audio downloads (e.g., extracting a TikTok sound), download() takes the first entry of info.available_qualities as the audio source. This error is thrown when that list is empty, meaning no audio URL was extracted for the media item.

Solutions

  1. Re-run get_media_info and verify a music/sound URL exists for the post in the raw JSON.
  2. Fall back to yt-dlp extraction of the audio track if no direct audio URL exists.
  3. Check whether the post actually has an audio track (some image posts do not).
  4. Guard in get_media_info: only emit MediaType::Audio when an audio quality entry was found.

Example fix

// before
let quality = info.available_qualities.first()
    .ok_or_else(|| anyhow!("No audio URL available"))?;
// after
match info.available_qualities.first() {
    Some(q) => q,
    None => return Err(anyhow!("No audio URL available — this post may have no sound track")),
}
Defensive patterns

Strategy: validation

Validate before calling

// Guard before calling download for audio
if info.media_type == MediaType::Audio && info.available_qualities.is_empty() {
    eprintln!("post has no downloadable audio track");
}

Try / catch

match download(info, opts).await {
    Err(e) if e.to_string().contains("No audio URL") => notify("no sound track for this post"),
    other => other,
}

Prevention

When it happens

Trigger: Calling download() on a MediaInfo of type Audio whose available_qualities is empty — the fetch/parse phase produced no music/playUrl entry (e.g., original video with no separate sound entry, or extraction failed silently).

Common situations: Attempting to download the sound of a video where TikTok returned no music metadata; slideshows with no audio track; schema change removing the music URL fields.

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/1754cb79c7e36048. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/src/platforms/tiktok/mod.rs:647

                    total_bytes += bytes;
                    last_path = output;

                    let percent = ((i + 1) as f64 / count as f64) * 100.0;
                    let _ = progress.send(ProgressUpdate::percent(percent)).await;
                }

                Ok(DownloadResult {
                    file_path: last_path,
                    file_size_bytes: total_bytes,
                    duration_seconds: 0.0,
                    torrent_id: None,
                })
            }
            MediaType::Audio => {
                let quality = info
                    .available_qualities
                    .first()
                    .ok_or_else(|| anyhow!("No audio URL available"))?;

                let filename = format!("{}.mp3", sanitize_filename::sanitize(&info.title));
                let output = opts.output_dir.join(&filename);

                let bytes = direct_downloader::download_direct_with_headers(
                    &self.client,
                    &quality.url,
                    &output,
                    progress,
                    Some(headers),
                    Some(&opts.cancel_token),
                )
                .await?;

                Ok(DownloadResult {
                    file_path: output,
                    file_size_bytes: bytes,
                    duration_seconds: 0.0,

View on GitHub (pinned to 8600b91f42)