0

Nick: added url as return param

This commit is contained in:
Nicolas 2024-04-23 17:14:34 -07:00
parent 3abfd6b4c1
commit fdb2789eaa
2 changed files with 3 additions and 0 deletions

View File

@ -40,6 +40,7 @@ export type WebScraperOptions = {
export class Document {
id?: string;
url?: string; // Used only in /search for now
content: string;
markdown?: string;
createdAt?: Date;

View File

@ -154,10 +154,12 @@ export async function scrapSingleUrl(
// }
let [text, html] = await attemptScraping(urlToScrap, "scrapingBee");
// Basically means that it is using /search endpoint
if(pageOptions.fallback === false){
const soup = cheerio.load(html);
const metadata = extractMetadata(soup, urlToScrap);
return {
url: urlToScrap,
content: text,
markdown: text,
metadata: { ...metadata, sourceURL: urlToScrap },