Spaces:
Running
Running
Download index.html from Intimafit/descargar-estilos-css: direct link, hf CLI and curl.
- Browser
- Download file 28.7 kB
-
https://huggingface.co/spaces/Intimafit/descargar-estilos-css/resolve/main/index.html
- Command line
-
hf download hf://spaces/Intimafit/descargar-estilos-css/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Intimafit/descargar-estilos-css/resolve/main/index.html
28.7 kB
| <html lang="es"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Web Extractor - Extrae HTML, CSS y JS</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| .gradient-bg { | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| } | |
| .code-container { | |
| max-height: 300px; | |
| overflow-y: auto; | |
| background-color: #1e293b; | |
| color: #f8fafc; | |
| border-radius: 0.5rem; | |
| padding: 1rem; | |
| font-family: 'Courier New', monospace; | |
| white-space: pre-wrap; | |
| word-wrap: break-word; | |
| } | |
| .tab-button { | |
| transition: all 0.3s ease; | |
| } | |
| .tab-button.active { | |
| background-color: #4f46e5; | |
| color: white; | |
| } | |
| .pulse { | |
| animation: pulse 2s infinite; | |
| } | |
| @keyframes pulse { | |
| 0% { transform: scale(1); } | |
| 50% { transform: scale(1.05); } | |
| 100% { transform: scale(1); } | |
| } | |
| </style> | |
| </head> | |
| <body class="min-h-screen bg-gray-100"> | |
| <div class="gradient-bg text-white py-12 px-4 shadow-lg"> | |
| <div class="max-w-6xl mx-auto text-center"> | |
| <h1 class="text-4xl font-bold mb-4">Web Extractor</h1> | |
| <p class="text-xl mb-8">Extrae HTML, CSS y JavaScript de cualquier sitio web</p> | |
| <div class="max-w-3xl mx-auto bg-white rounded-lg shadow-xl overflow-hidden"> | |
| <div class="p-6"> | |
| <div class="flex"> | |
| <input type="url" id="urlInput" placeholder="https://ejemplo.com" | |
| class="flex-grow px-4 py-3 rounded-l-lg border-2 border-gray-300 focus:outline-none focus:border-indigo-500 text-gray-800"> | |
| <button id="analyzeBtn" class="bg-indigo-600 hover:bg-indigo-700 text-white px-6 py-3 rounded-r-lg font-semibold transition duration-300 flex items-center"> | |
| <i class="fas fa-download mr-2"></i> Extraer | |
| </button> | |
| </div> | |
| <div class="mt-4 flex items-center text-gray-600"> | |
| <i class="fas fa-info-circle mr-2"></i> | |
| <span class="text-sm">Ingresa la URL completa (ej: https://google.com)</span> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="max-w-6xl mx-auto py-12 px-4"> | |
| <div id="loading" class="hidden text-center py-8"> | |
| <div class="inline-block p-6 bg-white rounded-full shadow-lg pulse"> | |
| <i class="fas fa-spinner fa-spin text-indigo-600 text-4xl"></i> | |
| </div> | |
| <p class="mt-4 text-gray-600">Analizando la página web...</p> | |
| </div> | |
| <div id="results" class="hidden"> | |
| <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8"> | |
| <div class="p-6"> | |
| <div class="flex justify-between items-center mb-6"> | |
| <h2 class="text-2xl font-bold text-gray-800">Resultados del análisis</h2> | |
| <div class="flex space-x-2"> | |
| <button id="downloadAllBtn" class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded-lg font-medium transition duration-300 flex items-center"> | |
| <i class="fas fa-file-archive mr-2"></i> Descargar Todo | |
| </button> | |
| <button id="copyAllBtn" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg font-medium transition duration-300 flex items-center"> | |
| <i class="fas fa-copy mr-2"></i> Copiar Todo | |
| </button> | |
| </div> | |
| </div> | |
| <div class="mb-6"> | |
| <h3 class="text-lg font-semibold text-gray-700 mb-2">URL analizada:</h3> | |
| <p id="analyzedUrl" class="text-indigo-600 font-medium break-all"></p> | |
| </div> | |
| <div class="mb-6"> | |
| <div class="flex border-b border-gray-200"> | |
| <button data-tab="html" class="tab-button px-4 py-2 font-medium text-gray-600 hover:text-indigo-600 active"> | |
| <i class="fas fa-code mr-2"></i>HTML | |
| </button> | |
| <button data-tab="css" class="tab-button px-4 py-2 font-medium text-gray-600 hover:text-indigo-600"> | |
| <i class="fab fa-css3-alt mr-2"></i>CSS | |
| </button> | |
| <button data-tab="js" class="tab-button px-4 py-2 font-medium text-gray-600 hover:text-indigo-600"> | |
| <i class="fab fa-js-square mr-2"></i>JavaScript | |
| </button> | |
| </div> | |
| <div class="mt-4"> | |
| <div id="htmlTab" class="tab-content"> | |
| <div class="flex justify-between items-center mb-3"> | |
| <h3 class="text-lg font-semibold text-gray-700">HTML Extraído</h3> | |
| <div class="flex space-x-2"> | |
| <button data-copy="html" class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-3 py-1 rounded text-sm flex items-center"> | |
| <i class="fas fa-copy mr-1"></i> Copiar | |
| </button> | |
| <button data-download="html" class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-3 py-1 rounded text-sm flex items-center"> | |
| <i class="fas fa-download mr-1"></i> Descargar | |
| </button> | |
| </div> | |
| </div> | |
| <div id="htmlResult" class="code-container"></div> | |
| </div> | |
| <div id="cssTab" class="tab-content hidden"> | |
| <div class="flex justify-between items-center mb-3"> | |
| <h3 class="text-lg font-semibold text-gray-700">CSS Extraído</h3> | |
| <div class="flex space-x-2"> | |
| <button data-copy="css" class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-3 py-1 rounded text-sm flex items-center"> | |
| <i class="fas fa-copy mr-1"></i> Copiar | |
| </button> | |
| <button data-download="css" class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-3 py-1 rounded text-sm flex items-center"> | |
| <i class="fas fa-download mr-1"></i> Descargar | |
| </button> | |
| </div> | |
| </div> | |
| <div id="cssResult" class="code-container"></div> | |
| </div> | |
| <div id="jsTab" class="tab-content hidden"> | |
| <div class="flex justify-between items-center mb-3"> | |
| <h3 class="text-lg font-semibold text-gray-700">JavaScript Extraído</h3> | |
| <div class="flex space-x-2"> | |
| <button data-copy="js" class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-3 py-1 rounded text-sm flex items-center"> | |
| <i class="fas fa-copy mr-1"></i> Copiar | |
| </button> | |
| <button data-download="js" class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-3 py-1 rounded text-sm flex items-center"> | |
| <i class="fas fa-download mr-1"></i> Descargar | |
| </button> | |
| </div> | |
| </div> | |
| <div id="jsResult" class="code-container"></div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="errorBox" class="hidden bg-red-50 border-l-4 border-red-500 p-4 mb-8 rounded"> | |
| <div class="flex"> | |
| <div class="flex-shrink-0"> | |
| <i class="fas fa-exclamation-circle text-red-500"></i> | |
| </div> | |
| <div class="ml-3"> | |
| <h3 class="text-sm font-medium text-red-800" id="errorTitle"></h3> | |
| <div class="mt-2 text-sm text-red-700" id="errorMessage"></div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-white rounded-xl shadow-md overflow-hidden mt-8"> | |
| <div class="p-6"> | |
| <h2 class="text-xl font-bold text-gray-800 mb-4">¿Cómo funciona Web Extractor?</h2> | |
| <div class="grid md:grid-cols-3 gap-6"> | |
| <div class="bg-indigo-50 p-6 rounded-lg"> | |
| <div class="flex items-center mb-4"> | |
| <div class="flex-shrink-0 h-10 w-10 rounded-full bg-indigo-100 flex items-center justify-center"> | |
| <i class="fas fa-globe text-indigo-600"></i> | |
| </div> | |
| <h3 class="text-lg font-medium text-gray-900 ml-4">1. Ingresa la URL</h3> | |
| </div> | |
| <p class="text-gray-600">Escribe o pega la dirección completa de la página web que deseas analizar y extraer.</p> | |
| </div> | |
| <div class="bg-indigo-50 p-6 rounded-lg"> | |
| <div class="flex items-center mb-4"> | |
| <div class="flex-shrink-0 h-10 w-10 rounded-full bg-indigo-100 flex items-center justify-center"> | |
| <i class="fas fa-cogs text-indigo-600"></i> | |
| </div> | |
| <h3 class="text-lg font-medium text-gray-900 ml-4">2. Extracción automática</h3> | |
| </div> | |
| <p class="text-gray-600">Nuestro sistema analiza la página y extrae todo el HTML, CSS y JavaScript.</p> | |
| </div> | |
| <div class="bg-indigo-50 p-6 rounded-lg"> | |
| <div class="flex items-center mb-4"> | |
| <div class="flex-shrink-0 h-10 w-10 rounded-full bg-indigo-100 flex items-center justify-center"> | |
| <i class="fas fa-file-export text-indigo-600"></i> | |
| </div> | |
| <h3 class="text-lg font-medium text-gray-900 ml-4">3. Descarga o copia</h3> | |
| </div> | |
| <p class="text-gray-600">Descarga todo el código en un archivo .zip o cópialo directamente para usarlo en tu constructor.</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <footer class="bg-gray-800 text-white py-8"> | |
| <div class="max-w-6xl mx-auto px-4"> | |
| <div class="md:flex md:justify-between"> | |
| <div class="mb-8 md:mb-0"> | |
| <h2 class="text-2xl font-bold mb-4">Web Extractor</h2> | |
| <p class="text-gray-300">Herramienta para desarrolladores que necesitan extraer código de sitios web.</p> | |
| </div> | |
| <div class="grid grid-cols-2 gap-8"> | |
| <div> | |
| <h3 class="text-sm font-semibold uppercase tracking-wider mb-4">Enlaces</h3> | |
| <ul class="space-y-2"> | |
| <li><a href="#" class="text-gray-300 hover:text-white">Inicio</a></li> | |
| <li><a href="#" class="text-gray-300 hover:text-white">Documentación</a></li> | |
| <li><a href="#" class="text-gray-300 hover:text-white">API</a></li> | |
| </ul> | |
| </div> | |
| <div> | |
| <h3 class="text-sm font-semibold uppercase tracking-wider mb-4">Contacto</h3> | |
| <ul class="space-y-2"> | |
| <li><a href="#" class="text-gray-300 hover:text-white">Soporte</a></li> | |
| <li><a href="#" class="text-gray-300 hover:text-white">Twitter</a></li> | |
| <li><a href="#" class="text-gray-300 hover:text-white">GitHub</a></li> | |
| </ul> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="mt-8 pt-8 border-t border-gray-700 text-center"> | |
| <p>© 2023 Web Extractor. Todos los derechos reservados.</p> | |
| </div> | |
| </div> | |
| </footer> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const urlInput = document.getElementById('urlInput'); | |
| const analyzeBtn = document.getElementById('analyzeBtn'); | |
| const loading = document.getElementById('loading'); | |
| const results = document.getElementById('results'); | |
| const analyzedUrl = document.getElementById('analyzedUrl'); | |
| const htmlResult = document.getElementById('htmlResult'); | |
| const cssResult = document.getElementById('cssResult'); | |
| const jsResult = document.getElementById('jsResult'); | |
| const errorBox = document.getElementById('errorBox'); | |
| const errorTitle = document.getElementById('errorTitle'); | |
| const errorMessage = document.getElementById('errorMessage'); | |
| const tabButtons = document.querySelectorAll('.tab-button'); | |
| const tabContents = document.querySelectorAll('.tab-content'); | |
| // Variables para almacenar los códigos extraídos | |
| let extractedHTML = ''; | |
| let extractedCSS = ''; | |
| let extractedJS = ''; | |
| analyzeBtn.addEventListener('click', extractWebsite); | |
| urlInput.addEventListener('keypress', function(e) { | |
| if (e.key === 'Enter') extractWebsite(); | |
| }); | |
| // Manejo de pestañas | |
| tabButtons.forEach(button => { | |
| button.addEventListener('click', () => { | |
| const tab = button.getAttribute('data-tab'); | |
| // Actualizar botones activos | |
| tabButtons.forEach(btn => btn.classList.remove('active')); | |
| button.classList.add('active'); | |
| // Mostrar contenido correspondiente | |
| tabContents.forEach(content => content.classList.add('hidden')); | |
| document.getElementById(`${tab}Tab`).classList.remove('hidden'); | |
| }); | |
| }); | |
| // Botones de copiar | |
| document.querySelectorAll('[data-copy]').forEach(button => { | |
| button.addEventListener('click', function() { | |
| const type = this.getAttribute('data-copy'); | |
| let codeToCopy = ''; | |
| switch(type) { | |
| case 'html': codeToCopy = extractedHTML; break; | |
| case 'css': codeToCopy = extractedCSS; break; | |
| case 'js': codeToCopy = extractedJS; break; | |
| } | |
| navigator.clipboard.writeText(codeToCopy).then(() => { | |
| showToast(`¡${type.toUpperCase()} copiado al portapapeles!`); | |
| }).catch(err => { | |
| console.error('Error al copiar:', err); | |
| }); | |
| }); | |
| }); | |
| // Botones de descargar individuales | |
| document.querySelectorAll('[data-download]').forEach(button => { | |
| button.addEventListener('click', function() { | |
| const type = this.getAttribute('data-download'); | |
| let codeToDownload = ''; | |
| let extension = ''; | |
| switch(type) { | |
| case 'html': | |
| codeToDownload = extractedHTML; | |
| extension = 'html'; | |
| break; | |
| case 'css': | |
| codeToDownload = extractedCSS; | |
| extension = 'css'; | |
| break; | |
| case 'js': | |
| codeToDownload = extractedJS; | |
| extension = 'js'; | |
| break; | |
| } | |
| downloadFile(codeToDownload, `${getDomainName(urlInput.value)}.${extension}`, `text/${extension}`); | |
| }); | |
| }); | |
| // Botón para descargar todo | |
| document.getElementById('downloadAllBtn').addEventListener('click', downloadAll); | |
| // Botón para copiar todo | |
| document.getElementById('copyAllBtn').addEventListener('click', copyAll); | |
| function extractWebsite() { | |
| const url = urlInput.value.trim(); | |
| if (!url) { | |
| showError('Campo requerido', 'Por favor ingresa una URL válida'); | |
| return; | |
| } | |
| // Validar formato de URL | |
| try { | |
| new URL(url); | |
| } catch (e) { | |
| showError('URL inválida', 'Por favor ingresa una URL completa (incluyendo http:// o https://)'); | |
| return; | |
| } | |
| // Mostrar carga y ocultar otros elementos | |
| loading.classList.remove('hidden'); | |
| results.classList.add('hidden'); | |
| errorBox.classList.add('hidden'); | |
| // Usamos un proxy CORS para evitar problemas de same-origin policy | |
| const proxyUrl = `https://api.allorigins.win/get?url=${encodeURIComponent(url)}`; | |
| fetch(proxyUrl) | |
| .then(response => { | |
| if (!response.ok) throw new Error('No se pudo acceder a la URL'); | |
| return response.json(); | |
| }) | |
| .then(data => { | |
| if (data.status.http_code !== 200) { | |
| throw new Error('No se pudo obtener el contenido de la página'); | |
| } | |
| // Parseamos el HTML | |
| const parser = new DOMParser(); | |
| const htmlDoc = parser.parseFromString(data.contents, 'text/html'); | |
| // Extraemos el HTML completo | |
| extractedHTML = htmlDoc.documentElement.outerHTML; | |
| // Extraemos todos los CSS (externos e internos) | |
| const stylesheets = Array.from(htmlDoc.querySelectorAll('link[rel="stylesheet"]')); | |
| const inlineStyles = Array.from(htmlDoc.querySelectorAll('style')); | |
| // Extraemos todos los JS (externos e internos) | |
| const scripts = Array.from(htmlDoc.querySelectorAll('script')); | |
| // Procesamos hojas de estilo externas | |
| const cssPromises = stylesheets.map(sheet => { | |
| const href = sheet.href; | |
| return fetch(`https://api.allorigins.win/get?url=${encodeURIComponent(href)}`) | |
| .then(res => res.json()) | |
| .then(data => { | |
| if (data.status.http_code === 200) { | |
| return `/* CSS de: ${href} */\n\n${data.contents}\n\n`; | |
| } | |
| return `/* No se pudo cargar: ${href} */\n\n`; | |
| }) | |
| .catch(() => `/* Error al cargar: ${href} */\n\n`); | |
| }); | |
| // Procesamos estilos en línea | |
| const inlineCSS = inlineStyles.map(style => `/* Estilos en línea */\n\n${style.textContent}\n\n`); | |
| // Procesamos scripts externos | |
| const jsPromises = scripts | |
| .filter(script => script.src) | |
| .map(script => { | |
| const src = script.src; | |
| return fetch(`https://api.allorigins.win/get?url=${encodeURIComponent(src)}`) | |
| .then(res => res.json()) | |
| .then(data => { | |
| if (data.status.http_code === 200) { | |
| return `/* JavaScript de: ${src} */\n\n${data.contents}\n\n`; | |
| } | |
| return `/* No se pudo cargar: ${src} */\n\n`; | |
| }) | |
| .catch(() => `/* Error al cargar: ${src} */\n\n`); | |
| }); | |
| // Procesamos scripts en línea | |
| const inlineJS = scripts | |
| .filter(script => !script.src && script.textContent.trim()) | |
| .map(script => `/* JavaScript en línea */\n\n${script.textContent}\n\n`); | |
| // Esperamos a que terminen todas las peticiones | |
| return Promise.all([...cssPromises, ...jsPromises]) | |
| .then(results => { | |
| // Separamos los resultados de CSS y JS | |
| const cssResults = results.slice(0, cssPromises.length); | |
| const jsResults = results.slice(cssPromises.length); | |
| // Combinamos todo | |
| extractedCSS = [...cssResults, ...inlineCSS].join('\n'); | |
| extractedJS = [...jsResults, ...inlineJS].join('\n'); | |
| // Mostramos los resultados | |
| analyzedUrl.textContent = url; | |
| htmlResult.textContent = extractedHTML; | |
| cssResult.textContent = extractedCSS; | |
| jsResult.textContent = extractedJS; | |
| loading.classList.add('hidden'); | |
| results.classList.remove('hidden'); | |
| }); | |
| }) | |
| .catch(err => { | |
| console.error('Error:', err); | |
| loading.classList.add('hidden'); | |
| showError('Error al analizar', err.message || 'Ocurrió un error al intentar analizar la página'); | |
| }); | |
| } | |
| function downloadAll() { | |
| // Creamos un objeto ZIP con JSZip | |
| const zip = new JSZip(); | |
| // Agregamos los archivos al ZIP | |
| zip.file(`${getDomainName(urlInput.value)}.html`, extractedHTML); | |
| zip.file(`${getDomainName(urlInput.value)}.css`, extractedCSS); | |
| zip.file(`${getDomainName(urlInput.value)}.js`, extractedJS); | |
| // Generamos el ZIP | |
| zip.generateAsync({type:"blob"}) | |
| .then(function(content) { | |
| // Descargamos el ZIP | |
| const url = URL.createObjectURL(content); | |
| const a = document.createElement('a'); | |
| a.href = url; | |
| a.download = `${getDomainName(urlInput.value)}_extracted.zip`; | |
| document.body.appendChild(a); | |
| a.click(); | |
| setTimeout(() => { | |
| document.body.removeChild(a); | |
| URL.revokeObjectURL(url); | |
| }, 100); | |
| }); | |
| } | |
| function copyAll() { | |
| const allCode = `<!DOCTYPE html> | |
| <!-- HTML --> | |
| ${extractedHTML} | |
| <!-- CSS --> | |
| <style> | |
| ${extractedCSS} | |
| </style> | |
| <!-- JavaScript --> | |
| <script> | |
| ${extractedJS} | |
| </script>`; | |
| navigator.clipboard.writeText(allCode).then(() => { | |
| showToast('¡Todo el código copiado al portapapeles!'); | |
| }).catch(err => { | |
| console.error('Error al copiar:', err); | |
| }); | |
| } | |
| function downloadFile(content, filename, mimeType) { | |
| const blob = new Blob([content], { type: mimeType }); | |
| const url = URL.createObjectURL(blob); | |
| const a = document.createElement('a'); | |
| a.href = url; | |
| a.download = filename; | |
| document.body.appendChild(a); | |
| a.click(); | |
| setTimeout(() => { | |
| document.body.removeChild(a); | |
| URL.revokeObjectURL(url); | |
| }, 100); | |
| } | |
| function getDomainName(url) { | |
| try { | |
| const domain = new URL(url).hostname.replace('www.', ''); | |
| return domain.split('.')[0] || 'website'; | |
| } catch { | |
| return 'website'; | |
| } | |
| } | |
| function showError(title, message) { | |
| errorTitle.textContent = title; | |
| errorMessage.textContent = message; | |
| errorBox.classList.remove('hidden'); | |
| loading.classList.add('hidden'); | |
| results.classList.add('hidden'); | |
| } | |
| function showToast(message) { | |
| const toast = document.createElement('div'); | |
| toast.className = 'fixed bottom-4 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg flex items-center'; | |
| toast.innerHTML = `<i class="fas fa-check-circle mr-2"></i> ${message}`; | |
| document.body.appendChild(toast); | |
| setTimeout(() => { | |
| toast.classList.add('opacity-0', 'transition-opacity', 'duration-300'); | |
| setTimeout(() => toast.remove(), 300); | |
| }, 3000); | |
| } | |
| }); | |
| </script> | |
| <!-- JSZip para crear archivos ZIP --> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Intimafit/descargar-estilos-css" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |