Jonathanloza05 commited on
Commit
cff2d97
·
verified ·
1 Parent(s): 8b0c217

Upload 8 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ static/img/paso1.png filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import zipfile
3
+ import json
4
+ import tempfile
5
+ import shutil
6
+ from datetime import datetime
7
+ from flask import Flask, render_template, request
8
+ from nucleo import cazar_datos_meta
9
+
10
+ # 1. Nombramos a nuestra app como flask_app
11
+ flask_app = Flask(__name__)
12
+
13
+ def buscar_archivos_json(directorio):
14
+ ruta_seguidores = None
15
+ ruta_siguiendo = None
16
+ for raiz, _, archivos in os.walk(directorio):
17
+ for archivo in archivos:
18
+ if archivo.startswith('followers') and archivo.endswith('.json'):
19
+ ruta_seguidores = os.path.join(raiz, archivo)
20
+ elif archivo.startswith('following') and archivo.endswith('.json'):
21
+ ruta_siguiendo = os.path.join(raiz, archivo)
22
+ return ruta_seguidores, ruta_siguiendo
23
+
24
+ @flask_app.route('/', methods=['GET', 'POST'])
25
+ def index():
26
+ if request.method == 'POST':
27
+ if 'archivo_zip' not in request.files:
28
+ return "No se subió ningún archivo", 400
29
+
30
+ archivo = request.files['archivo_zip']
31
+ if archivo.filename == '':
32
+ return "El archivo no tiene nombre", 400
33
+
34
+ if archivo and archivo.filename.endswith('.zip'):
35
+ temp_dir = tempfile.mkdtemp()
36
+ zip_path = os.path.join(temp_dir, 'datos.zip')
37
+
38
+ try:
39
+ archivo.save(zip_path)
40
+ with zipfile.ZipFile(zip_path, 'r') as zip_ref:
41
+ zip_ref.extractall(temp_dir)
42
+
43
+ ruta_seguidores, ruta_siguiendo = buscar_archivos_json(temp_dir)
44
+
45
+ if not ruta_seguidores or not ruta_siguiendo:
46
+ shutil.rmtree(temp_dir)
47
+ return "❌ Error: El ZIP no contiene la información de Seguidores y Seguidos.", 400
48
+
49
+ with open(ruta_seguidores, 'r', encoding='utf-8') as f:
50
+ data_seguidores = json.load(f)
51
+ with open(ruta_siguiendo, 'r', encoding='utf-8') as f:
52
+ data_siguiendo = json.load(f)
53
+
54
+ seguidores_info = cazar_datos_meta(data_seguidores)
55
+ siguiendo_info = cazar_datos_meta(data_siguiendo)
56
+
57
+ nombres_seguidores = set(seguidores_info.keys())
58
+
59
+ lista_final = []
60
+ for usuario, ts in siguiendo_info.items():
61
+ if usuario not in nombres_seguidores:
62
+ fecha = datetime.fromtimestamp(ts).strftime('%d/%m/%Y') if ts else "Desconocida"
63
+ lista_final.append({'usuario': usuario, 'fecha': fecha, 'ts': ts})
64
+
65
+ lista_final.sort(key=lambda x: x['ts'], reverse=True)
66
+
67
+ resultados = {
68
+ 'total_siguiendo': len(siguiendo_info),
69
+ 'total_seguidores': len(nombres_seguidores),
70
+ 'mutuos': len(nombres_seguidores.intersection(siguiendo_info.keys())),
71
+ 'traidores': lista_final
72
+ }
73
+
74
+ shutil.rmtree(temp_dir)
75
+ return render_template('index.html', resultados=resultados)
76
+
77
+ except Exception as e:
78
+ if os.path.exists(temp_dir):
79
+ shutil.rmtree(temp_dir)
80
+ return f"Ocurrió un error técnico: {str(e)}", 500
81
+
82
+ return render_template('index.html', resultados=None)
83
+
84
+ # ==========================================
85
+ # EL CABALLO DE TROYA PARA HUGGING FACE
86
+ # ==========================================
87
+ from fastapi import FastAPI
88
+ from fastapi.middleware.wsgi import WSGIMiddleware
89
+ import uvicorn
90
+
91
+ # Creamos una app de FastAPI (El motor que Hugging Face exige)
92
+ app = FastAPI()
93
+
94
+ # Camuflamos nuestra app de Flask adentro de FastAPI
95
+ app.mount("/", WSGIMiddleware(flask_app))
96
+
97
+ if __name__ == '__main__':
98
+ # Lanzamos el servidor en el puerto 7860 para pasar la seguridad
99
+ uvicorn.run(app, host='0.0.0.0', port=7860)
nucleo.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+ def cazar_datos_meta(datos, extraidos=None):
4
+ if extraidos is None:
5
+ extraidos = {}
6
+
7
+ if isinstance(datos, dict):
8
+ if 'string_list_data' in datos and isinstance(datos['string_list_data'], list) and len(datos['string_list_data']) > 0:
9
+ item = datos['string_list_data'][0]
10
+ ts = item.get('timestamp', 0)
11
+
12
+ if 'value' in item and item['value']:
13
+ extraidos[item['value']] = ts
14
+ elif 'title' in datos and datos['title']:
15
+ extraidos[datos['title']] = ts
16
+
17
+ for valor in datos.values():
18
+ cazar_datos_meta(valor, extraidos)
19
+
20
+ elif isinstance(datos, list):
21
+ for item in datos:
22
+ cazar_datos_meta(item, extraidos)
23
+
24
+ return extraidos
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Flask
2
+ Werkzeug
3
+ fastapi
4
+ uvicorn
static/img/paso1.png ADDED

