COMPROBAR_ENTREGA.py
Archivo real del paquete para implementar la función. Descárgalo del ZIP para editarlo; no contiene claves privadas.
#!/usr/bin/env python3
"""Comprobación del paquete FINAL (sin Hostinger ni internet)."""
from pathlib import Path
import json, re, subprocess, sys
from html.parser import HTMLParser
root=Path(__file__).resolve().parent
files=list(root.rglob('*'))
class Links(HTMLParser):
def __init__(self):super().__init__();self.hrefs=[];self.canonical=None
def handle_starttag(self,tag,attrs):
if tag=='link' and dict(attrs).get('rel')=='canonical':self.canonical=dict(attrs).get('href','')
if tag=='a':
u=dict(attrs).get('href','')
if u.startswith('/') and not u.startswith('//'):self.hrefs.append(u.split('#')[0])
failed=[];checked=0
for f in (root/'web').rglob('*.html'):
html=f.read_text(encoding='utf8');p=Links();p.feed(html)
if not p.canonical or not p.canonical.startswith('https://appinitdev.com/'):failed.append('canonical '+str(f))
for path in p.hrefs:
if not path or path.startswith(('/datos/','/ia/catalogo/')) or path in ('/','/ia/identidad/','/ia/fuentes-oficiales/'):continue
dest=root/'web'/path.lstrip('/')/'index.html'
if not dest.exists() and path not in ('/directorios/','/crecimiento-apps/','/influenser/','/academy/'):
# Enlaces a otras secciones del sitio principal (no incluidas en el módulo) se omiten.
if path.startswith(('/mcp/','/ia/')):failed.append('enlace faltante '+path+' en '+f.name)
checked+=1
assert not failed,'\n'.join(failed[:20])
assert len(list((root/'web/mcp/tutoriales').glob('*/index.html')))>=18
for route in ('mcp/registro','mcp/codigo','mcp/diagnostico'):
assert (root/'web'/route/'index.html').is_file(), 'Falta '+route
assert (root/'mcp-cloudflare/worker.mjs').exists()
for script in ('AUDITORIA_PUBLICACION.py','AUDITORIA_RASTREO_ONLINE.py','SINCRONIZAR_SITEMAP.py','PREPARAR_HOSTINGER.py','PRUEBAS_VISIBILIDAD.py','tools/seo_visibilidad.py'):
assert (root/script).is_file(), 'Falta integración SEO '+script
assert (root/'PEGAR_EN_INDEX_PRINCIPAL.html').exists()
assert len(re.findall(r'<a\b', (root/'PEGAR_EN_INDEX_PRINCIPAL.html').read_text(encoding='utf8'))) == 17
for secret in root.rglob('clave.hex'):failed.append('Clave privada incluida '+str(secret))
assert not failed,'\n'.join(failed)
print(f'OK {checked} páginas HTML, 18 tutoriales base + ampliación, registro y código completo, enlaces internos del módulo, 17 tarjetas y sin claves privadas.')