Download index.html from Intimafit/extraer-codigos-html-css-js: direct link, hf CLI and curl.
- Browser
- Download file 16.5 kB
-
https://huggingface.co/spaces/Intimafit/extraer-codigos-html-css-js/resolve/main/index.html
- Command line
-
hf download hf://spaces/Intimafit/extraer-codigos-html-css-js/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Intimafit/extraer-codigos-html-css-js/resolve/main/index.html
16.5 kB
| <html lang="es"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Extractor de C贸digo Fuente Web</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, #4f46e5 0%, #7c3aed 100%); | |
| } | |
| .code-container { | |
| max-height: 500px; | |
| overflow-y: auto; | |
| background-color: #1e293b; | |
| color: #f8fafc; | |
| font-family: 'Courier New', monospace; | |
| border-radius: 0.5rem; | |
| } | |
| pre { | |
| white-space: pre-wrap; | |
| word-wrap: break-word; | |
| padding: 1rem; | |
| margin: 0; | |
| } | |
| .tab-button { | |
| transition: all 0.2s ease; | |
| } | |
| .tab-button.active { | |
| background-color: #4f46e5; | |
| color: white; | |
| } | |
| .download-btn { | |
| transition: all 0.2s ease; | |
| } | |
| .download-btn:hover { | |
| transform: translateY(-2px); | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-100 min-h-screen"> | |
| <div class="container mx-auto px-4 py-8"> | |
| <div class="text-center mb-12"> | |
| <h1 class="text-4xl font-bold text-gray-800 mb-4">Extractor de C贸digo Fuente Web</h1> | |
| <p class="text-xl text-gray-600 max-w-2xl mx-auto"> | |
| Obt茅n el c贸digo HTML, CSS y JavaScript de cualquier p谩gina web ingresando su URL | |
| </p> | |
| </div> | |
| <div class="max-w-4xl mx-auto bg-white rounded-xl shadow-lg overflow-hidden"> | |
| <div class="p-6 gradient-bg text-white"> | |
| <div class="flex flex-col md:flex-row md:items-center gap-4"> | |
| <input | |
| type="url" | |
| id="url-input" | |
| placeholder="https://ejemplo.com" | |
| class="flex-grow px-4 py-3 rounded-lg text-gray-800 focus:outline-none focus:ring-2 focus:ring-purple-300" | |
| required | |
| > | |
| <button | |
| id="fetch-btn" | |
| class="px-6 py-3 bg-white text-purple-600 font-bold rounded-lg hover:bg-gray-100 transition flex items-center justify-center" | |
| > | |
| <i class="fas fa-code mr-2"></i> Extraer C贸digo | |
| </button> | |
| </div> | |
| </div> | |
| <div class="p-6"> | |
| <div class="flex border-b border-gray-200 mb-4"> | |
| <button class="tab-button px-4 py-2 rounded-t-lg active" data-tab="html">HTML</button> | |
| <button class="tab-button px-4 py-2 rounded-t-lg" data-tab="css">CSS</button> | |
| <button class="tab-button px-4 py-2 rounded-t-lg" data-tab="js">JavaScript</button> | |
| <button class="tab-button px-4 py-2 rounded-t-lg" data-tab="all">Todo</button> | |
| </div> | |
| <div id="loading" class="text-center py-12 hidden"> | |
| <div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-purple-500 mx-auto mb-4"></div> | |
| <p class="text-gray-600">Analizando la p谩gina web...</p> | |
| </div> | |
| <div id="error-message" class="hidden bg-red-100 border-l-4 border-red-500 text-red-700 p-4 mb-4 rounded"> | |
| <p id="error-text"></p> | |
| </div> | |
| <div id="results" class="hidden"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="text-lg font-semibold text-gray-800" id="current-tab-title">HTML</h3> | |
| <button | |
| id="download-btn" | |
| class="download-btn px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 flex items-center" | |
| > | |
| <i class="fas fa-download mr-2"></i> Descargar | |
| </button> | |
| </div> | |
| <div class="code-container"> | |
| <pre id="html-code"></pre> | |
| <pre id="css-code" class="hidden"></pre> | |
| <pre id="js-code" class="hidden"></pre> | |
| <pre id="all-code" class="hidden"></pre> | |
| </div> | |
| </div> | |
| <div id="instructions" class="bg-blue-50 border-l-4 border-blue-500 text-blue-700 p-4 rounded"> | |
| <p class="font-semibold">Instrucciones:</p> | |
| <ol class="list-decimal pl-5 mt-2 space-y-1"> | |
| <li>Ingresa la URL completa (incluyendo https://)</li> | |
| <li>Haz clic en "Extraer C贸digo"</li> | |
| <li>Navega entre las pesta帽as para ver HTML, CSS o JS</li> | |
| <li>Descarga el c贸digo que necesites</li> | |
| </ol> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="max-w-4xl mx-auto mt-8 bg-white rounded-xl shadow-lg overflow-hidden"> | |
| <div class="p-6"> | |
| <h2 class="text-xl font-semibold text-gray-800 mb-4">驴C贸mo funciona?</h2> | |
| <div class="grid grid-cols-1 md:grid-cols-3 gap-6"> | |
| <div class="bg-gray-50 p-4 rounded-lg"> | |
| <div class="w-12 h-12 gradient-bg rounded-full flex items-center justify-center text-white text-xl mb-3"> | |
| <i class="fas fa-globe"></i> | |
| </div> | |
| <h3 class="font-semibold text-gray-800 mb-2">1. Solicitud HTTP</h3> | |
| <p class="text-gray-600 text-sm">Hacemos una solicitud a la URL proporcionada para obtener el contenido HTML.</p> | |
| </div> | |
| <div class="bg-gray-50 p-4 rounded-lg"> | |
| <div class="w-12 h-12 gradient-bg rounded-full flex items-center justify-center text-white text-xl mb-3"> | |
| <i class="fas fa-code"></i> | |
| </div> | |
| <h3 class="font-semibold text-gray-800 mb-2">2. An谩lisis del C贸digo</h3> | |
| <p class="text-gray-600 text-sm">Extraemos y separamos el HTML, CSS y JavaScript del c贸digo fuente.</p> | |
| </div> | |
| <div class="bg-gray-50 p-4 rounded-lg"> | |
| <div class="w-12 h-12 gradient-bg rounded-full flex items-center justify-center text-white text-xl mb-3"> | |
| <i class="fas fa-file-download"></i> | |
| </div> | |
| <h3 class="font-semibold text-gray-800 mb-2">3. Descarga</h3> | |
| <p class="text-gray-600 text-sm">Puedes descargar cada parte del c贸digo por separado o todo junto.</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <footer class="bg-gray-800 text-gray-400 py-8 mt-12"> | |
| <div class="container mx-auto px-4 text-center"> | |
| <p>漏 2023 Extractor de C贸digo Web. Todos los derechos reservados.</p> | |
| </div> | |
| </footer> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const urlInput = document.getElementById('url-input'); | |
| const fetchBtn = document.getElementById('fetch-btn'); | |
| const loading = document.getElementById('loading'); | |
| const results = document.getElementById('results'); | |
| const errorMessage = document.getElementById('error-message'); | |
| const errorText = document.getElementById('error-text'); | |
| const instructions = document.getElementById('instructions'); | |
| const downloadBtn = document.getElementById('download-btn'); | |
| const tabButtons = document.querySelectorAll('.tab-button'); | |
| const htmlCode = document.getElementById('html-code'); | |
| const cssCode = document.getElementById('css-code'); | |
| const jsCode = document.getElementById('js-code'); | |
| const allCode = document.getElementById('all-code'); | |
| const currentTabTitle = document.getElementById('current-tab-title'); | |
| let currentTab = 'html'; | |
| let sourceData = { | |
| html: '', | |
| css: '', | |
| js: '' | |
| }; | |
| // Manejar clic en las pesta帽as | |
| tabButtons.forEach(button => { | |
| button.addEventListener('click', function() { | |
| // Actualizar pesta帽a activa | |
| tabButtons.forEach(btn => btn.classList.remove('active')); | |
| this.classList.add('active'); | |
| currentTab = this.dataset.tab; | |
| // Actualizar t铆tulo | |
| let tabName = ''; | |
| switch(currentTab) { | |
| case 'html': tabName = 'HTML'; break; | |
| case 'css': tabName = 'CSS'; break; | |
| case 'js': tabName = 'JavaScript'; break; | |
| case 'all': tabName = 'Todo el c贸digo'; break; | |
| } | |
| currentTabTitle.textContent = tabName; | |
| // Mostrar el c贸digo correspondiente | |
| document.querySelectorAll('.code-container pre').forEach(pre => pre.classList.add('hidden')); | |
| document.getElementById(`${currentTab}-code`).classList.remove('hidden'); | |
| }); | |
| }); | |
| // Manejar clic en el bot贸n de extraer c贸digo | |
| fetchBtn.addEventListener('click', async function() { | |
| const url = urlInput.value.trim(); | |
| if (!url) { | |
| showError('Por favor ingresa una URL v谩lida'); | |
| return; | |
| } | |
| try { | |
| // Mostrar carga y ocultar otros elementos | |
| loading.classList.remove('hidden'); | |
| results.classList.add('hidden'); | |
| errorMessage.classList.add('hidden'); | |
| instructions.classList.add('hidden'); | |
| // Usar un proxy CORS para evitar problemas de same-origin | |
| const proxyUrl = `https://api.allorigins.win/get?url=${encodeURIComponent(url)}`; | |
| const response = await fetch(proxyUrl); | |
| if (!response.ok) { | |
| throw new Error('No se pudo obtener el c贸digo fuente'); | |
| } | |
| const data = await response.json(); | |
| if (data.contents) { | |
| // Extraer HTML | |
| sourceData.html = data.contents; | |
| // Extraer CSS (simplificado - en una app real usar铆amos un parser m谩s sofisticado) | |
| const styleTags = data.contents.match(/<style[^>]*>([\s\S]*?)<\/style>/gi) || []; | |
| const linkTags = data.contents.match(/<link[^>]*rel=["']stylesheet["'][^>]*>/gi) || []; | |
| let cssContent = styleTags.map(tag => { | |
| return tag.replace(/<style[^>]*>([\s\S]*?)<\/style>/i, '$1'); | |
| }).join('\n\n'); | |
| sourceData.css = cssContent; | |
| // Extraer JavaScript (simplificado) | |
| const scriptTags = data.contents.match(/<script\b[^>]*>([\s\S]*?)<\/script>/gi) || []; | |
| let jsContent = scriptTags.map(tag => { | |
| // Ignorar scripts con src | |
| if (tag.includes('src=')) return ''; | |
| return tag.replace(/<script\b[^>]*>([\s\S]*?)<\/script>/i, '$1'); | |
| }).join('\n\n'); | |
| sourceData.js = jsContent; | |
| // Combinar todo el c贸digo | |
| sourceData.all = `<!-- HTML -->\n${sourceData.html}\n\n<!-- CSS -->\n${sourceData.css}\n\n<!-- JavaScript -->\n${sourceData.js}`; | |
| // Mostrar los resultados | |
| htmlCode.textContent = sourceData.html; | |
| cssCode.textContent = sourceData.css; | |
| jsCode.textContent = sourceData.js; | |
| allCode.textContent = sourceData.all; | |
| loading.classList.add('hidden'); | |
| results.classList.remove('hidden'); | |
| } else { | |
| throw new Error('No se pudo obtener el contenido de la p谩gina'); | |
| } | |
| } catch (error) { | |
| console.error('Error:', error); | |
| showError(`Error al obtener el c贸digo: ${error.message}`); | |
| loading.classList.add('hidden'); | |
| } | |
| }); | |
| // Manejar clic en el bot贸n de descarga | |
| downloadBtn.addEventListener('click', function() { | |
| if (!sourceData.html) { | |
| showError('No hay c贸digo para descargar'); | |
| return; | |
| } | |
| let content, extension; | |
| switch(currentTab) { | |
| case 'html': | |
| content = sourceData.html; | |
| extension = 'html'; | |
| break; | |
| case 'css': | |
| content = sourceData.css; | |
| extension = 'css'; | |
| break; | |
| case 'js': | |
| content = sourceData.js; | |
| extension = 'js'; | |
| break; | |
| case 'all': | |
| content = sourceData.all; | |
| extension = 'txt'; | |
| break; | |
| } | |
| if (!content.trim()) { | |
| showError(`No se encontr贸 c贸digo ${currentTab.toUpperCase()} para descargar`); | |
| return; | |
| } | |
| downloadFile(content, `codigo-${currentTab}.${extension}`); | |
| }); | |
| // Funci贸n para mostrar errores | |
| function showError(message) { | |
| errorText.textContent = message; | |
| errorMessage.classList.remove('hidden'); | |
| setTimeout(() => { | |
| errorMessage.classList.add('hidden'); | |
| }, 5000); | |
| } | |
| // Funci贸n para descargar archivo | |
| function downloadFile(content, filename) { | |
| const blob = new Blob([content], { type: 'text/plain' }); | |
| 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); | |
| } | |
| }); | |
| </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/extraer-codigos-html-css-js" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |