Fix DoorDash image import: scroll page in Playwright to trigger lazy-loaded images
- Update render.js on dev server to scroll page before capturing images - Increase Playwright wait from 4s to 5s and timeout from 90s to 120s - Upsize DoorDash CDN thumbnails from 150px to 600px when downloading Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9a28091601
commit
f58d567fb4
2 changed files with 7 additions and 1 deletions
|
|
@ -1044,7 +1044,7 @@
|
||||||
<cfset arrayAppend(response.steps, "Fetching URL with Playwright: " & targetUrl)>
|
<cfset arrayAppend(response.steps, "Fetching URL with Playwright: " & targetUrl)>
|
||||||
|
|
||||||
<cfset playwrightOutput = "">
|
<cfset playwrightOutput = "">
|
||||||
<cfexecute name="/opt/playwright/run.sh" arguments="'#targetUrl#' 4000" timeout="90" variable="playwrightOutput" />
|
<cfexecute name="/opt/playwright/run.sh" arguments="'#targetUrl#' 5000" timeout="120" variable="playwrightOutput" />
|
||||||
|
|
||||||
<cfif NOT len(trim(playwrightOutput))>
|
<cfif NOT len(trim(playwrightOutput))>
|
||||||
<cfthrow message="Playwright returned empty response">
|
<cfthrow message="Playwright returned empty response">
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,12 @@ function downloadItemImage(itemID, imageUrl) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Upsize DoorDash CDN thumbnails to 600px for better quality
|
||||||
|
if (findNoCase("cdn4dd.com/p/", imageUrl) && findNoCase("width=150", imageUrl)) {
|
||||||
|
imageUrl = replaceNoCase(imageUrl, "width=150", "width=600");
|
||||||
|
imageUrl = replaceNoCase(imageUrl, "height=150", "height=600");
|
||||||
|
}
|
||||||
|
|
||||||
// Download the image
|
// Download the image
|
||||||
http url="#imageUrl#" method="GET" timeout="30" result="httpResult" {
|
http url="#imageUrl#" method="GET" timeout="30" result="httpResult" {
|
||||||
httpparam type="header" name="User-Agent" value="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36";
|
httpparam type="header" name="User-Agent" value="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36";
|
||||||
|
|
|
||||||
Reference in a new issue