Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Merge pull request #332 from mendableai/feat/rawHtmlExtraction

Nicolas42cd58a67954
diff --cc apps/api/src/scraper/WebScraper/single_url.ts
index 2d66315c3,8c9503c81..c4496ce02
--- a/apps/api/src/scraper/WebScraper/single_url.ts
+++ b/apps/api/src/scraper/WebScraper/single_url.ts
@@@ -348,10 -303,14 +348,14 @@@ export async function scrapSingleUrl
pageOptions: PageOptions = {
onlyMainContent: true,
includeHtml: false,
+ includeRawHtml: false,
waitFor: 0,
screenshot: false,
- headers: undefined
+ headers: undefined,
},
+ extractorOptions: ExtractorOptions = {
+ mode: "llm-extraction-from-markdown"
+ },
existingHtml: string = ""
): Promise<Document> {
urlToScrap = urlToScrap.trim();
@@@ -517,10 -443,13 +521,12 @@@
if (attempt.pageStatusCode) {
pageStatusCode = attempt.pageStatusCode;
}
- if (attempt.pageError) {
+ if (attempt.pageError && attempt.pageStatusCode != 200) {
pageError = attempt.pageError;
+ } else {
+ pageError = undefined;
}
-
-
+
if (text && text.trim().length >= 100) break;
if (pageStatusCode && pageStatusCode == 404) break;
const nextScraperIndex = scrapersInOrder.indexOf(scraper) + 1;