initial commit: slides ready + upgraded
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
# CheerioWebBaseLoader
|
||||
|
||||
<v-clicks>
|
||||
|
||||
Carga páginas web como documentos (sin ejecutar JavaScript)
|
||||
|
||||
### Instalación
|
||||
|
||||
```bash
|
||||
npm install @langchain/community cheerio
|
||||
```
|
||||
|
||||
### Uso
|
||||
|
||||
```typescript
|
||||
import "cheerio";
|
||||
import { CheerioWebBaseLoader } from
|
||||
"@langchain/community/document_loaders/web/cheerio";
|
||||
|
||||
const loader = new CheerioWebBaseLoader(
|
||||
"https://blog.langchain.dev/what-is-an-agent/",
|
||||
{ selector: "article" } // selector CSS para filtrar contenido
|
||||
);
|
||||
const docs = await loader.load();
|
||||
|
||||
console.log(docs[0].pageContent.substring(0, 300));
|
||||
console.log(docs[0].metadata);
|
||||
// { source: 'https://blog.langchain.dev/...', title: '...' }
|
||||
```
|
||||
|
||||
<div class="mt-4 p-4 bg-yellow-500/10 rounded">
|
||||
⚠️ Para SPAs o páginas con JS dinámico, usa <b>Playwright</b> o <b>Puppeteer</b>
|
||||
</div>
|
||||
|
||||
</v-clicks>
|
||||
Reference in New Issue
Block a user