mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-13 16:08:59 +08:00
fix json
This commit is contained in:
parent
5747af9557
commit
db75e560a6
@ -70,8 +70,6 @@ describe("Scrape tests", () => {
|
||||
formats: ["rawHtml"],
|
||||
});
|
||||
|
||||
console.log(response.rawHtml, response.metadata.contentType);
|
||||
|
||||
const obj = JSON.parse(response.rawHtml!);
|
||||
expect(obj.id).toBe(1);
|
||||
}, 30000);
|
||||
|
@ -3,6 +3,7 @@ import { EngineScrapeResult } from "..";
|
||||
import { Meta } from "../..";
|
||||
import { TimeoutError } from "../../error";
|
||||
import { robustFetch } from "../../lib/fetch";
|
||||
import { getInnerJSON } from "../../../../lib/html-transformer";
|
||||
|
||||
export async function scrapeURLWithPlaywright(
|
||||
meta: Meta,
|
||||
@ -42,6 +43,10 @@ export async function scrapeURLWithPlaywright(
|
||||
})(),
|
||||
]);
|
||||
|
||||
if (response.contentType?.includes("application/json")) {
|
||||
response.content = await getInnerJSON(response.content);
|
||||
}
|
||||
|
||||
return {
|
||||
url: meta.url, // TODO: impove redirect following
|
||||
html: response.content,
|
||||
|
Loading…
x
Reference in New Issue
Block a user