@Vlad
I took some time reverse engineering the search bar requests from Brave browser and Firefox. Apparently "www.google.com/complete/search" is called differently depending on the client:
google.com: it returns a piece of javascript, it's very easy to inspect but doesn't return calculations (see https://kagifeedback.org/d/2763-results-for-conversions-in-open-search-suggestions) and isn't suitable for a search bar autosuggestions.
firefox: The desktop search bar on Firefox supports calculator and images/descriptions. It's a very simple and clean endpoint (https://www.google.com/complete/search?client=firefox&q=%s&channel=fen).
Chrome based: They have more complex features on the search bar, which they call "omnibox". It includes all that is included on Firefox plus additional features such as currency conversion (extremely useful) and translations (it doesn't work so well).
These advanced features are probably more expensive to chrome and are not triggered directly using a single api call. Kagi shouldn't take these complex calls from google, but I can get some sample of the result for currency conversion if needed.
So to fix/improve Kagi's autocomplete and get both calculator and images working, you can focus on the following examples:
- Firefox, calculator, should work for more math formulas, like "
1+1)/3": curl https://www.google.com/complete/search\?client\=firefox\&q\=1%2B1%29%2F3\&channel\=fen
- Firefox, "beyonce", should show images:
curl https://www.google.com/complete/search\?client\=firefox\&q\=beyonce\&channel\=fen
- Chrome, calculator:
curl -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' 'https://www.google.com/complete/search?client=chrome-omni&gs_ri=chrome-ext-ansg&q=1%2B1%29%2F3'
- Chrome, images:
curl -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' 'https://www.google.com/complete/search?client=chrome-omni&gs_ri=chrome-ext-ansg&q=beyonce'. The image urls format are encoded in some format that I haven't tried to decode.
btw, I'm open to work and would love be paid to dive deeper and implement such features