youber 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- youber-0.1.0/CHANGELOG.md +43 -0
- youber-0.1.0/LICENSE +21 -0
- youber-0.1.0/MANIFEST.in +16 -0
- youber-0.1.0/PKG-INFO +143 -0
- youber-0.1.0/README.md +108 -0
- youber-0.1.0/docs/ACCESSIBILITY.md +125 -0
- youber-0.1.0/docs/ANTI_BOT_RESEARCH.md +111 -0
- youber-0.1.0/docs/ARCHITECTURE.md +59 -0
- youber-0.1.0/docs/CLIENT.md +98 -0
- youber-0.1.0/docs/EXAMPLES.md +76 -0
- youber-0.1.0/docs/MCP_SERVER.md +149 -0
- youber-0.1.0/docs/PUBLISHING.md +90 -0
- youber-0.1.0/docs/RESEARCH.md +68 -0
- youber-0.1.0/docs/SANDBOX.md +115 -0
- youber-0.1.0/docs/USE_CASES.md +41 -0
- youber-0.1.0/examples/README.md +7 -0
- youber-0.1.0/examples/__init__.py +1 -0
- youber-0.1.0/examples/__pycache__/__init__.cpython-312.pyc +0 -0
- youber-0.1.0/examples/__pycache__/audit_github.cpython-312.pyc +0 -0
- youber-0.1.0/examples/__pycache__/audit_google.cpython-312.pyc +0 -0
- youber-0.1.0/examples/__pycache__/audit_youtube.cpython-312.pyc +0 -0
- youber-0.1.0/examples/__pycache__/batch_audit.cpython-312.pyc +0 -0
- youber-0.1.0/examples/__pycache__/custom_audit.cpython-312.pyc +0 -0
- youber-0.1.0/examples/audit_github.py +68 -0
- youber-0.1.0/examples/audit_google.py +68 -0
- youber-0.1.0/examples/audit_youtube.py +68 -0
- youber-0.1.0/examples/batch_audit.py +107 -0
- youber-0.1.0/examples/custom_audit.py +119 -0
- youber-0.1.0/examples/research_demo.py +123 -0
- youber-0.1.0/examples/urls.csv +4 -0
- youber-0.1.0/pyproject.toml +72 -0
- youber-0.1.0/requirements.txt +14 -0
- youber-0.1.0/setup.cfg +4 -0
- youber-0.1.0/src/youber/__init__.py +9 -0
- youber-0.1.0/src/youber/accessibility/__init__.py +28 -0
- youber-0.1.0/src/youber/accessibility/axe_runner.py +163 -0
- youber-0.1.0/src/youber/accessibility/recommendations.py +196 -0
- youber-0.1.0/src/youber/accessibility/reporters.py +132 -0
- youber-0.1.0/src/youber/accessibility/wcag.py +160 -0
- youber-0.1.0/src/youber/assets/axe.min.js +12 -0
- youber-0.1.0/src/youber/cli.py +162 -0
- youber-0.1.0/src/youber/client/__init__.py +6 -0
- youber-0.1.0/src/youber/client/interactive.py +151 -0
- youber-0.1.0/src/youber/client/session.py +97 -0
- youber-0.1.0/src/youber/client/tools.py +114 -0
- youber-0.1.0/src/youber/console.py +20 -0
- youber-0.1.0/src/youber/core/__init__.py +11 -0
- youber-0.1.0/src/youber/core/browser.py +193 -0
- youber-0.1.0/src/youber/core/exceptions.py +23 -0
- youber-0.1.0/src/youber/core/fixtures.py +60 -0
- youber-0.1.0/src/youber/core/logging.py +65 -0
- youber-0.1.0/src/youber/mcp/__init__.py +18 -0
- youber-0.1.0/src/youber/mcp/models/__init__.py +15 -0
- youber-0.1.0/src/youber/mcp/models/responses.py +80 -0
- youber-0.1.0/src/youber/mcp/server.py +212 -0
- youber-0.1.0/src/youber/mcp/tools/__init__.py +15 -0
- youber-0.1.0/src/youber/mcp/tools/accessibility.py +49 -0
- youber-0.1.0/src/youber/mcp/tools/navigation.py +81 -0
- youber-0.1.0/src/youber/mcp/tools/sandbox.py +50 -0
- youber-0.1.0/src/youber/sandbox/__init__.py +22 -0
- youber-0.1.0/src/youber/sandbox/device.py +113 -0
- youber-0.1.0/src/youber/sandbox/geolocation.py +131 -0
- youber-0.1.0/src/youber/sandbox/network.py +134 -0
- youber-0.1.0/src/youber/settings.py +89 -0
- youber-0.1.0/src/youber/ux/__init__.py +29 -0
- youber-0.1.0/src/youber/ux/heatmap.py +137 -0
- youber-0.1.0/src/youber/ux/journey.py +159 -0
- youber-0.1.0/src/youber/ux/patterns.py +173 -0
- youber-0.1.0/src/youber/ux/report.py +113 -0
- youber-0.1.0/src/youber.egg-info/PKG-INFO +143 -0
- youber-0.1.0/src/youber.egg-info/SOURCES.txt +87 -0
- youber-0.1.0/src/youber.egg-info/dependency_links.txt +1 -0
- youber-0.1.0/src/youber.egg-info/entry_points.txt +4 -0
- youber-0.1.0/src/youber.egg-info/requires.txt +15 -0
- youber-0.1.0/src/youber.egg-info/top_level.txt +1 -0
- youber-0.1.0/tests/conftest.py +15 -0
- youber-0.1.0/tests/fixtures/accessible.html +19 -0
- youber-0.1.0/tests/fixtures/site/about.html +28 -0
- youber-0.1.0/tests/fixtures/site/contact.html +22 -0
- youber-0.1.0/tests/fixtures/site/index.html +18 -0
- youber-0.1.0/tests/test_accessibility.py +124 -0
- youber-0.1.0/tests/test_browser.py +79 -0
- youber-0.1.0/tests/test_examples.py +45 -0
- youber-0.1.0/tests/test_interactive.py +38 -0
- youber-0.1.0/tests/test_mcp_client.py +93 -0
- youber-0.1.0/tests/test_mcp_server.py +78 -0
- youber-0.1.0/tests/test_sandbox.py +109 -0
- youber-0.1.0/tests/test_settings.py +24 -0
- youber-0.1.0/tests/test_ux.py +124 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Todos los cambios relevantes del proyecto se documentan aquí.
|
|
4
|
+
El formato sigue [Keep a Changelog](https://keepachangelog.com/es/1.1.0/) y el
|
|
5
|
+
proyecto usa [Versionado Semántico](https://semver.org/lang/es/).
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-08-29
|
|
8
|
+
|
|
9
|
+
Primera publicación (Alpha).
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **Núcleo Playwright** (`youber/core`): `BrowserManager` con contextos
|
|
14
|
+
aislados, excepciones propias, logging con loguru y fixture de ejemplo.
|
|
15
|
+
- **Servidor MCP** (`youber/mcp`): MCPServer (MCP SDK 2.x) con herramientas
|
|
16
|
+
`open_page`, `navigate_to`, `get_page_info`, `audit_accessibility`,
|
|
17
|
+
`simulate_geolocation`, `simulate_network` y `simulate_device`; sesiones de
|
|
18
|
+
navegador persistentes.
|
|
19
|
+
- **Cliente MCP** (`youber/client`): `create_mcp_session` (stdio/SSE/
|
|
20
|
+
streamable-http con reintentos), `MCPTools` y CLI interactiva
|
|
21
|
+
`youber-client` (rich).
|
|
22
|
+
- **Accesibilidad** (`youber/accessibility`): `AxeRunner` con caché y
|
|
23
|
+
opciones, mapeo de 70+ reglas a WCAG 2.1/2.2, reportes Markdown/JSON/resumen
|
|
24
|
+
y recomendaciones con recursos educativos. axe-core vendored (offline).
|
|
25
|
+
- **UX** (`youber/ux`): detección de patrones de navegación, heatmaps de
|
|
26
|
+
scroll/clics, trazado de user journeys con puntos de abandono y reportes.
|
|
27
|
+
- **Sandbox** (`youber/sandbox`): simulaciones de geolocalización (10
|
|
28
|
+
regiones), red (5 perfiles vía CDP) y dispositivos (iPhone/Pixel/iPad/Desktop).
|
|
29
|
+
- **CLI**: `youber-audit` (auditoría rápida) y `youber-sandbox` (demo de
|
|
30
|
+
simulaciones).
|
|
31
|
+
- **Ejemplos** en `examples/`: auditorías de google/youtube/github, auditoría
|
|
32
|
+
personalizada, batch por CSV y demo observacional anti-bot.
|
|
33
|
+
- **Documentación**: ACCESSIBILITY, MCP_SERVER, CLIENT, SANDBOX, EXAMPLES,
|
|
34
|
+
ANTI_BOT_RESEARCH, RESEARCH y PUBLISHING.
|
|
35
|
+
- **CI/CD**: GitHub Actions (Python 3.11/3.12, ruff, mypy, pytest con
|
|
36
|
+
cobertura), configuración ruff/mypy y pre-commit hooks.
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
|
|
40
|
+
- Empaquetado: `config/` movido dentro del paquete (`youber/settings.py`).
|
|
41
|
+
- Compatibilidad Windows: consola UTF-8 para emojis y slugs saneados.
|
|
42
|
+
- Tests e2e: gestión de sesión MCP dentro del test (compatibilidad
|
|
43
|
+
pytest-asyncio + anyio) y aislamiento de variables de entorno.
|
youber-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Skyzo (contribuidores de BARF)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
youber-0.1.0/MANIFEST.in
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# MANIFEST.in — ficheros incluidos en el sdist (además de los del paquete)
|
|
2
|
+
|
|
3
|
+
include README.md
|
|
4
|
+
include LICENSE
|
|
5
|
+
include pyproject.toml
|
|
6
|
+
include CHANGELOG.md
|
|
7
|
+
|
|
8
|
+
# Asset vendored de axe-core (auditorías offline deterministas)
|
|
9
|
+
recursive-include src/youber/assets *
|
|
10
|
+
|
|
11
|
+
# Documentación y ejemplos
|
|
12
|
+
recursive-include examples *
|
|
13
|
+
recursive-include docs *
|
|
14
|
+
|
|
15
|
+
exclude .env.example
|
|
16
|
+
exclude .gitignore
|
youber-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: youber
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Browser Automation Research Framework - Framework educativo para investigación de navegación y accesibilidad
|
|
5
|
+
Author-email: Skyzo <skyzos@users.noreply.github.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/yourusername/youber
|
|
8
|
+
Project-URL: Repository, https://github.com/yourusername/youber
|
|
9
|
+
Project-URL: Documentation, https://github.com/yourusername/youber/docs
|
|
10
|
+
Keywords: automation,playwright,accessibility,research,mcp
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: playwright>=1.45
|
|
21
|
+
Requires-Dist: python-dotenv>=1.0
|
|
22
|
+
Requires-Dist: pydantic>=2.7
|
|
23
|
+
Requires-Dist: loguru>=0.7
|
|
24
|
+
Requires-Dist: httpx>=0.27
|
|
25
|
+
Requires-Dist: mcp<3,>=2.0.0
|
|
26
|
+
Requires-Dist: rich>=13.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
32
|
+
Requires-Dist: mypy>=1.11; extra == "dev"
|
|
33
|
+
Requires-Dist: pre-commit>=3.0; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# BARF — Browser Automation Research Framework
|
|
37
|
+
|
|
38
|
+
> Framework **educativo** de automatización de navegadores para investigación, accesibilidad y estudio de UX.
|
|
39
|
+
> El nombre es horrible a propósito. El código, no. ⚙️
|
|
40
|
+
|
|
41
|
+
## Descripción
|
|
42
|
+
|
|
43
|
+
BARF es un framework educativo de automatización de navegadores construido
|
|
44
|
+
sobre **Playwright**, con:
|
|
45
|
+
|
|
46
|
+
- **Servidor MCP** (Model Context Protocol, SDK 2.x) para agentes de IA
|
|
47
|
+
- **Auditoría de accesibilidad** (axe-core + mapeo WCAG 2.1/2.2 + reportes)
|
|
48
|
+
- **Estudio de UX** (patrones de navegación, heatmaps, user journeys)
|
|
49
|
+
- **Sandbox de simulaciones** (geolocalización, red, dispositivos)
|
|
50
|
+
- **CLI**: `youber-audit`, `youber-sandbox` y `youber-client` (interactiva)
|
|
51
|
+
|
|
52
|
+
## Propósito educativo
|
|
53
|
+
|
|
54
|
+
- Enseñar cómo funcionan Playwright, MCP y los sistemas anti-bot
|
|
55
|
+
- Auditar accesibilidad web de forma reproducible (WCAG)
|
|
56
|
+
- Estudiar cómo los usuarios interactúan con las interfaces
|
|
57
|
+
- Aprender a integrar navegadores con agentes de IA vía MCP
|
|
58
|
+
|
|
59
|
+
## Restricciones (no negociables)
|
|
60
|
+
|
|
61
|
+
- ❌ No manipular métricas (visualizaciones, likes, suscriptores, watch time)
|
|
62
|
+
- ❌ No evadir sistemas de seguridad ni anti-bot en entornos reales
|
|
63
|
+
- ❌ No spam, scraping abusivo ni contenido malicioso
|
|
64
|
+
- ✅ Código open source y con fines educativos
|
|
65
|
+
- ✅ Respetar robots.txt y términos de servicio
|
|
66
|
+
- ✅ Solo se prueban propiedades propias o con permiso explícito
|
|
67
|
+
|
|
68
|
+
## Instalación
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
python -m venv .venv
|
|
72
|
+
# Windows: .venv\Scripts\activate | Linux/macOS: source .venv/bin/activate
|
|
73
|
+
pip install -e ".[dev]"
|
|
74
|
+
playwright install chromium
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Ejemplos rápidos
|
|
78
|
+
|
|
79
|
+
Auditoría de accesibilidad:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
youber-audit https://example.com
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
CLI interactiva (cliente MCP):
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
youber-client
|
|
89
|
+
> audit https://example.com
|
|
90
|
+
> geo JP https://example.com
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Desde código:
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
import asyncio
|
|
97
|
+
from youber.accessibility.axe_runner import AxeRunner
|
|
98
|
+
from youber.core.browser import BrowserManager
|
|
99
|
+
|
|
100
|
+
async def main():
|
|
101
|
+
manager = BrowserManager(headless=True)
|
|
102
|
+
await manager.launch()
|
|
103
|
+
context = await manager.new_context()
|
|
104
|
+
page = await manager.new_page(context)
|
|
105
|
+
await manager.navigate(page, "https://example.com")
|
|
106
|
+
results = await AxeRunner().run_axe(page)
|
|
107
|
+
print(f"Violaciones: {results.total_violations}")
|
|
108
|
+
await manager.close()
|
|
109
|
+
|
|
110
|
+
asyncio.run(main())
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Documentación
|
|
114
|
+
|
|
115
|
+
- [Accesibilidad](docs/ACCESSIBILITY.md) — auditoría WCAG con axe-core
|
|
116
|
+
- [Servidor MCP](docs/MCP_SERVER.md) — herramientas del servidor
|
|
117
|
+
- [Cliente MCP](docs/CLIENT.md) — conexión al servidor desde código/terminal
|
|
118
|
+
- [Sandbox](docs/SANDBOX.md) — simulaciones de entorno
|
|
119
|
+
- [Investigación anti-bot](docs/ANTI_BOT_RESEARCH.md) — estudio educativo
|
|
120
|
+
- [Guía de laboratorio](docs/RESEARCH.md) — experimentos observacionales
|
|
121
|
+
- [Ejemplos](docs/EXAMPLES.md) — guía de los ejemplos
|
|
122
|
+
- [Publicación en PyPI](docs/PUBLISHING.md) — cómo publicar el paquete
|
|
123
|
+
|
|
124
|
+
## Calidad
|
|
125
|
+
|
|
126
|
+
- CI: GitHub Actions (Python 3.11/3.12) — lint, type-check, tests, coverage
|
|
127
|
+
- `ruff check src/ tests/ examples/`
|
|
128
|
+
- `mypy src/`
|
|
129
|
+
- `pytest tests/ -v --cov=youber`
|
|
130
|
+
|
|
131
|
+
## Contribución
|
|
132
|
+
|
|
133
|
+
1. Haz un fork del repositorio.
|
|
134
|
+
2. Crea una rama (`git checkout -b feature/nueva-funcionalidad`).
|
|
135
|
+
3. Asegúrate de que pasan `ruff`, `mypy` y `pytest`.
|
|
136
|
+
4. Abre un pull request.
|
|
137
|
+
|
|
138
|
+
Proyecto educativo: aporta ejemplos, documentación, tests o nuevas
|
|
139
|
+
herramientas de estudio.
|
|
140
|
+
|
|
141
|
+
## Licencia
|
|
142
|
+
|
|
143
|
+
MIT — ver [LICENSE](LICENSE).
|
youber-0.1.0/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# BARF — Browser Automation Research Framework
|
|
2
|
+
|
|
3
|
+
> Framework **educativo** de automatización de navegadores para investigación, accesibilidad y estudio de UX.
|
|
4
|
+
> El nombre es horrible a propósito. El código, no. ⚙️
|
|
5
|
+
|
|
6
|
+
## Descripción
|
|
7
|
+
|
|
8
|
+
BARF es un framework educativo de automatización de navegadores construido
|
|
9
|
+
sobre **Playwright**, con:
|
|
10
|
+
|
|
11
|
+
- **Servidor MCP** (Model Context Protocol, SDK 2.x) para agentes de IA
|
|
12
|
+
- **Auditoría de accesibilidad** (axe-core + mapeo WCAG 2.1/2.2 + reportes)
|
|
13
|
+
- **Estudio de UX** (patrones de navegación, heatmaps, user journeys)
|
|
14
|
+
- **Sandbox de simulaciones** (geolocalización, red, dispositivos)
|
|
15
|
+
- **CLI**: `youber-audit`, `youber-sandbox` y `youber-client` (interactiva)
|
|
16
|
+
|
|
17
|
+
## Propósito educativo
|
|
18
|
+
|
|
19
|
+
- Enseñar cómo funcionan Playwright, MCP y los sistemas anti-bot
|
|
20
|
+
- Auditar accesibilidad web de forma reproducible (WCAG)
|
|
21
|
+
- Estudiar cómo los usuarios interactúan con las interfaces
|
|
22
|
+
- Aprender a integrar navegadores con agentes de IA vía MCP
|
|
23
|
+
|
|
24
|
+
## Restricciones (no negociables)
|
|
25
|
+
|
|
26
|
+
- ❌ No manipular métricas (visualizaciones, likes, suscriptores, watch time)
|
|
27
|
+
- ❌ No evadir sistemas de seguridad ni anti-bot en entornos reales
|
|
28
|
+
- ❌ No spam, scraping abusivo ni contenido malicioso
|
|
29
|
+
- ✅ Código open source y con fines educativos
|
|
30
|
+
- ✅ Respetar robots.txt y términos de servicio
|
|
31
|
+
- ✅ Solo se prueban propiedades propias o con permiso explícito
|
|
32
|
+
|
|
33
|
+
## Instalación
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
python -m venv .venv
|
|
37
|
+
# Windows: .venv\Scripts\activate | Linux/macOS: source .venv/bin/activate
|
|
38
|
+
pip install -e ".[dev]"
|
|
39
|
+
playwright install chromium
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Ejemplos rápidos
|
|
43
|
+
|
|
44
|
+
Auditoría de accesibilidad:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
youber-audit https://example.com
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
CLI interactiva (cliente MCP):
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
youber-client
|
|
54
|
+
> audit https://example.com
|
|
55
|
+
> geo JP https://example.com
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Desde código:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
import asyncio
|
|
62
|
+
from youber.accessibility.axe_runner import AxeRunner
|
|
63
|
+
from youber.core.browser import BrowserManager
|
|
64
|
+
|
|
65
|
+
async def main():
|
|
66
|
+
manager = BrowserManager(headless=True)
|
|
67
|
+
await manager.launch()
|
|
68
|
+
context = await manager.new_context()
|
|
69
|
+
page = await manager.new_page(context)
|
|
70
|
+
await manager.navigate(page, "https://example.com")
|
|
71
|
+
results = await AxeRunner().run_axe(page)
|
|
72
|
+
print(f"Violaciones: {results.total_violations}")
|
|
73
|
+
await manager.close()
|
|
74
|
+
|
|
75
|
+
asyncio.run(main())
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Documentación
|
|
79
|
+
|
|
80
|
+
- [Accesibilidad](docs/ACCESSIBILITY.md) — auditoría WCAG con axe-core
|
|
81
|
+
- [Servidor MCP](docs/MCP_SERVER.md) — herramientas del servidor
|
|
82
|
+
- [Cliente MCP](docs/CLIENT.md) — conexión al servidor desde código/terminal
|
|
83
|
+
- [Sandbox](docs/SANDBOX.md) — simulaciones de entorno
|
|
84
|
+
- [Investigación anti-bot](docs/ANTI_BOT_RESEARCH.md) — estudio educativo
|
|
85
|
+
- [Guía de laboratorio](docs/RESEARCH.md) — experimentos observacionales
|
|
86
|
+
- [Ejemplos](docs/EXAMPLES.md) — guía de los ejemplos
|
|
87
|
+
- [Publicación en PyPI](docs/PUBLISHING.md) — cómo publicar el paquete
|
|
88
|
+
|
|
89
|
+
## Calidad
|
|
90
|
+
|
|
91
|
+
- CI: GitHub Actions (Python 3.11/3.12) — lint, type-check, tests, coverage
|
|
92
|
+
- `ruff check src/ tests/ examples/`
|
|
93
|
+
- `mypy src/`
|
|
94
|
+
- `pytest tests/ -v --cov=youber`
|
|
95
|
+
|
|
96
|
+
## Contribución
|
|
97
|
+
|
|
98
|
+
1. Haz un fork del repositorio.
|
|
99
|
+
2. Crea una rama (`git checkout -b feature/nueva-funcionalidad`).
|
|
100
|
+
3. Asegúrate de que pasan `ruff`, `mypy` y `pytest`.
|
|
101
|
+
4. Abre un pull request.
|
|
102
|
+
|
|
103
|
+
Proyecto educativo: aporta ejemplos, documentación, tests o nuevas
|
|
104
|
+
herramientas de estudio.
|
|
105
|
+
|
|
106
|
+
## Licencia
|
|
107
|
+
|
|
108
|
+
MIT — ver [LICENSE](LICENSE).
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Accesibilidad — BARF
|
|
2
|
+
|
|
3
|
+
Guía del módulo de auditoría de accesibilidad: cómo ejecutarla, cómo leer los
|
|
4
|
+
reportes y cómo usar el mapeo WCAG y las recomendaciones automáticas.
|
|
5
|
+
|
|
6
|
+
## ¿Qué es WCAG?
|
|
7
|
+
|
|
8
|
+
Las **Web Content Accessibility Guidelines (WCAG)** son el estándar W3C para
|
|
9
|
+
accesibilidad web. Se organizan en 4 principios:
|
|
10
|
+
|
|
11
|
+
1. **Perceptible** (1.x) — la información debe poder percibirse (alternativas
|
|
12
|
+
de texto, contraste, subtítulos...).
|
|
13
|
+
2. **Operable** (2.x) — la interfaz debe poder usarse (teclado, tiempo,
|
|
14
|
+
navegación, objetivos táctiles...).
|
|
15
|
+
3. **Comprensible** (3.x) — la información y el funcionamiento deben ser
|
|
16
|
+
comprensibles (idioma, etiquetas, ayuda...).
|
|
17
|
+
4. **Robusto** (4.x) — el contenido debe funcionar con tecnologías de apoyo
|
|
18
|
+
(ARIA, nombres accesibles, ids únicos...).
|
|
19
|
+
|
|
20
|
+
Cada criterio tiene un nivel de conformidad: **A** (mínimo), **AA**
|
|
21
|
+
(recomendado) y **AAA** (avanzado).
|
|
22
|
+
|
|
23
|
+
## Cómo auditar
|
|
24
|
+
|
|
25
|
+
### Con la CLI (`youber-audit`)
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
youber-audit https://www.google.com
|
|
29
|
+
youber-audit https://example.com --rules color-contrast label --impact serious
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Guarda el reporte Markdown en `reports/` y muestra el resumen en consola.
|
|
33
|
+
|
|
34
|
+
### Con los ejemplos
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
python examples/audit_google.py
|
|
38
|
+
python examples/custom_audit.py --url https://example.com --rules color-contrast
|
|
39
|
+
python examples/batch_audit.py --csv examples/urls.csv
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Con código
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
import asyncio
|
|
46
|
+
from youber.accessibility.axe_runner import AxeRunner
|
|
47
|
+
from youber.accessibility.reporters import generate_json_report, generate_summary
|
|
48
|
+
from youber.core.browser import BrowserManager
|
|
49
|
+
|
|
50
|
+
async def main():
|
|
51
|
+
manager = BrowserManager(headless=True)
|
|
52
|
+
await manager.launch()
|
|
53
|
+
context = await manager.new_context()
|
|
54
|
+
page = await manager.new_page(context)
|
|
55
|
+
await manager.navigate(page, "https://example.com")
|
|
56
|
+
|
|
57
|
+
runner = AxeRunner()
|
|
58
|
+
results = await runner.run_axe(page, {"impactLevels": ["critical", "serious"]})
|
|
59
|
+
print(generate_summary(results))
|
|
60
|
+
data = generate_json_report(results) # integrable con otras herramientas
|
|
61
|
+
|
|
62
|
+
await manager.close()
|
|
63
|
+
|
|
64
|
+
asyncio.run(main())
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Desde MCP
|
|
68
|
+
|
|
69
|
+
El servidor MCP expone `audit_accessibility(page_id)` (ver
|
|
70
|
+
[MCP_SERVER.md](MCP_SERVER.md)); la implementación delega en `AxeRunner`.
|
|
71
|
+
|
|
72
|
+
## Opciones de `run_axe`
|
|
73
|
+
|
|
74
|
+
| Opción | Descripción | Ejemplo |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `context` | Selector CSS o definición de contexto | `"#main"`, `{"include": [["#main"]]}` |
|
|
77
|
+
| `rules` | Solo estas reglas | `["color-contrast", "label"]` |
|
|
78
|
+
| `tags` | Solo reglas con estos tags | `["wcag2a", "wcag2aa"]` |
|
|
79
|
+
| `impactLevels` | Filtrar por impacto | `["critical", "serious"]` |
|
|
80
|
+
|
|
81
|
+
## Cómo leer el reporte Markdown
|
|
82
|
+
|
|
83
|
+
Cada violación incluye: **ID** de la regla, **impacto** (🔴 critical, 🟠
|
|
84
|
+
serious, 🟡 moderate, 🔵 minor), **descripción**, **elementos afectados**
|
|
85
|
+
(selectores) y **enlace a la quickref WCAG** del criterio correspondiente.
|
|
86
|
+
|
|
87
|
+
## Reglas comunes y su criterio WCAG
|
|
88
|
+
|
|
89
|
+
| Regla axe | WCAG | Qué comprueba |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| `color-contrast` | 1.4.3 (AA) | Contraste texto/fondo ≥ 4.5:1 |
|
|
92
|
+
| `image-alt` | 1.1.1 (A) | Texto alternativo en imágenes |
|
|
93
|
+
| `html-has-lang` | 3.1.1 (A) | Atributo `lang` en `<html>` |
|
|
94
|
+
| `document-title` | 2.4.2 (A) | Título descriptivo de la página |
|
|
95
|
+
| `link-name` | 2.4.4 (A) | Nombre accesible en enlaces |
|
|
96
|
+
| `label` | 1.3.1 (A) | Etiquetas en campos de formulario |
|
|
97
|
+
| `region` | 1.3.1 (A) | Contenido agrupado en landmarks |
|
|
98
|
+
| `heading-order` | 1.3.1 (A) | Encabezados sin saltos de nivel |
|
|
99
|
+
| `frame-title` | 2.4.1 (A) | Título en `<iframe>` |
|
|
100
|
+
| `target-size` | 2.5.8 (AA, WCAG 2.2) | Objetivos táctiles ≥ 24x24 px |
|
|
101
|
+
|
|
102
|
+
El mapeo completo está en `src/youber/accessibility/wcag.py` (más de 70
|
|
103
|
+
reglas). Nota: el mapeo es orientativo; una regla de axe puede cubrir varios
|
|
104
|
+
criterios.
|
|
105
|
+
|
|
106
|
+
## Recomendaciones y aprendizaje
|
|
107
|
+
|
|
108
|
+
- `get_fix_suggestion(rule_id, element)` — sugerencia concreta de corrección.
|
|
109
|
+
- `get_learning_resource(rule_id)` — recurso educativo (MDN, WebAIM, W3C).
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
from youber.accessibility.recommendations import get_fix_suggestion, get_learning_resource
|
|
113
|
+
|
|
114
|
+
print(get_fix_suggestion("color-contrast", "#boton"))
|
|
115
|
+
# Aumenta el contraste entre texto y fondo hasta al menos 4.5:1...
|
|
116
|
+
print(get_learning_resource("color-contrast"))
|
|
117
|
+
# https://webaim.org/articles/contrast/
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Limitaciones
|
|
121
|
+
|
|
122
|
+
- axe-core detecta **automáticamente comprobables**; hay criterios WCAG que
|
|
123
|
+
requieren revisión manual (los resultados `incomplete`).
|
|
124
|
+
- Una auditoría automática no equivale a una evaluación de conformidad
|
|
125
|
+
completa (para eso se necesita una auditoría humana experta).
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Investigación anti-bot — BARF
|
|
2
|
+
|
|
3
|
+
> Documento **educativo**. Estudiar cómo funcionan los sistemas anti-bot sirve
|
|
4
|
+
> para entender la web, defender la privacidad y construir tests honestos.
|
|
5
|
+
> BARF **no** proporciona mecanismos de evasión: la investigación se hace
|
|
6
|
+
> siempre en laboratorio, observando señales, sin saltarse ninguna protección.
|
|
7
|
+
|
|
8
|
+
## Introducción: ¿qué son los sistemas anti-bot?
|
|
9
|
+
|
|
10
|
+
Los sistemas anti-bot protegen servicios web de tráfico automatizado
|
|
11
|
+
indeseado: scraping masivo, fraude, spam, creación de cuentas falsas o
|
|
12
|
+
manipulación de métricas. Para distinguir humanos de programas analizan
|
|
13
|
+
múltiples señales del cliente (navegador) y del tráfico (red), y deciden si
|
|
14
|
+
bloquean, ralentizan o desafían la petición.
|
|
15
|
+
|
|
16
|
+
Entender estas señales es relevante para:
|
|
17
|
+
|
|
18
|
+
- **Desarrolladores**: saber qué expone su propio navegador al automatizar
|
|
19
|
+
tests (y por qué algunos tests se comportan distinto en CI).
|
|
20
|
+
- **Investigadores de privacidad**: cuantificar la información que un sitio
|
|
21
|
+
puede recolectar sin permiso.
|
|
22
|
+
- **Educadores**: enseñar cómo funciona la detección y por qué los
|
|
23
|
+
anti-cheats y anti-fraude existen.
|
|
24
|
+
|
|
25
|
+
## Técnicas comunes
|
|
26
|
+
|
|
27
|
+
### 1. Reputación de IP y bloqueo
|
|
28
|
+
|
|
29
|
+
- Listas negras de IPs de centros de datos y proveedores cloud.
|
|
30
|
+
- Rate limiting por IP/UA/cuenta.
|
|
31
|
+
- Análisis de geolocalización de la IP frente a la zona horaria del cliente.
|
|
32
|
+
- El tráfico residencial es más difícil de distinguir; por eso algunos usan
|
|
33
|
+
proxies residenciales — **técnica que BARF no emplea para evadir**.
|
|
34
|
+
|
|
35
|
+
### 2. Browser fingerprinting
|
|
36
|
+
|
|
37
|
+
El navegador expone decenas de señales que, combinadas, forman una huella
|
|
38
|
+
casi única:
|
|
39
|
+
|
|
40
|
+
- `user-agent`, `platform`, `language(s)`
|
|
41
|
+
- Resolución de pantalla, colorDepth, `deviceMemory`, `hardwareConcurrency`
|
|
42
|
+
- Zona horaria (`Intl`), fuentes instaladas, plugins
|
|
43
|
+
- Render de **canvas** (huella gráfica muy estable) y WebGL
|
|
44
|
+
- APIs como `navigator.webdriver` (marcada por WebDriver/Playwright)
|
|
45
|
+
|
|
46
|
+
### 3. Comportamiento humano vs automatizado
|
|
47
|
+
|
|
48
|
+
- Velocidad y trayectoria del ratón (curvas, aceleración).
|
|
49
|
+
- Patrones de scroll y tiempos entre acciones (dwell, lectura).
|
|
50
|
+
- Orden de foco y eventos de teclado (keystroke dynamics).
|
|
51
|
+
- Coherencia temporal: un "humano" que actúa 24/7 o a velocidad constante
|
|
52
|
+
es sospechoso.
|
|
53
|
+
|
|
54
|
+
### 4. CAPTCHA y desafíos
|
|
55
|
+
|
|
56
|
+
- Desafíos cognitivos (texto, imágenes) o invisibles (honeypots, pruebas de
|
|
57
|
+
comportamiento).
|
|
58
|
+
- Los retos modernos evalúan el historial de la sesión y el contexto del
|
|
59
|
+
navegador, no solo la respuesta.
|
|
60
|
+
|
|
61
|
+
## Cómo se estudian en laboratorio
|
|
62
|
+
|
|
63
|
+
Con BARF (entorno controlado, sin evasión):
|
|
64
|
+
|
|
65
|
+
1. **Observación de señales** — `examples/research_demo.py` recopila las
|
|
66
|
+
señales que un sitio puede ver (UA, webdriver, canvas hash, timezone...)
|
|
67
|
+
y explica para qué se usan.
|
|
68
|
+
2. **Métricas de detección** — en un sitio propio o de prueba, mide:
|
|
69
|
+
- ¿Cambia la respuesta según el user agent?
|
|
70
|
+
- ¿Qué peticiones bloquea un WAF con reglas conocidas?
|
|
71
|
+
- ¿Qué señales expone un navegador automatizado frente a uno normal?
|
|
72
|
+
3. **Análisis de señales** — compara navegador headless vs headed, con/sin
|
|
73
|
+
permisos, distintos dispositivos (`youber-sandbox`), y documenta qué
|
|
74
|
+
cambia.
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
python examples/research_demo.py --url https://example.com
|
|
78
|
+
youber-sandbox --url https://example.com --device iPhone --region JP
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Limitaciones y ética
|
|
82
|
+
|
|
83
|
+
- **Uso educativo**: el conocimiento aquí descrito es para entender y
|
|
84
|
+
defender, no para saltarse protecciones en entornos reales.
|
|
85
|
+
- **No evasión**: BARF no incluye ni documenta técnicas de evasión
|
|
86
|
+
operativas (patches de fingerprinting, rotación de identidades, etc.).
|
|
87
|
+
- **Respeto a términos de servicio**: solo se prueban propiedades propias o
|
|
88
|
+
con permiso explícito; se respeta robots.txt y el uso razonable.
|
|
89
|
+
- **Consentimiento y volumen**: nada de scraping a escala, nada de ocultar
|
|
90
|
+
actividad.
|
|
91
|
+
|
|
92
|
+
## Enlaces a recursos académicos
|
|
93
|
+
|
|
94
|
+
- [W3C — Web Accessibility & User Agent (privacidad)](https://www.w3.org/)
|
|
95
|
+
- [Electronic Frontier Foundation — Panopticlick (huella del navegador)](https://panopticlick.eff.org/)
|
|
96
|
+
- [Tor Project — Fingerprinting research](https://www.torproject.org/about/history/)
|
|
97
|
+
- [OWASP — Automated Threats to Web Applications](https://owasp.org/www-project-automated-threats-to-web-applications/)
|
|
98
|
+
- [MDN — Navigator API](https://developer.mozilla.org/es/docs/Web/API/Navigator)
|
|
99
|
+
- [W3C — WebDriver specification (señal `webdriver`)](https://www.w3.org/TR/webdriver1/)
|
|
100
|
+
- [Playwright — Emulation docs](https://playwright.dev/python/docs/emulation)
|
|
101
|
+
|
|
102
|
+
## Referencia rápida de señales (research_demo)
|
|
103
|
+
|
|
104
|
+
| Señal | Para qué se usa en detección |
|
|
105
|
+
|---|---|
|
|
106
|
+
| `navigator.webdriver` | Marca explícita de control automatizado |
|
|
107
|
+
| `user_agent` / `platform` | Identificar navegador/SO; inconsistencias |
|
|
108
|
+
| `canvas_hash` | Huella gráfica estable (fingerprint) |
|
|
109
|
+
| `timezone` | Cruzar con geolocalización de la IP |
|
|
110
|
+
| `plugins_count` | Entornos headless suelen reportar 0 |
|
|
111
|
+
| `hardware_concurrency` / `device_memory` | Detectar virtualización |
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Arquitectura Técnica — BARF
|
|
2
|
+
|
|
3
|
+
## Visión general
|
|
4
|
+
|
|
5
|
+
BARF se organiza en capas con una separación clara: la capa de automatización no sabe nada de política; la capa de política (guardrails) envuelve todo el tráfico.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
┌─────────────────────────────────────────────────┐
|
|
9
|
+
│ Capa MCP (servidor) │
|
|
10
|
+
│ tools: audit_accessibility, study_navigation, │
|
|
11
|
+
│ test_page, network_probe, learn_playwright
|
|
12
|
+
├─────────────────────────────────────────────────┤
|
|
13
|
+
│ Capa de investigación (módulos temáticos) │
|
|
14
|
+
│ accessibility · ux · education · devtools · net │
|
|
15
|
+
├─────────────────────────────────────────────────┤
|
|
16
|
+
│ Capa de automatización (Playwright) │
|
|
17
|
+
│ launch, contextos aislados, fixtures, helpers │
|
|
18
|
+
├─────────────────────────────────────────────────┤
|
|
19
|
+
│ Capa de política (guardrails) │
|
|
20
|
+
│ rate limit · allowlist · sandbox · auditoría │
|
|
21
|
+
└─────────────────────────────────────────────────┘
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Módulos propuestos
|
|
25
|
+
|
|
26
|
+
| Módulo | Responsabilidad | Tecnología |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| `barf/core` | Launch de navegadores, contextos aislados, fixtures, utilidades | Playwright sync/async |
|
|
29
|
+
| `barf/accessibility` | Auditoría: ARIA, contraste, foco, teclado, subtítulos | Playwright + axe-core (opcional) |
|
|
30
|
+
| `barf/ux` | Simulación de patrones de navegación, throttling de red, métricas de interacción | Playwright (`context.set_offline`, CDP) |
|
|
31
|
+
| `barf/network` | Sondeos de geolocalización/latencia en sandbox | Playwright + aiohttp |
|
|
32
|
+
| `barf/education` | Ejemplos comentados, materiales de taller, demos anti-bot en laboratorio | — |
|
|
33
|
+
| `barf/mcp` | Servidor MCP que expone las herramientas anteriores | `mcp` (Python SDK) |
|
|
34
|
+
| `barf/policy` | Rate limiting, allowlists, modo sandbox, log de auditoría | asyncio, sqlite/logging |
|
|
35
|
+
|
|
36
|
+
## Decisiones clave
|
|
37
|
+
|
|
38
|
+
1. **Python 3.11+** y el **SDK oficial de MCP** para el servidor; el núcleo usa Playwright para Python.
|
|
39
|
+
2. **Contextos aislados por tarea**: cada tarea lanza un contexto limpio (perfil temporal, sin cookies compartidas) — bueno para testing y para no contaminar datos.
|
|
40
|
+
3. **Guardrails en el núcleo, no en la periferia**: toda navegación pasa por `barf/policy` (límites por dominio, allowlist configurable, modo sandbox obligatorio para sondeos de red).
|
|
41
|
+
4. **Anti-bot solo en laboratorio**: `playwright-stealth` se documenta y se usa únicamente en un escenario local/aislado para estudiar detección; el código de producción no lo incluye.
|
|
42
|
+
5. **Auditoría**: cada acción automatizada se registra (qué, quién, cuándo, por qué, volumen) para mantener el proyecto transparente y reproducible.
|
|
43
|
+
|
|
44
|
+
## Política de seguridad (guardrails)
|
|
45
|
+
|
|
46
|
+
- **Sandbox por defecto**: sondeos de red/proxies corren en entorno aislado, sin cuentas reales.
|
|
47
|
+
- **Rate limiting**: límites de peticiones por dominio; se respeta robots.txt y uso razonable.
|
|
48
|
+
- **Allowlist**: solo dominios/propiedades autorizadas (propias o con permiso).
|
|
49
|
+
- **Sin acciones de engagement**: el framework nunca realiza likes, suscripciones, comentarios ni reproducciones sobre contenido de terceros.
|
|
50
|
+
- **Auditoría completa**: log persistente de toda actividad automatizada.
|
|
51
|
+
|
|
52
|
+
## Roadmap técnico
|
|
53
|
+
|
|
54
|
+
1. Estructura del repo + `pyproject.toml` + entorno (venv, `pip install -e .[dev]`)
|
|
55
|
+
2. `barf/core`: launch, contextos, fixture de ejemplo (abrir YouTube y volcar título)
|
|
56
|
+
3. `barf/mcp`: servidor con 2-3 herramientas (p. ej. `open_page`, `audit_accessibility`, `study_navigation`)
|
|
57
|
+
4. Módulo de accesibilidad con axe-core
|
|
58
|
+
5. Módulo de redes en sandbox
|
|
59
|
+
6. Docs finales + ejemplos de taller
|