Skip to content
Agentmart
Submit a tool

asp-net-scraping

Técnicas y mejores prácticas para hacer scraping en portales ASP.NET WebForms.

Skill by gentleman-programming

IndexedApache-2.0★ 2
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/ramonsdka-asp-net-scraping

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Técnicas y mejores prácticas para hacer scraping en portales ASP.NET WebForms. Trigger: Cuando se trabaja con scraping en portales gubernamentales o empresariales ASP.NET.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/asp-net-scraping

What's inside

Skill name
asp-net-scraping
Description
Técnicas y mejores prácticas para hacer scraping en portales ASP.NET WebForms. Trigger: Cuando se trabaja con scraping en portales gubernamentales o empresariales ASP.NET.
License
Apache-2.0
Metadata
author: gentleman-programming · version: 1.0
Instructions
145 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

## When to Apply

- Scraping de portales ASP.NET WebForms (como portales gubernamentales)
- Portales que usan ViewState, EventValidation, postbacks
- Sitios con anti-bot básico a medio
- Páginas con paginación ASP.NET

## Componentes Críticos de ASP.NET

| Componente | Qué es | Por qué rompe el scraping |
|------------|--------|---------------------------|
| `__VIEWSTATE` | Estado serializado de la página | Cambia en CADA postback |
| `__EVENTVALIDATION` | Token anti-forgery | Valida que los valores POST fueron generados por el servidor |
| `__EVENTTARGET` | Control que disparó el evento | Indica qué dropdown/botón provocó el postback |
| `__EVENTARGUMENT` | Argumentos del evento | Paginación: `Page$2`, `Page$3`, etc. |

## Herramientas Recomendadas

### Playwright + playwright-stealth (RECOMENDADO)

```python
from playwright.sync_api import sync_playwright
from playwright_stealth import stealth_sync

with sync_playwright() as p:
    browser = p.chromium.launch(headless=True)
    context = browser.new_context(
        user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
        viewport={"width": 1920, "height": 1080}
    )
    page = context.new_page()
    stealth_sync(page)
    
    # Bloquear recursos innecesarios para velocidad
    page.route("**/*.{png,jpg,jpeg,gif,css,woff,woff2}", lambda route: route.abort())
    
    page.goto("https://portal.gov.co/...")
```

### Configuración de Headers Efectiva

```python
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/132.0.0.0 Safari/537.36',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
    'Accept-Language': 'es-CO,es;q=0.9,en;q=0.8',
    'Referer': url,
    'Origin': 'https://portal.gov.co',
}
```

## Técnicas de Stealth

| Técnica | Efectividad |
|---------|-------------|
| playwright-stealth | Media |
| Rotación de User-Agent | Alta |
| Simulación de comportamiento humano | Alta |
| Headed mode (headless=False) | Media |
| Proxies residenciales | Muy Alta |

## Manejo de ViewState - Estrategia

```
FLUJO CORRECTO para paginación ASP.NET:

1. GET → Extraer __VIEWSTATE, __EVENTVALIDATION
2. POST con __EVENTTARGET="ctl00$Content$Grid", __EVENTARGUMENT="Page$2"
3. Del response → Extraer NUEVOS __VIEWSTATE, __EVENTVALIDATION
4. POST con los nuevos valores y __EVENTARGUMENT="Page$3"
5. Repetir...
```

```python
def get_hidden_fields(soup):
    """Extrae TODOS los hidden inputs de ASP.NET"""
    fields = {}
    for tag in soup.find_all('input', type='hidden'):
        if tag.get('name') and tag.get('value'):
            fields[tag['name']] = tag.get('value', '')
    return fields
```

## Retry y Timeouts

```python
import tenacity
from tenacity import retry, stop_after_attempt, wait_exponential

@retry(
    stop=stop_after_attempt(5),
    wait=wait_exponential(multiplier=2, min=4, max=60),
    retry=retry_if_exception_type((TimeoutError, ConnectionError))
)
def scrape_with_retry(page, url):
    page.goto(url, timeout=60000, wait_until="domcontentloaded")
    return page.content()
```

**Timeouts recomendados para ASP.NET**:
- 60s para páginas pesadas (default 30s no alcanza)
- Usar `domcontentloaded` en vez de `networkidle` (ASP.NET tiene polling activo)

## Problemas Comunes y Soluciones

| Problema | Solución |
|----------|----------|
| "Invalid ViewState" | Extraer __VIEWSTATE del response ANTES del siguiente POST |
| Timeout en paginación | Usar `domcontentloaded` en vez de `networkidle` |
| 403 Forbidden | Agregar stealth, cambiar user-agent, revisar headers |
| Portal siempre offline | Verificar cwd en subprocess, variables de entorno |
| "Connection closed" | Agregar `--disable-blink-features=AutomationControlled` |

## Configuración Stealth en Playwright

```python
page.add_init_script("""
    Object.defineProperty(navigator, 'webdriver', { get: () => undefined });
    Object.defineProperty(navigator, 'plugins', { get: () => [1, 2, 3, 4, 5] });

From RamonsDka/the-architect-overlay, Apache-2.0.

More from RamonsDka/the-architect-overlay

Signals

Stars
2
Forks
0
Open issues
0
Last commit (this folder)
Apr 19, 2026 (6 months ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.0
License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from gentleman-programming

Cite this page

asp-net-scraping skill. Agent Mart. https://agentmart.dev/skills/ramonsdka-asp-net-scraping (last updated 2026-10-24)