Nick: revert trailing comma
This commit is contained in:
@@ -8,7 +8,7 @@ import { EngineError } from "../../error";
|
||||
const client = new ScrapingBeeClient(process.env.SCRAPING_BEE_API_KEY!);
|
||||
|
||||
export function scrapeURLWithScrapingBee(
|
||||
wait_browser: "domcontentloaded" | "networkidle2"
|
||||
wait_browser: "domcontentloaded" | "networkidle2",
|
||||
): (meta: Meta) => Promise<EngineScrapeResult> {
|
||||
return async (meta: Meta): Promise<EngineScrapeResult> => {
|
||||
let response: AxiosResponse<any>;
|
||||
@@ -23,12 +23,12 @@ export function scrapeURLWithScrapingBee(
|
||||
json_response: true,
|
||||
screenshot: meta.options.formats.includes("screenshot"),
|
||||
screenshot_full_page: meta.options.formats.includes(
|
||||
"screenshot@fullPage"
|
||||
)
|
||||
"screenshot@fullPage",
|
||||
),
|
||||
},
|
||||
headers: {
|
||||
"ScrapingService-Request": "TRUE" // this is sent to the page, not to ScrapingBee - mogery
|
||||
}
|
||||
"ScrapingService-Request": "TRUE", // this is sent to the page, not to ScrapingBee - mogery
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
if (error instanceof AxiosError && error.response !== undefined) {
|
||||
@@ -51,25 +51,25 @@ export function scrapeURLWithScrapingBee(
|
||||
|
||||
if (body.errors || body.body?.error || isHiddenEngineError) {
|
||||
meta.logger.error("ScrapingBee threw an error", {
|
||||
body: body.body?.error ?? body.errors ?? body.body ?? body
|
||||
body: body.body?.error ?? body.errors ?? body.body ?? body,
|
||||
});
|
||||
throw new EngineError("Engine error #34", {
|
||||
cause: { body, statusCode: response.status }
|
||||
cause: { body, statusCode: response.status },
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof body.body !== "string") {
|
||||
meta.logger.error("ScrapingBee: Body is not string??", { body });
|
||||
throw new EngineError("Engine error #35", {
|
||||
cause: { body, statusCode: response.status }
|
||||
cause: { body, statusCode: response.status },
|
||||
});
|
||||
}
|
||||
|
||||
specialtyScrapeCheck(
|
||||
meta.logger.child({
|
||||
method: "scrapeURLWithScrapingBee/specialtyScrapeCheck"
|
||||
method: "scrapeURLWithScrapingBee/specialtyScrapeCheck",
|
||||
}),
|
||||
body.headers
|
||||
body.headers,
|
||||
);
|
||||
|
||||
return {
|
||||
@@ -80,9 +80,9 @@ export function scrapeURLWithScrapingBee(
|
||||
statusCode: response.status,
|
||||
...(body.screenshot
|
||||
? {
|
||||
screenshot: `data:image/png;base64,${body.screenshot}`
|
||||
screenshot: `data:image/png;base64,${body.screenshot}`,
|
||||
}
|
||||
: {})
|
||||
: {}),
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user