Feat: Ask Brave for 100 results and allow ?i= up to 40 on the main site

free.* and ai.* stay at 20, since Openverse and Wikimedia return ~50 results together.
Also note that production's Openverse requests are authenticated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 16:29:09 +00:00
co-authored by Claude Opus 5.5
parent fce6fdfd0f
commit ce834a06ca
5 changed files with 11 additions and 9 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
// { urls } ([] if none found), or { error } if Brave refused or failed, e.g. once our rate or spending limit is hit
export async function braveImageSearch(query, apiKey) {
try {
const res = await fetch(`https://api.search.brave.com/res/v1/images/search?q=${encodeURIComponent(query)}&count=50&safesearch=off`, {
const res = await fetch(`https://api.search.brave.com/res/v1/images/search?q=${encodeURIComponent(query)}&count=100&safesearch=off`, {
headers: { "Accept": "application/json", "X-Subscription-Token": apiKey },
});
if (!res.ok) return { error: `HTTP ${res.status}: ${(await res.text()).slice(0, 300)}` };