Skip to content

Commit f749b1b

Browse files
authored
fix: improve store search for actor pictureUrl by using name-only query (#459)
The store keyword search with the full actor name (e.g. 'apify/instagram-scraper') often returned unrelated results, causing the pictureUrl lookup to fail. The widget then fell back to the raw S3 URL from actor.get(), which fails CORS in the OpenAI iframe due to crossOrigin='anonymous' on ActorAvatar. Use only the actor name part after '/' (e.g. 'instagram-scraper') for much better search relevance, so the proxied images.apifyusercontent.com URL is used instead.
1 parent 825ec42 commit f749b1b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/utils/actor-details.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,10 @@ export async function fetchActorDetails(
9292
const [actorInfo, buildInfo, storeActors]: [Actor | undefined, Build | undefined, ActorStoreList[]] = await Promise.all([
9393
apifyClient.actor(actorName).get(),
9494
apifyClient.actor(actorName).defaultBuild().then(async (build) => build.get()),
95-
// Fetch from store to get the processed pictureUrl (with resizing parameters)
96-
searchActorsByKeywords(actorName, apifyClient.token || '', ACTOR_DETAILS_PICTURE_SEARCH_LIMIT).catch(() => []),
95+
// Fetch from store to get the processed pictureUrl (with resizing parameters).
96+
// Use only the actor name part (after '/') for better keyword search relevance —
97+
// searching "apify/instagram-scraper" returns unrelated results, while "instagram-scraper" finds the correct actor.
98+
searchActorsByKeywords(actorName.split('/').pop() || actorName, apifyClient.token || '', ACTOR_DETAILS_PICTURE_SEARCH_LIMIT).catch(() => []),
9799
]);
98100
if (!actorInfo || !buildInfo || !buildInfo.actorDefinition) return null;
99101

0 commit comments

Comments
 (0)