Git LFS Details

  • SHA256: 2fb7f1913ed0ec4fe9cefb4203bc2d8026ea0f7ca0c201cd000f03c494a1889b
  • Pointer size: 131 Bytes
  • Size of remote file: 130 kB
static/img/paso2.png ADDED
static/img/paso3.png ADDED
static/img/paso4.png ADDED
templates/index.html ADDED
@@ -0,0 +1,437 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="es">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>InstaScanner | Descubre quién no te sigue</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <style>
9
+ /* ===== ANIMACIÓN DE INTRO ESTILO NETFLIX ===== */
10
+ @keyframes fadeInScale {
11
+ 0% { opacity: 0; transform: scale(0.8); }
12
+ 20% { opacity: 0.3; }
13
+ 100% { opacity: 1; transform: scale(1); }
14
+ }
15
+
16
+ @keyframes textGlow {
17
+ 0%, 100% { text-shadow: 0 0 20px rgba(168, 85, 247, 0.5), 0 0 40px rgba(236, 72, 153, 0.3); }
18
+ 50% { text-shadow: 0 0 40px rgba(168, 85, 247, 0.8), 0 0 80px rgba(236, 72, 153, 0.6); }
19
+ }
20
+
21
+ @keyframes slideUp {
22
+ from { opacity: 0; transform: translateY(30px); }
23
+ to { opacity: 1; transform: translateY(0); }
24
+ }
25
+
26
+ @keyframes fadeOut {
27
+ from { opacity: 1; }
28
+ to { opacity: 0; visibility: hidden; }
29
+ }
30
+
31
+ @keyframes pulse {
32
+ 0%, 100% { transform: scale(1); }
33
+ 50% { transform: scale(1.1); }
34
+ }
35
+
36
+ @keyframes shimmer {
37
+ 0% { background-position: -200% center; }
38
+ 100% { background-position: 200% center; }
39
+ }
40
+
41
+ .intro-animation {
42
+ position: fixed;
43
+ top: 0;
44
+ left: 0;
45
+ width: 100%;
46
+ height: 100%;
47
+ background: radial-gradient(circle at center, #1a1a2e 0%, #0a0a0f 100%);
48
+ z-index: 9999;
49
+ display: flex;
50
+ flex-direction: column;
51
+ align-items: center;
52
+ justify-content: center;
53
+ animation: fadeOut 1s ease-in-out 4s forwards;
54
+ }
55
+
56
+ .intro-content {
57
+ text-align: center;
58
+ animation: fadeInScale 2s ease-out;
59
+ }
60
+
61
+ .intro-title {
62
+ font-size: clamp(2.5rem, 8vw, 5rem);
63
+ font-weight: 900;
64
+ background: linear-gradient(135deg, #c084fc 0%, #ec4899 25%, #f472b6 50%, #c084fc 75%, #ec4899 100%);
65
+ background-size: 200% auto;
66
+ -webkit-background-clip: text;
67
+ background-clip: text;
68
+ color: transparent;
69
+ animation: textGlow 2s ease-in-out infinite, shimmer 3s linear infinite;
70
+ letter-spacing: -2px;
71
+ }
72
+
73
+ .intro-subtitle {
74
+ font-size: clamp(1rem, 3vw, 1.5rem);
75
+ color: #e0e0e0;
76
+ margin-top: 1rem;
77
+ opacity: 0;
78
+ animation: slideUp 1s ease-out 1s forwards;
79
+ letter-spacing: 2px;
80
+ }
81
+
82
+ .intro-creator {
83
+ font-size: clamp(0.8rem, 2vw, 1rem);
84
+ color: #888;
85
+ margin-top: 2rem;
86
+ opacity: 0;
87
+ animation: slideUp 1s ease-out 2s forwards;
88
+ font-style: italic;
89
+ }
90
+
91
+ .intro-logo {
92
+ width: 80px;
93
+ height: 80px;
94
+ margin-bottom: 2rem;
95
+ background: linear-gradient(45deg, #c084fc, #ec4899);
96
+ border-radius: 50%;
97
+ display: flex;
98
+ align-items: center;
99
+ justify-content: center;
100
+ font-size: 2.5rem;
101
+ animation: pulse 2s ease-in-out infinite;
102
+ box-shadow: 0 0 30px rgba(236, 72, 153, 0.6);
103
+ }
104
+
105
+ /* ===== REGLAS PARA IMPRESIÓN PDF ===== */
106
+ @media print {
107
+ body * { visibility: hidden; }
108
+ #seccionResultados, #seccionResultados * { visibility: visible; }
109
+ #seccionResultados { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: none; background: white; color: black; }
110
+ .no-print { display: none !important; }
111
+ .intro-animation { display: none !important; }
112
+ td, th, p, h2 { color: black !important; }
113
+ a { color: #2563eb !important; text-decoration: none; }
114
+ }
115
+
116
+ /* ===== ESTILOS ADICIONALES ===== */
117
+ .watermark {
118
+ position: fixed;
119
+ bottom: 20px;
120
+ right: 20px;
121
+ z-index: 50;
122
+ opacity: 0.3;
123
+ pointer-events: none;
124
+ transition: opacity 0.3s ease;
125
+ }
126
+
127
+ .watermark:hover {
128
+ opacity: 0.6;
129
+ }
130
+
131
+ .instagram-icon {
132
+ position: fixed;
133
+ bottom: 20px;
134
+ left: 20px;
135
+ z-index: 50;
136
+ width: 50px;
137
+ height: 50px;
138
+ background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
139
+ border-radius: 50%;
140
+ display: flex;
141
+ align-items: center;
142
+ justify-content: center;
143
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
144
+ transition: all 0.3s ease;
145
+ cursor: pointer;
146
+ }
147
+
148
+ .instagram-icon:hover {
149
+ transform: scale(1.1);
150
+ box-shadow: 0 6px 20px rgba(220, 39, 67, 0.5);
151
+ }
152
+
153
+ .fade-in-up {
154
+ animation: slideUp 0.5s ease-out;
155
+ }
156
+
157
+ .bg-gray-750 {
158
+ background-color: #1f2937;
159
+ }
160
+ </style>
161
+ </head>
162
+ <body class="bg-gray-900 text-gray-100 font-sans min-h-screen">
163
+
164
+ <!-- ===== INTRO ANIMATION ===== -->
165
+ <div class="intro-animation" id="introAnimation">
166
+ <div class="intro-content">
167
+ <div class="intro-logo">
168
+ 📸
169
+ </div>
170
+ <h1 class="intro-title">InstaScanner</h1>
171
+ <p class="intro-subtitle">Descubre quién no te sigue</p>
172
+ <p class="intro-creator">✨ Creado por Jonathan Loza ✨</p>
173
+ </div>
174
+ </div>
175
+
176
+ <!-- ===== MARCA DE AGUA ===== -->
177
+ <div class="watermark no-print">
178
+ <p class="text-xs text-gray-500">InstaScanner © Jonathan Loza</p>
179
+ </div>
180
+
181
+ <!-- ===== ICONO DE INSTAGRAM ===== -->
182
+ <a href="https://www.instagram.com/jonathan_loza05?igsh=MXViOTBhdm9saTVncA=="
183
+ target="_blank"
184
+ class="instagram-icon no-print"
185
+ title="Sígueme en Instagram">
186
+ <svg class="w-6 h-6 text-white" fill="currentColor" viewBox="0 0 24 24">
187
+ <path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z"/>
188
+ </svg>
189
+ </a>
190
+
191
+ <main class="max-w-4xl mx-auto p-4 md:p-6 mt-6 md:mt-10">
192
+ <!-- Encabezado -->
193
+ <div class="text-center mb-8 md:mb-10 no-print fade-in-up">
194
+ <h1 class="text-4xl md:text-5xl font-extrabold text-transparent bg-clip-text bg-gradient-to-r from-purple-400 to-pink-600 mb-4">
195
+ InstaScanner
196
+ </h1>
197
+ <p class="text-gray-400 text-base md:text-lg">Descubre quién no te devuelve el follow. 100% Privado y Seguro.</p>
198
+ </div>
199
+
200
+ <!-- Tutorial de Pasos -->
201
+ <div class="mb-12 no-print fade-in-up" style="animation-delay: 0.2s;">
202
+ <h2 class="text-2xl font-bold mb-6 text-center text-white">¿Cómo descargo mis datos correctamente?</h2>
203
+
204
+ <!-- Usamos un grid de 4 columnas para pantallas grandes -->
205
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
206
+
207
+ <!-- Paso 1 -->
208
+ <div class="bg-gray-800 rounded-xl p-5 border border-gray-700 shadow-lg relative transform transition hover:-translate-y-1 hover:shadow-2xl flex flex-col">
209
+ <div class="absolute -top-4 -left-4 bg-pink-500 w-10 h-10 rounded-full flex items-center justify-center font-bold text-lg shadow-lg">1</div>
210
+ <h3 class="text-lg font-bold mb-2 text-pink-400 mt-2">Crear Exportación</h3>
211
+ <p class="text-sm text-gray-400 mb-4 flex-grow">Ve a <strong>Ajustes > Centro de cuentas > Tu información</strong>. Toca "Descargar tu información" y selecciona <strong>"Crear exportación"</strong>.</p>
212
+ <div class="bg-gray-900 rounded-lg h-32 overflow-hidden border border-gray-600 flex items-center justify-center p-2 mt-auto">
213
+ <img src="{{ url_for('static', filename='img/paso1.png') }}" alt="Paso 1" class="w-full h-full object-contain opacity-90 hover:opacity-100 transition">
214
+ </div>
215
+ </div>
216
+
217
+ <!-- Paso 2 -->
218
+ <div class="bg-gray-800 rounded-xl p-5 border border-gray-700 shadow-lg relative transform transition hover:-translate-y-1 hover:shadow-2xl flex flex-col">
219
+ <div class="absolute -top-4 -left-4 bg-purple-500 w-10 h-10 rounded-full flex items-center justify-center font-bold text-lg shadow-lg">2</div>
220
+ <h3 class="text-lg font-bold mb-2 text-purple-400 mt-2">Elegir Destino</h3>
221
+ <p class="text-sm text-gray-400 mb-4 flex-grow">Selecciona el perfil de tu cuenta de Instagram y elige la opción <strong>"Exportar al dispositivo"</strong> para descargar el archivo en tu equipo.</p>
222
+ <div class="bg-gray-900 rounded-lg h-32 overflow-hidden border border-gray-600 flex items-center justify-center p-2 mt-auto">
223
+ <img src="{{ url_for('static', filename='img/paso2.png') }}" alt="Paso 2" class="w-full h-full object-contain opacity-90 hover:opacity-100 transition">
224
+ </div>
225
+ </div>
226
+
227
+ <!-- Paso 3 -->
228
+ <div class="bg-gray-800 rounded-xl p-5 border border-gray-700 shadow-lg relative transform transition hover:-translate-y-1 hover:shadow-2xl flex flex-col">
229
+ <div class="absolute -top-4 -left-4 bg-blue-500 w-10 h-10 rounded-full flex items-center justify-center font-bold text-lg shadow-lg">3</div>
230
+ <h3 class="text-lg font-bold mb-2 text-blue-400 mt-2">Filtrar Datos</h3>
231
+ <p class="text-sm text-gray-400 mb-4 flex-grow">Toca "Personalizar información". En la sección <em>Conexiones</em>, deja activada <strong>SOLO</strong> la casilla de <strong>"Seguidores y seguidos"</strong>.</p>
232
+ <div class="bg-gray-900 rounded-lg h-32 overflow-hidden border border-gray-600 flex items-center justify-center p-2 mt-auto">
233
+ <img src="{{ url_for('static', filename='img/paso3.png') }}" alt="Paso 3" class="w-full h-full object-contain opacity-90 hover:opacity-100 transition">
234
+ </div>
235
+ </div>
236
+
237
+ <!-- Paso 4 -->
238
+ <div class="bg-gray-800 rounded-xl p-5 border border-gray-700 shadow-lg relative transform transition hover:-translate-y-1 hover:shadow-2xl flex flex-col">
239
+ <div class="absolute -top-4 -left-4 bg-green-500 w-10 h-10 rounded-full flex items-center justify-center font-bold text-lg shadow-lg">4</div>
240
+ <h3 class="text-lg font-bold mb-2 text-green-400 mt-2">Formato JSON</h3>
241
+ <p class="text-sm text-gray-400 mb-4 flex-grow">Intervalo: <strong>"Desde el principio"</strong>. Formato: <strong>"JSON"</strong> (¡Vital!). Finalmente, haz clic en <strong>"Iniciar exportación"</strong>.</p>
242
+ <div class="bg-gray-900 rounded-lg h-32 overflow-hidden border border-gray-600 flex items-center justify-center p-2 mt-auto">
243
+ <img src="{{ url_for('static', filename='img/paso4.png') }}" alt="Paso 4" class="w-full h-full object-contain opacity-90 hover:opacity-100 transition">
244
+ </div>
245
+ </div>
246
+
247
+ </div>
248
+ </div>
249
+
250
+ <!-- Tarjeta de subida -->
251
+ <div class="bg-gray-800 rounded-2xl p-6 md:p-8 shadow-2xl border border-gray-700 mb-10 no-print fade-in-up">
252
+ <div class="mb-6 bg-blue-900/30 border-l-4 border-blue-500 p-4 rounded text-blue-200 text-xs md:text-sm">
253
+ <strong>🔒 Privacidad garantizada:</strong> Tus datos se procesan temporalmente y se destruyen automáticamente. No guardamos nada.
254
+ </div>
255
+
256
+ <form action="/" method="POST" enctype="multipart/form-data" class="flex flex-col items-center">
257
+ <label class="block mb-4 text-center w-full">
258
+ <span class="text-gray-300">Sube tu archivo <span class="font-mono text-pink-400">.zip</span> de Instagram</span>
259
+ <input type="file" name="archivo_zip" accept=".zip" required
260
+ class="mt-4 block w-full text-sm text-gray-400
261
+ file:mr-4 file:py-3 file:px-4 md:file:px-6
262
+ file:rounded-full file:border-0
263
+ file:text-sm file:font-bold
264
+ file:bg-purple-600 file:text-white
265
+ hover:file:bg-purple-700 cursor-pointer transition-all"/>
266
+ </label>
267
+ <button type="submit" class="mt-4 w-full md:w-auto bg-gradient-to-r from-pink-500 to-purple-600 hover:from-pink-600 hover:to-purple-700 text-white font-bold py-3 px-10 rounded-full shadow-lg transform transition hover:scale-105">
268
+ Escanear Seguidores
269
+ </button>
270
+ </form>
271
+ </div>
272
+
273
+ <!-- Zona de Resultados -->
274
+ {% if resultados %}
275
+ <div class="bg-gray-800 rounded-2xl p-6 md:p-8 shadow-2xl border border-gray-700 animate-fade-in-up" id="seccionResultados">
276
+ <h2 class="text-2xl md:text-3xl font-bold mb-6 text-center text-white">📊 Tu Reporte Oficial</h2>
277
+
278
+ <div class="grid grid-cols-1 sm:grid-cols-3 gap-4 mb-8">
279
+ <div class="bg-gray-700 p-4 rounded-xl text-center border border-gray-600">
280
+ <p class="text-xs md:text-sm text-gray-400">Tú Sigues a</p>
281
+ <p class="text-2xl md:text-3xl font-bold text-blue-400">{{ resultados.total_siguiendo }}</p>
282
+ </div>
283
+ <div class="bg-gray-700 p-4 rounded-xl text-center border border-gray-600">
284
+ <p class="text-xs md:text-sm text-gray-400">Te Siguen</p>
285
+ <p class="text-2xl md:text-3xl font-bold text-green-400">{{ resultados.total_seguidores }}</p>
286
+ </div>
287
+ <div class="bg-gray-700 p-4 rounded-xl text-center border border-gray-600 border-b-4 border-b-red-500">
288
+ <p class="text-xs md:text-sm text-gray-400">No te siguen</p>
289
+ <p class="text-2xl md:text-3xl font-bold text-red-400">{{ resultados.traidores|length }}</p>
290
+ </div>
291
+ </div>
292
+
293
+ <!-- Controles: Buscador y Exportar -->
294
+ <div class="flex flex-col md:flex-row justify-between items-center mb-6 space-y-4 md:space-y-0 no-print">
295
+ <input type="text" id="buscador" placeholder="🔍 Buscar usuario..."
296
+ class="bg-gray-900 border border-gray-600 text-white text-sm rounded-lg focus:ring-pink-500 focus:border-pink-500 block w-full md:w-64 p-2.5">
297
+
298
+ <div class="flex flex-col sm:flex-row w-full md:w-auto space-y-2 sm:space-y-0 sm:space-x-2">
299
+ <button onclick="window.print()" class="flex items-center justify-center w-full sm:w-auto bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2 px-4 rounded border border-blue-500 transition">
300
+ <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
301
+ PDF
302
+ </button>
303
+ <button onclick="exportarCSV()" class="flex items-center justify-center w-full sm:w-auto bg-green-600 hover:bg-green-700 text-white font-semibold py-2 px-4 rounded border border-green-500 transition">
304
+ <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
305
+ CSV
306
+ </button>
307
+ </div>
308
+ </div>
309
+
310
+ <!-- Tabla -->
311
+ <div class="overflow-x-auto rounded-lg border border-gray-700">
312
+ <table class="w-full text-left border-collapse" id="tablaUsuarios">
313
+ <thead>
314
+ <tr class="bg-gray-900 text-gray-400 text-xs md:text-sm uppercase">
315
+ <th class="p-3 md:p-4 border-b border-gray-700">Usuario</th>
316
+ <th class="p-3 md:p-4 border-b border-gray-700 text-right">Te fuiste de follow el</th>
317
+ </tr>
318
+ </thead>
319
+ <tbody class="divide-y divide-gray-700" id="cuerpoTabla">
320
+ {% for persona in resultados.traidores %}
321
+ <tr class="hover:bg-gray-750 transition duration-150 fila-usuario">
322
+ <td class="p-3 md:p-4 text-white font-medium nombre-usuario">
323
+ <a href="https://instagram.com/{{ persona.usuario }}" target="_blank" class="hover:text-pink-400 transition">
324
+ @{{ persona.usuario }}
325
+ </a>
326
+ </td>
327
+ <td class="p-3 md:p-4 text-right text-gray-400 text-xs md:text-sm">{{ persona.fecha }}</td>
328
+ </tr>
329
+ {% endfor %}
330
+ </tbody>
331
+ </table>
332
+ </div>
333
+
334
+ <!-- Controles de Paginación -->
335
+ <div class="flex justify-between items-center mt-6 no-print">
336
+ <button id="btnAnterior" onclick="cambiarPagina(-1)" class="bg-gray-700 hover:bg-gray-600 text-gray-200 px-4 py-2 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed">
337
+ Anterior
338
+ </button>
339
+ <span id="infoPagina" class="text-gray-400 text-sm font-medium"></span>
340
+ <button id="btnSiguiente" onclick="cambiarPagina(1)" class="bg-gray-700 hover:bg-gray-600 text-gray-200 px-4 py-2 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed">
341
+ Siguiente
342
+ </button>
343
+ </div>
344
+ </div>
345
+
346
+ <script>
347
+ // === CONTROL DE LA ANIMACIÓN DE INTRO ===
348
+ document.addEventListener('DOMContentLoaded', function() {
349
+ // La animación se oculta automáticamente después de 4 segundos (definido en CSS)
350
+ // Pero también podemos agregar un fallback por si acaso
351
+ setTimeout(function() {
352
+ const intro = document.getElementById('introAnimation');
353
+ if (intro) {
354
+ intro.style.display = 'none';
355
+ }
356
+ }, 4500); // 4.5 segundos para asegurar que la transición termine
357
+ });
358
+
359
+ // === LÓGICA DE PAGINACIÓN Y BUSCADOR ===
360
+ let paginaActual = 1;
361
+ const filasPorPagina = 20;
362
+ let todasLasFilas = Array.from(document.querySelectorAll('.fila-usuario'));
363
+ let filasFiltradas = todasLasFilas;
364
+
365
+ function renderizarTabla() {
366
+ // Ocultar todas las filas
367
+ todasLasFilas.forEach(fila => fila.style.display = 'none');
368
+
369
+ // Calcular qué filas mostrar
370
+ let inicio = (paginaActual - 1) * filasPorPagina;
371
+ let fin = inicio + filasPorPagina;
372
+
373
+ filasFiltradas.slice(inicio, fin).forEach(fila => fila.style.display = '');
374
+
375
+ // Actualizar info y botones
376
+ let totalPaginas = Math.ceil(filasFiltradas.length / filasPorPagina) || 1;
377
+ document.getElementById('infoPagina').innerText = `Página ${paginaActual} de ${totalPaginas}`;
378
+ document.getElementById('btnAnterior').disabled = paginaActual === 1;
379
+ document.getElementById('btnSiguiente').disabled = paginaActual === totalPaginas;
380
+ }
381
+
382
+ function cambiarPagina(direccion) {
383
+ paginaActual += direccion;
384
+ renderizarTabla();
385
+ }
386
+
387
+ // Buscador en tiempo real
388
+ document.getElementById('buscador').addEventListener('keyup', function() {
389
+ let filtro = this.value.toLowerCase();
390
+ filasFiltradas = todasLasFilas.filter(fila => {
391
+ let nombre = fila.querySelector('.nombre-usuario').textContent.toLowerCase();
392
+ return nombre.includes(filtro);
393
+ });
394
+ paginaActual = 1; // Volver a la página 1 al buscar
395
+ renderizarTabla();
396
+ });
397
+
398
+ // Inicializar tabla al cargar
399
+ if(todasLasFilas.length > 0) {
400
+ renderizarTabla();
401
+ }
402
+
403
+ // === LÓGICA DE EXPORTACIÓN CSV ===
404
+ function exportarCSV() {
405
+ let csv = [];
406
+ // Exportamos los datos filtrados actualmente (no solo la página)
407
+ filasFiltradas.forEach(function(fila) {
408
+ let columnas = fila.querySelectorAll('th, td');
409
+ let filaCSV = [];
410
+ columnas.forEach(function(columna) {
411
+ let texto = columna.innerText.replace('@', '').trim();
412
+ filaCSV.push('"' + texto + '"');
413
+ });
414
+ csv.push(filaCSV.join(','));
415
+ });
416
+
417
+ let csvCompleto = csv.join('\n');
418
+ let blob = new Blob([csvCompleto], { type: 'text/csv;charset=utf-8;' });
419
+ let link = document.createElement("a");
420
+ link.setAttribute("href", URL.createObjectURL(blob));
421
+ link.setAttribute("download", "InstaScanner_Reporte.csv");
422
+ link.style.visibility = 'hidden';
423
+ document.body.appendChild(link);
424
+ link.click();
425
+ document.body.removeChild(link);
426
+ }
427
+ </script>
428
+ {% endif %}
429
+ </main>
430
+ <!-- Script para evitar el mensaje de "Confirmar reenvío de formulario" al recargar -->
431
+ <script>
432
+ if (window.history.replaceState) {
433
+ window.history.replaceState(null, null, window.location.href);
434
+ }
435
+ </script>
436
+ </body>
437
+ </html>