Metadata-Version: 2.3
Name: web-content-extractor
Version: 0.2.0
Summary: Download web pages and extract clean visible text and links.
Author: AJoelCastro
Author-email: AJoelCastro <arturocastro.re@gmail.com>
Requires-Dist: requests>=2.32.3
Requires-Dist: playwright>=1.51.0
Requires-Python: >=3.13
Description-Content-Type: text/markdown

# Web Content Extractor

Librería Python para descargar páginas web y obtener HTML, texto visible y enlaces absolutos. HTTP es el transporte predeterminado y Playwright permite renderizar páginas con JavaScript.

## Requisitos

- Python 3.13+
- [uv](https://docs.astral.sh/uv/)

## Instalación

```bash
uv sync
```

Para usar Chromium como fallback ante respuestas HTTP 403/503 o para renderizar páginas directamente, instala el navegador:

```bash
uv run playwright install chromium
```

## Uso

```python
import asyncio
from web_content_extractor import WebContentClient, extract_links


async def main():
    client = WebContentClient(max_chars=8_000)
    page = await client.fetch("https://example.com")

    print(page.url)   # URL final después de redirecciones
    print(page.text)  # Texto visible compacto
    print(len(page.html))

    for link in extract_links(page.html, page.url):
        print(link.text, link.url)


asyncio.run(main())
```

`fetch(url, use_browser=True)` abre directamente Chromium. Por defecto, se usa HTTP y se intenta una vez el navegador ante HTTP 403/503. No se evaden bloqueos ni verificaciones anti-bot.

