Fix slower Zillow unit photo discovery path
This commit is contained in:
@@ -60,7 +60,7 @@ async function collectListingUrl(page) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function discoverHarListing(rawAddress) {
|
||||
export async function discoverHarListing(rawAddress, options = {}) {
|
||||
const address = String(rawAddress || "").trim();
|
||||
const identity = parseAddressIdentity(address);
|
||||
const searchUrl = buildSearchUrl(address);
|
||||
@@ -121,6 +121,7 @@ export async function discoverHarListing(rawAddress) {
|
||||
};
|
||||
},
|
||||
{
|
||||
timeoutMs: Number(options.timeoutMs || 0) || undefined,
|
||||
onTimeout: closeContext
|
||||
}
|
||||
);
|
||||
|
||||
@@ -32,7 +32,7 @@ async function getAnnouncedPhotoCount(page) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function extractHarPhotos(rawUrl) {
|
||||
export async function extractHarPhotos(rawUrl, options = {}) {
|
||||
const requestedUrl = parseTarget(rawUrl);
|
||||
const { context, page } = await createPageSession({ headless: process.env.HEADLESS !== "false" });
|
||||
const closeContext = async () => {
|
||||
@@ -78,6 +78,7 @@ export async function extractHarPhotos(rawUrl) {
|
||||
};
|
||||
},
|
||||
{
|
||||
timeoutMs: Number(options.timeoutMs || 0) || undefined,
|
||||
onTimeout: closeContext
|
||||
}
|
||||
);
|
||||
|
||||
@@ -64,7 +64,7 @@ async function collectListingUrl(page) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function discoverZillowListing(rawAddress) {
|
||||
export async function discoverZillowListing(rawAddress, options = {}) {
|
||||
const address = String(rawAddress || "").trim();
|
||||
const identity = parseAddressIdentity(address);
|
||||
const searchUrl = `https://www.zillow.com/homes/${encodeURIComponent(buildZillowAddressSlug(address))}_rb/`;
|
||||
@@ -125,6 +125,7 @@ export async function discoverZillowListing(rawAddress) {
|
||||
};
|
||||
},
|
||||
{
|
||||
timeoutMs: Number(options.timeoutMs || 0) || undefined,
|
||||
onTimeout: closeContext
|
||||
}
|
||||
);
|
||||
|
||||
@@ -105,7 +105,7 @@ async function collectZillowStructuredPhotoCandidates(page) {
|
||||
return extractZillowStructuredPhotoCandidatesFromNextDataScript(scriptText || "");
|
||||
}
|
||||
|
||||
export async function extractZillowPhotos(rawUrl) {
|
||||
export async function extractZillowPhotos(rawUrl, options = {}) {
|
||||
const requestedUrl = parseTarget(rawUrl);
|
||||
const { context, page } = await createPageSession({ headless: process.env.HEADLESS !== "false" });
|
||||
const closeContext = async () => {
|
||||
@@ -177,6 +177,7 @@ export async function extractZillowPhotos(rawUrl) {
|
||||
};
|
||||
},
|
||||
{
|
||||
timeoutMs: Number(options.timeoutMs || 0) || undefined,
|
||||
onTimeout: closeContext
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user