Skip to content

[bug] lens list/get fails: .lens_edit_lens wrapper removed and aria-labels localized #185

Description

@terje1965

What happened?

kagi lens list and kagi lens get fail with a parse error on accounts whose Kagi UI language is not English (reproduced with Norwegian):

$ kagi lens list
parse error: lens '4248' missing edit url

Root cause

parse_lens_list in src/parser.rs resolves the edit link with:

let edit_selector = selector(r#".lens_edit_lens a[aria-label="Edit lens"]"#)?;

Two problems with the live page (verified against /html/settings/lenses server HTML, 2026-09-12):

  1. The .lens_edit_lens wrapper no longer exists. The edit anchor now sits directly inside the form.__lens_item:
<a aria-label='Rediger linse'
    class="btn-icon m-n4"
    href="/settings/update_lens?id=4248">…svg…</a>
  1. aria-label is localized — a Norwegian-locale account renders aria-label='Rediger linse', so even unwrapping the selector would not match non-English accounts.

This means every lens fails at the edit_url extraction, aborting the whole list.

Suggested fix

Fall back to matching the edit link by href prefix, which is locale-independent and wrapper-independent:

let edit_fallback_selector = selector(r#"a[href^="/settings/update_lens?id="]"#)?;
// …
let edit_url = item
    .select(&edit_selector)
    .next()
    .or_else(|| item.select(&edit_fallback_selector).next())
    .and_then(|node| node.value().attr("href"))
    // …

I have implemented and tested this locally: lens list returns all 14 lenses and lens get works, E2E against a Norwegian-locale account. Happy to open a PR with the fix + a regression test using the live markup above — just say the word (or I can attach the full patch here).

Environment

  • kagi-cli 0.20.0 (homebrew tap microck/kagi)
  • macOS 15 (arm64)
  • Kagi UI language: Norwegian (Bokmål)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions