+ `;
+ }
+ resultsList.appendChild(tr);
+ });
+
+ resultsCount.textContent = successCount;
+
+ if (successCount > 0) {
+ btnCopyAllTop.classList.remove('hidden');
+ bulkActions.classList.remove('hidden');
+ setupRowEventListeners();
+ updateSelectedCount();
+ } else {
+ btnCopyAllTop.classList.add('hidden');
+ if (parsedResults.length > 0) {
+ // All failed
+ setupRowEventListeners();
+ } else {
+ // Empty
+ resultsPlaceholder.classList.remove('hidden');
+ resultsTable.classList.add('hidden');
+ }
+ }
+ }
+
+ // Row operations listeners
+ function setupRowEventListeners() {
+ // Checkboxes change
+ const checkboxes = resultsList.querySelectorAll('.result-item-checkbox');
+ checkboxes.forEach(cb => {
+ cb.addEventListener('change', () => {
+ updateSelectedCount();
+ // Sync master select checkbox
+ const allChecked = Array.from(checkboxes).every(c => c.checked);
+ selectAllCheckbox.checked = allChecked;
+ });
+ });
+
+ // Copy row button
+ resultsList.querySelectorAll('.btn-copy-row').forEach(btn => {
+ btn.addEventListener('click', (e) => {
+ const index = parseInt(btn.dataset.index, 10);
+ const item = parsedResults[index];
+ navigator.clipboard.writeText(item.hlsUrl).then(() => {
+ showToast('¡Enlace HLS copiado!');
+ btn.classList.add('success-toast');
+ setTimeout(() => btn.classList.remove('success-toast'), 1500);
+ });
+ });
+ });
+
+ // Copy error raw link
+ resultsList.querySelectorAll('.btn-copy-page').forEach(btn => {
+ btn.addEventListener('click', () => {
+ const url = btn.dataset.url;
+ navigator.clipboard.writeText(url).then(() => {
+ showToast('URL original copiada');
+ });
+ });
+ });
+
+ // Open row button
+ resultsList.querySelectorAll('.btn-open-row').forEach(btn => {
+ btn.addEventListener('click', () => {
+ const url = btn.dataset.url;
+ chrome.tabs.create({ url: url });
+ });
+ });
+ }
+
+ // Update selected badge
+ function updateSelectedCount() {
+ const count = getSelectedUrls().length;
+ selectedCount.textContent = `${count} seleccionado${count !== 1 ? 's' : ''}`;
+
+ // Disable/Enable bulk buttons
+ btnBulkCopy.disabled = count === 0;
+ btnBulkOpen.disabled = count === 0;
+ btnBulkDownload.disabled = count === 0;
+ }
+
+ // Retrieve selections
+ function getSelectedUrls() {
+ const selectedUrls = [];
+ const checkboxes = resultsList.querySelectorAll('.result-item-checkbox:checked');
+ checkboxes.forEach(cb => {
+ const index = parseInt(cb.dataset.index, 10);
+ selectedUrls.push(parsedResults[index].hlsUrl);
+ });
+ return selectedUrls;
+ }
+
+ function getSelectedItems() {
+ const selected = [];
+ const checkboxes = resultsList.querySelectorAll('.result-item-checkbox:checked');
+ checkboxes.forEach(cb => {
+ const index = parseInt(cb.dataset.index, 10);
+ selected.push(parsedResults[index]);
+ });
+ return selected;
+ }
+
+ // UI Helpers
+ function updateProgress(percentage, total, text) {
+ progressBar.style.width = `${percentage}%`;
+ progressStatus.textContent = text;
+ progressPercentage.textContent = `${percentage}%`;
+ }
+
+ function showToast(message) {
+ toast.textContent = message;
+ toast.classList.remove('hidden');
+ toast.classList.add('show');
+
+ setTimeout(() => {
+ toast.classList.remove('show');
+ setTimeout(() => toast.classList.add('hidden'), 300);
+ }, 2500);
+ }
+});
+
+// Simple Queue worker framework to run requests in parallel with concurrency limit
+class Queue {
+ constructor(tasks, concurrency, progressCallback, completionCallback) {
+ this.tasks = tasks;
+ this.concurrency = concurrency;
+ this.progressCallback = progressCallback;
+ this.completionCallback = completionCallback;
+
+ this.activeCount = 0;
+ this.completedCount = 0;
+ this.currentIndex = 0;
+ this.results = [];
+ this.isCancelled = false;
+ }
+
+ start() {
+ if (this.tasks.length === 0) {
+ this.completionCallback([]);
+ return;
+ }
+ const limit = Math.min(this.concurrency, this.tasks.length);
+ for (let i = 0; i < limit; i++) {
+ this.next();
+ }
+ }
+
+ cancel() {
+ this.isCancelled = true;
+ }
+
+ next() {
+ if (this.isCancelled || this.currentIndex >= this.tasks.length) {
+ if (this.activeCount === 0) {
+ this.completionCallback(this.results);
+ }
+ return;
+ }
+
+ const index = this.currentIndex++;
+ const task = this.tasks[index];
+ this.activeCount++;
+
+ task().then(result => {
+ if (!this.isCancelled) {
+ this.results[index] = result;
+ }
+ }).catch(err => {
+ if (!this.isCancelled) {
+ this.results[index] = {
+ originalUrl: task.url || '',
+ title: task.url || 'Error',
+ error: err.message,
+ success: false
+ };
+ }
+ }).finally(() => {
+ this.activeCount--;
+ this.completedCount++;
+
+ if (!this.isCancelled) {
+ this.progressCallback(this.completedCount, this.tasks.length);
+ this.next();
+ }
+ });
+ }
+}
diff --git a/detector de enlaces - copia/background.js b/detector de enlaces - copia/background.js
new file mode 100644
index 0000000000000000000000000000000000000000..b7f82881fa814fa85cd72898f59b1987c7aca90d
--- /dev/null
+++ b/detector de enlaces - copia/background.js
@@ -0,0 +1,351 @@
+let videoScanState = {
+ isScanning: false,
+ scannedCount: 0,
+ totalCount: 0,
+ foundUrls: [],
+ albumUrls: [],
+ error: null
+};
+
+let imageScanState = {
+ isScanning: false,
+ scannedCount: 0,
+ totalCount: 0,
+ foundUrls: [],
+ albumUrls: [],
+ error: null
+};
+
+function isAlbumImageUrl(url) {
+ if (!url) return false;
+ const lower = url.toLowerCase();
+ if (lower.includes('/avatar/') || lower.includes('/icon/') || lower.includes('/logo/') || lower.includes('logo') || lower.includes('/thumbs/') || lower.includes('/img/')) {
+ return false;
+ }
+ return true;
+}
+
+let activeNativePort = null;
+let activeTaskState = {
+ isProcessing: false,
+ type: null,
+ status: 'idle',
+ info: '',
+ current: 0,
+ total: 0,
+ file: null,
+ error: null
+};
+
+// Initialize task state from storage if present
+chrome.storage.local.get(['activeTask', 'videoScanState', 'imageScanState'], (res) => {
+ if (res.activeTask) activeTaskState = res.activeTask;
+ if (res.videoScanState) videoScanState = res.videoScanState;
+ if (res.imageScanState) imageScanState = res.imageScanState;
+});
+
+function updateTaskState(newState) {
+ activeTaskState = { ...activeTaskState, ...newState };
+ chrome.storage.local.set({ activeTask: activeTaskState }).catch(() => {});
+ chrome.runtime.sendMessage({ type: 'TASK_UPDATE', payload: activeTaskState }).catch(() => {});
+}
+
+function runNativeTask(msg, sendResponse) {
+ if (activeTaskState.isProcessing) {
+ if (sendResponse) sendResponse({ success: false, message: 'Un proceso ya está en ejecución' });
+ return;
+ }
+
+ updateTaskState({
+ isProcessing: true,
+ type: msg.type,
+ status: 'started',
+ info: 'Iniciando conexión con Python...',
+ current: 0,
+ total: 0,
+ file: null,
+ error: null
+ });
+
+ try {
+ if (activeNativePort) {
+ try { activeNativePort.disconnect(); } catch (e) {}
+ activeNativePort = null;
+ }
+
+ activeNativePort = chrome.runtime.connectNative("com.linkdetector.kemono");
+
+ activeNativePort.onMessage.addListener((nativeMsg) => {
+ if (nativeMsg.status === "progress") {
+ let infoStr = nativeMsg.info;
+ if (!infoStr && nativeMsg.current) {
+ infoStr = `Procesando ${nativeMsg.current}/${nativeMsg.total || '?'}`;
+ }
+ updateTaskState({
+ status: "progress",
+ current: nativeMsg.current || 0,
+ total: nativeMsg.total || 0,
+ info: infoStr || "Procesando en segundo plano..."
+ });
+ } else if (nativeMsg.status === "done") {
+ updateTaskState({
+ isProcessing: false,
+ status: "done",
+ info: nativeMsg.file ? `¡Guardado en ${nativeMsg.file}!` : "¡Completado exitosamente!",
+ file: nativeMsg.file
+ });
+ try { activeNativePort.disconnect(); } catch (e) {}
+ activeNativePort = null;
+ } else if (nativeMsg.status === "error") {
+ updateTaskState({
+ isProcessing: false,
+ status: "error",
+ error: nativeMsg.message || "Error en proceso Python",
+ info: "Error: " + (nativeMsg.message || "Error en Python")
+ });
+ try { activeNativePort.disconnect(); } catch (e) {}
+ activeNativePort = null;
+ }
+ });
+
+ activeNativePort.onDisconnect.addListener(() => {
+ let errMsg = chrome.runtime.lastError ? chrome.runtime.lastError.message : "Desconectado de Host";
+ if (activeTaskState.isProcessing) {
+ updateTaskState({
+ isProcessing: false,
+ status: "error",
+ error: errMsg,
+ info: errMsg.includes("host not found") ? "No se encontró el Host de Python. Ejecuta instalar_python_host.bat" : ("Conexión cerrada: " + errMsg)
+ });
+ }
+ activeNativePort = null;
+ });
+
+ // Obtener cookies de kemono.cr, kemono.su y pawchive.st para pasarlas a Python
+ chrome.cookies.getAll({ domain: "kemono.cr" }, (cookiesCR) => {
+ chrome.cookies.getAll({ domain: "kemono.su" }, (cookiesSU) => {
+ chrome.cookies.getAll({ domain: "pawchive.st" }, (cookiesPawchive) => {
+ let allCookies = [...cookiesCR, ...cookiesSU, ...cookiesPawchive];
+ let cookieStr = allCookies.map(c => c.name + "=" + c.value).join("; ");
+ let ua = navigator.userAgent;
+
+ msg.cookies = cookieStr;
+ msg.userAgent = ua;
+
+ if (activeNativePort) {
+ activeNativePort.postMessage(msg);
+ if (sendResponse) sendResponse({ success: true, state: activeTaskState });
+ }
+ });
+ });
+ });
+ } catch (e) {
+ updateTaskState({
+ isProcessing: false,
+ status: "error",
+ error: e.message,
+ info: "Error: " + e.message
+ });
+ if (sendResponse) sendResponse({ success: false, error: e.message });
+ }
+}
+
+chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
+ if (message.type === 'GET_STATE') {
+ sendResponse({ video: videoScanState, image: imageScanState, activeTask: activeTaskState });
+ return true;
+ }
+
+ if (message.type === 'START_NATIVE_TASK') {
+ runNativeTask(message.payload, sendResponse);
+ return true;
+ }
+
+ if (message.type === 'GET_TASK_STATE') {
+ sendResponse(activeTaskState);
+ return true;
+ }
+
+ if (message.type === 'FETCH_SURRIT') {
+ fetch(message.url, {
+ headers: {
+ 'Referer': message.referer || 'https://surrit.store/',
+ 'Origin': 'https://surrit.store'
+ }
+ })
+ .then(res => {
+ if (!res.ok) throw new Error('HTTP status ' + res.status);
+ return res.json();
+ })
+ .then(data => sendResponse({ success: true, data }))
+ .catch(err => sendResponse({ success: false, error: err.message }));
+ return true;
+ }
+
+ if (message.type === 'START_SCAN') {
+ if (!videoScanState.isScanning) {
+ startScan(message.payload.albumUrls, message.payload.currentVideos);
+ }
+ sendResponse(videoScanState);
+ return true;
+ }
+
+ if (message.type === 'RESET_SCAN') {
+ if (!videoScanState.isScanning) {
+ videoScanState = {
+ isScanning: false,
+ scannedCount: 0,
+ totalCount: 0,
+ foundUrls: [],
+ albumUrls: [],
+ error: null
+ };
+ chrome.storage.local.set({ videoScanState });
+ }
+ sendResponse(videoScanState);
+ return true;
+ }
+
+ if (message.type === 'START_IMAGE_SCAN') {
+ if (!imageScanState.isScanning) {
+ startImageScan(message.payload.albumUrls, message.payload.currentImages);
+ }
+ sendResponse(imageScanState);
+ return true;
+ }
+
+ if (message.type === 'RESET_IMAGE_SCAN') {
+ if (!imageScanState.isScanning) {
+ imageScanState = {
+ isScanning: false,
+ scannedCount: 0,
+ totalCount: 0,
+ foundUrls: [],
+ albumUrls: [],
+ error: null
+ };
+ chrome.storage.local.set({ imageScanState });
+ }
+ sendResponse(imageScanState);
+ return true;
+ }
+});
+
+async function startScan(albumUrls, initialVideos) {
+ videoScanState.isScanning = true;
+ videoScanState.albumUrls = albumUrls;
+ videoScanState.totalCount = albumUrls.length;
+ videoScanState.scannedCount = 0;
+ videoScanState.foundUrls = Array.from(new Set(initialVideos || []));
+ videoScanState.error = null;
+
+ chrome.storage.local.set({ videoScanState });
+ chrome.runtime.sendMessage({ type: 'SCAN_UPDATE', payload: videoScanState }).catch(() => {});
+
+ for (const url of albumUrls) {
+ videoScanState.scannedCount++;
+ try {
+ let res = await fetch(url);
+ let text = await res.text();
+
+ let newUrls = new Set();
+ let srcMatches = text.matchAll(/src=["'](https?:\/\/[^"'\s]+\.mp4)['"]/gi);
+ for (const match of srcMatches) {
+ newUrls.add(match[1]);
+ }
+
+ let hrefMatches = text.matchAll(/href=["'](https?:\/\/[^"'\s]+\.mp4)['"]/gi);
+ for (const match of hrefMatches) {
+ newUrls.add(match[1]);
+ }
+
+ for (const u of newUrls) {
+ if (!videoScanState.foundUrls.includes(u)) {
+ videoScanState.foundUrls.push(u);
+ }
+ }
+ } catch (e) {
+ console.error("Error fetching album", url, e);
+ }
+
+ chrome.storage.local.set({ videoScanState });
+ chrome.runtime.sendMessage({ type: 'SCAN_UPDATE', payload: videoScanState }).catch(() => {});
+ }
+
+ videoScanState.isScanning = false;
+ chrome.storage.local.set({ videoScanState });
+ chrome.runtime.sendMessage({ type: 'SCAN_UPDATE', payload: videoScanState }).catch(() => {});
+}
+
+async function startImageScan(albumUrls, initialImages) {
+ imageScanState.isScanning = true;
+ imageScanState.albumUrls = albumUrls;
+ imageScanState.totalCount = albumUrls.length;
+ imageScanState.scannedCount = 0;
+ imageScanState.foundUrls = Array.from(new Set(initialImages || []));
+ imageScanState.error = null;
+
+ chrome.storage.local.set({ imageScanState });
+ chrome.runtime.sendMessage({ type: 'IMAGE_SCAN_UPDATE', payload: imageScanState }).catch(() => {});
+
+ for (const url of albumUrls) {
+ imageScanState.scannedCount++;
+ const albumMatch = url.match(/erome\.com\/a\/([a-zA-Z0-9]+)/);
+ const albumId = albumMatch ? albumMatch[1] : null;
+
+ try {
+ let res = await fetch(url);
+ let text = await res.text();
+
+ let newUrls = new Set();
+ let imgMatches = text.matchAll(/https?:\/\/[a-z0-9\.]*erome\.com\/[^"'\s\)]+\.(?:jpg|jpeg|png|webp)(?:\?[^"'\s\)]+)?/gi);
+ for (const match of imgMatches) {
+ const imgUrl = match[0];
+ if (isAlbumImageUrl(imgUrl)) {
+ if (albumId && imgUrl.toLowerCase().includes('/' + albumId.toLowerCase() + '/')) {
+ newUrls.add(imgUrl);
+ }
+ }
+ }
+
+ for (const u of newUrls) {
+ if (!imageScanState.foundUrls.includes(u)) {
+ imageScanState.foundUrls.push(u);
+ }
+ }
+ } catch (e) {
+ console.error("Error fetching album", url, e);
+ }
+
+ chrome.storage.local.set({ imageScanState });
+ chrome.runtime.sendMessage({ type: 'IMAGE_SCAN_UPDATE', payload: imageScanState }).catch(() => {});
+ }
+
+ imageScanState.isScanning = false;
+ chrome.storage.local.set({ imageScanState });
+ chrome.runtime.sendMessage({ type: 'IMAGE_SCAN_UPDATE', payload: imageScanState }).catch(() => {});
+}
+
+// Proxy for Native Messaging (content scripts -> native host)
+chrome.runtime.onConnect.addListener((port) => {
+ if (port.name === "kemono-native-proxy") {
+ const messageListener = (msg) => {
+ if (msg.type === "EXTRACT_KEMONO" || msg.type === "SAVE_KEMONO" || msg.type === "DOWNLOAD_IMAGES_KEMONO") {
+ runNativeTask(msg);
+ }
+ };
+ port.onMessage.addListener(messageListener);
+
+ const updateListener = (msg) => {
+ if (msg.type === "TASK_UPDATE") {
+ try { port.postMessage(msg.payload); } catch (e) {}
+ }
+ };
+ chrome.runtime.onMessage.addListener(updateListener);
+
+ port.onDisconnect.addListener(() => {
+ chrome.runtime.onMessage.removeListener(updateListener);
+ // DO NOT DISCONNECT activeNativePort HERE! Let native task complete in background!
+ });
+ }
+});
diff --git a/detector de enlaces - copia/host/__pycache__/kemono_host.cpython-311.pyc b/detector de enlaces - copia/host/__pycache__/kemono_host.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5797657fd0c9f4c46915906ad8dc772307e3873c
Binary files /dev/null and b/detector de enlaces - copia/host/__pycache__/kemono_host.cpython-311.pyc differ
diff --git a/detector de enlaces - copia/host/com.linkdetector.kemono.json b/detector de enlaces - copia/host/com.linkdetector.kemono.json
new file mode 100644
index 0000000000000000000000000000000000000000..534c7a854716deb7962d35fae4d9ef1a3c7bb0d6
--- /dev/null
+++ b/detector de enlaces - copia/host/com.linkdetector.kemono.json
@@ -0,0 +1,9 @@
+{
+ "name": "com.linkdetector.kemono",
+ "description": "Extractor de enlaces de Kemono",
+ "path": "C:\\Users\\Gonzalo\\Desktop\\extesione sherrameitnas\\detector de enlaces - copia\\host\\kemono_host.bat",
+ "type": "stdio",
+ "allowed_origins": [
+ "chrome-extension://nonloheakmkaplfdedilgmlkdhohfnbc/"
+ ]
+}
diff --git a/detector de enlaces - copia/host/kemono_host.bat b/detector de enlaces - copia/host/kemono_host.bat
new file mode 100644
index 0000000000000000000000000000000000000000..f4962e53ff60b59b126388cd2cbb8fa706275f56
--- /dev/null
+++ b/detector de enlaces - copia/host/kemono_host.bat
@@ -0,0 +1,6 @@
+@echo off
+pip show cloudscraper >nul 2>&1
+if errorlevel 1 (
+ pip install cloudscraper
+)
+python "%~dp0kemono_host.py" %*
diff --git a/detector de enlaces - copia/host/kemono_host.py b/detector de enlaces - copia/host/kemono_host.py
new file mode 100644
index 0000000000000000000000000000000000000000..4534d8fa7b55d9a567f14e3469807e6907f90f4b
--- /dev/null
+++ b/detector de enlaces - copia/host/kemono_host.py
@@ -0,0 +1,285 @@
+import sys
+import json
+import struct
+import os
+import time
+import urllib.parse
+import urllib.request
+import re
+try:
+ import cloudscraper
+except ImportError:
+ cloudscraper = None
+import concurrent.futures
+import threading
+
+def get_message():
+ raw_length = sys.stdin.buffer.read(4)
+ if len(raw_length) == 0:
+ return None
+ message_length = struct.unpack('@I', raw_length)[0]
+ message = sys.stdin.buffer.read(message_length).decode('utf-8')
+ return json.loads(message)
+
+def encode_message(message_content):
+ encoded_content = json.dumps(message_content).encode('utf-8')
+ encoded_length = struct.pack('@I', len(encoded_content))
+ return {'length': encoded_length, 'content': encoded_content}
+
+def send_message(message_content):
+ encoded = encode_message(message_content)
+ sys.stdout.buffer.write(encoded['length'])
+ sys.stdout.buffer.write(encoded['content'])
+ sys.stdout.buffer.flush()
+
+def extract_links(urls, cookie_str, user_agent):
+ desktop = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')
+ output_file = os.path.join(desktop, 'kemono_downloads_extraidos.txt')
+
+ send_message({"status": "started", "total": len(urls)})
+
+ unique_urls = list(set([u.rstrip('/') for u in urls]))
+
+ count = 0
+ scraper = cloudscraper.create_scraper(browser={'browser': 'chrome', 'platform': 'windows', 'desktop': True}) if cloudscraper else None
+
+ with open(output_file, 'a', encoding='utf-8') as f:
+ f.write("\n=========================================\n")
+ f.write(f"NUEVA EXTRACCION - {time.strftime('%Y-%m-%d %H:%M:%S')}\n")
+ f.write("=========================================\n\n")
+
+ # Configurar headers exactos del navegador Chrome del usuario
+ headers = {
+ 'User-Agent': user_agent or 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
+ 'Cookie': cookie_str or '',
+ 'Accept': 'application/json, text/plain, */*'
+ }
+
+ for url in unique_urls:
+ count += 1
+ try:
+ parsed = urllib.parse.urlparse(url)
+ api_path = '/api/v1' + parsed.path
+ api_url = f"{parsed.scheme}://{parsed.netloc}{api_path}"
+
+ if scraper:
+ response = scraper.get(api_url, headers=headers)
+ response.raise_for_status()
+ data = response.json()
+ else:
+ req = urllib.request.Request(api_url, headers=headers)
+ with urllib.request.urlopen(req) as response:
+ data = json.loads(response.read().decode())
+
+ post_data = data.get('post', data)
+ title = post_data.get('title', 'Desconocido').strip()
+ author = post_data.get('user', 'Desconocido')
+
+ download_links = []
+
+ def is_image(name):
+ return bool(re.search(r'\.(jpg|jpeg|png|webp|gif|avif)$', name or '', re.I))
+
+ def construct_link(file_obj):
+ if not file_obj or not file_obj.get('path'): return None
+ path = file_obj['path']
+ if not path.startswith('http') and not path.startswith('/data'):
+ path = '/data' + ('' if path.startswith('/') else '/') + path
+ link = path if path.startswith('http') else f"{parsed.scheme}://{parsed.netloc}{path}"
+ if file_obj.get('name'):
+ link += f"?f={urllib.parse.quote(file_obj['name'])}"
+ return link
+
+ # Main file
+ if post_data.get('file') and post_data['file'].get('path'):
+ if not is_image(post_data['file'].get('name')):
+ lk = construct_link(post_data['file'])
+ if lk: download_links.append(lk)
+
+ # Attachments
+ attachs = post_data.get('attachments', []) or data.get('attachments', [])
+ for att in attachs:
+ if not is_image(att.get('name')):
+ lk = construct_link(att)
+ if lk: download_links.append(lk)
+
+ # Content links
+ content = post_data.get('content', '')
+ if content:
+ # Find all links in href="..." or basic urls
+ hrefs = re.findall(r'href=["\'](https?://[^"\']+)["\']', content)
+ urls_in_text = re.findall(r'(https?://[^\s<"\'\)]+)', content)
+ for u in set(hrefs + urls_in_text):
+ if ('kemono.cr' not in u and 'kemono.su' not in u and 'pawchive.st' not in u) or '/downloads' in u or '/data/' in u:
+ download_links.append(u)
+
+ download_links = list(set(download_links))
+
+ post_text = f"Titulo: {title}\nEnlace original: {url}\nAutor: {author}\nEnlaces de descarga:\n"
+ if download_links:
+ for idx, link in enumerate(download_links, 1):
+ post_text += f"({idx}) {link}\n"
+ else:
+ post_text += "No hay enlaces\n"
+ post_text += "\n"
+
+ f.write(post_text)
+ send_message({"status": "progress", "current": count, "total": len(unique_urls)})
+
+ time.sleep(1) # Be nice to the API
+
+ except Exception as e:
+ f.write(f"ERROR: {url} -> {str(e)}\n\n")
+ send_message({"status": "progress", "current": count, "total": len(unique_urls), "error": str(e)})
+
+ send_message({"status": "done", "file": output_file})
+
+def clean_filename(name):
+ """Remove invalid characters for Windows paths"""
+ return re.sub(r'[\\/:*?"<>|]', '', str(name)).strip()
+
+def download_kemono_images(posts, cookie_str, user_agent):
+ downloads_dir = os.path.join(os.environ['USERPROFILE'], 'Downloads')
+ base_dir = os.path.join(downloads_dir, 'Kemono Images')
+ os.makedirs(base_dir, exist_ok=True)
+
+ send_message({"status": "started", "total": len(posts)})
+
+ scraper = cloudscraper.create_scraper(browser={'browser': 'chrome', 'platform': 'windows', 'desktop': True}) if cloudscraper else None
+
+ headers = {
+ 'User-Agent': user_agent or 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
+ 'Cookie': cookie_str or '',
+ 'Accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8'
+ }
+
+ total_images_all = sum(len(post.get('images', [])) for post in posts)
+ images_downloaded = 0
+ lock = threading.Lock()
+
+ def download_image(img_info):
+ nonlocal images_downloaded
+
+ post = img_info['post']
+ idx = img_info['idx']
+ img_url = img_info['url']
+ post_dir = img_info['dir']
+ title_clean = img_info['title']
+
+ try:
+ if not img_url.startswith('http'):
+ parsed = urllib.parse.urlparse(post.get('url'))
+ img_url = f"{parsed.scheme}://{parsed.netloc}{img_url}"
+
+ extMatch = re.search(r'\.(jpg|jpeg|png|webp|gif|avif)', img_url, re.I)
+ ext = extMatch.group(0).lower() if extMatch else '.jpg'
+
+ filename = f"img_{idx:03d}{ext}"
+ filepath = os.path.join(post_dir, filename)
+
+ if not os.path.exists(filepath):
+ if scraper:
+ response = scraper.get(img_url, headers=headers, stream=True)
+ response.raise_for_status()
+ with open(filepath, 'wb') as f:
+ for chunk in response.iter_content(chunk_size=8192):
+ if chunk: f.write(chunk)
+ else:
+ req = urllib.request.Request(img_url, headers=headers)
+ with urllib.request.urlopen(req) as response, open(filepath, 'wb') as out_file:
+ while True:
+ chunk = response.read(65536)
+ if not chunk: break
+ out_file.write(chunk)
+ except Exception:
+ pass
+
+ with lock:
+ images_downloaded += 1
+ if images_downloaded % 2 == 0 or images_downloaded == total_images_all:
+ send_message({"status": "progress", "current": images_downloaded, "total": total_images_all, "info": f"Descargando {images_downloaded}/{total_images_all}..."})
+
+ tasks = []
+ for post in posts:
+ author_clean = clean_filename(post.get('author', 'Unknown Author'))
+ title_clean = clean_filename(post.get('title', 'Unknown Title'))
+
+ url = post.get('url', '')
+ post_id = url.rstrip('/').split('/')[-1] if '/' in url else ''
+ if post_id and post_id.isdigit():
+ title_clean = f"{title_clean} [{post_id}]"
+
+ is_duplicate = post.get('isDuplicate', False)
+ base_target_dir = os.path.join(base_dir, 'Duplicados') if is_duplicate else base_dir
+
+ dup_idx = post.get('dupIndex')
+ if dup_idx:
+ title_clean = f"{title_clean} (Repetido {dup_idx})"
+
+ post_dir = os.path.join(base_target_dir, author_clean, title_clean)
+ os.makedirs(post_dir, exist_ok=True)
+
+ images = post.get('images', [])
+ for idx, img_url in enumerate(images, 1):
+ tasks.append({
+ 'post': post,
+ 'idx': idx,
+ 'url': img_url,
+ 'dir': post_dir,
+ 'title': title_clean
+ })
+
+ with concurrent.futures.ThreadPoolExecutor(max_workers=30) as executor:
+ executor.map(download_image, tasks)
+
+ send_message({"status": "done", "file": base_dir})
+
+def get_unique_filename(filepath):
+ if not os.path.exists(filepath):
+ return filepath
+ dir_name, file_name = os.path.split(filepath)
+ name, ext = os.path.splitext(file_name)
+ counter = 1
+ while True:
+ new_name = f"{name} ({counter}){ext}"
+ new_path = os.path.join(dir_name, new_name)
+ if not os.path.exists(new_path):
+ return new_path
+ counter += 1
+
+if __name__ == '__main__':
+ while True:
+ try:
+ msg = get_message()
+ if msg and msg.get('type') == 'EXTRACT_KEMONO':
+ extract_links(msg.get('urls', []), msg.get('cookies'), msg.get('userAgent'))
+ elif msg and msg.get('type') == 'SAVE_KEMONO':
+ text_links = msg.get('textLinks', '')
+ text_no_links = msg.get('textNoLinks', '')
+
+ downloads_dir = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Downloads')
+ base_links = os.path.join(downloads_dir, 'kemono_con_descargas.txt')
+ base_no_links = os.path.join(downloads_dir, 'kemono_sin_descargas.txt')
+
+ try:
+ if text_links:
+ final_links = get_unique_filename(base_links)
+ with open(final_links, 'w', encoding='utf-8') as f:
+ f.write(text_links)
+ if text_no_links:
+ final_no_links = get_unique_filename(base_no_links)
+ with open(final_no_links, 'w', encoding='utf-8') as f:
+ f.write(text_no_links)
+
+ send_message({"status": "done", "file": "Descargas"})
+ except Exception as e:
+ send_message({"status": "error", "message": str(e)})
+ elif msg and msg.get('type') == 'DOWNLOAD_IMAGES_KEMONO':
+ download_kemono_images(msg.get('data', []), msg.get('cookies'), msg.get('userAgent'))
+ elif msg:
+ send_message({"status": "error", "message": "Unknown command"})
+ else:
+ break
+ except Exception as e:
+ send_message({"status": "error", "message": str(e)})
+ break
diff --git a/detector de enlaces - copia/inject.py b/detector de enlaces - copia/inject.py
new file mode 100644
index 0000000000000000000000000000000000000000..9ac826ee87f441f3c537ceea5d73d092b64d9f73
--- /dev/null
+++ b/detector de enlaces - copia/inject.py
@@ -0,0 +1,135 @@
+import json
+import re
+
+with open('popup.js', 'r', encoding='utf-8') as f:
+ content = f.read()
+
+start_idx = content.find(' // Toggle Logic para Kemono Descargas')
+end_idx = content.find(' // Toggle Logic para Facebook')
+
+if start_idx != -1 and end_idx != -1:
+ downloads_block = content[start_idx:end_idx]
+
+ images_block = downloads_block.replace('toggleKemonoDownloads', 'toggleKemonoImages')
+ images_block = images_block.replace('__kemonoDownloadsActive', '__kemonoImagesActive')
+ images_block = images_block.replace('kemono-dl-', 'kemono-img-')
+ images_block = images_block.replace('#fbbf24', '#14b8a6')
+ images_block = images_block.replace('#f59e0b', '#0d9488')
+ images_block = images_block.replace('¡Guardado en Descargas!', '¡Enviado a Descargar Imágenes!')
+
+ extraction_start = images_block.find('let outputWithLinks =')
+ extraction_end = images_block.find('document.body.removeChild(iframe);')
+
+ new_extraction = '''let extractionPayload = [];
+
+ let count = 0;
+ const CONCURRENCY_LIMIT = 4;
+ let queue = [...uniqueUrls];
+
+ const extractWorker = async (workerId) => {
+ let iframe = document.createElement('iframe');
+ iframe.id = `kemono-extractor-frame-${workerId}`;
+ iframe.style.width = '1px';
+ iframe.style.height = '1px';
+ iframe.style.opacity = '0';
+ iframe.style.pointerEvents = 'none';
+ iframe.style.position = 'fixed';
+ iframe.style.bottom = '0';
+ document.body.appendChild(iframe);
+
+ while (queue.length > 0) {
+ const url = queue.shift();
+ count++;
+ copyBtn.textContent = `Analizando páginas... ${Math.round((count/total)*100)}%`;
+
+ try {
+ let loaded = false;
+ iframe.onload = () => { loaded = true; };
+ iframe.src = url;
+
+ let waitTimer = 0;
+ while (!loaded && waitTimer < 15000) {
+ await new Promise(r => setTimeout(r, 200));
+ waitTimer += 200;
+ }
+
+ await new Promise(r => setTimeout(r, 2500 + Math.random() * 500));
+
+ const doc = iframe.contentDocument;
+ if (!doc) throw new Error("Página inaccesible");
+
+ let titleEl = doc.querySelector('.post__title span') || doc.querySelector('.post__title') || doc.querySelector('h1');
+ let title = titleEl ? titleEl.innerText.trim() : 'Desconocido';
+
+ let authorEl = doc.querySelector('.post__user-name') || doc.querySelector('.post__author');
+ let author = authorEl ? authorEl.innerText.trim() : 'Desconocido';
+
+ let imageLinks = [];
+ const isImage = (str) => /\.(jpg|jpeg|png|webp|gif|avif)(\?|$|\w)/i.test(str || '');
+
+ // Attachments
+ doc.querySelectorAll('a.post__attachment-link, .post__attachment a').forEach(a => {
+ let href = a.getAttribute('href');
+ let name = a.getAttribute('download') || a.innerText.trim();
+ if (isImage(href) || isImage(name)) {
+ if (!href.startsWith('http')) href = new URL(href, url).href;
+ imageLinks.push(href);
+ }
+ });
+
+ // Images inside content
+ doc.querySelectorAll('.post__content img, .post__body img, .post__content a, .post__body a').forEach(el => {
+ let src = el.getAttribute('src') || el.getAttribute('href');
+ if (isImage(src)) {
+ if (!src.startsWith('http')) src = new URL(src, url).href;
+ imageLinks.push(src);
+ }
+ });
+
+ imageLinks = [...new Set(imageLinks)];
+
+ if (imageLinks.length > 0) {
+ extractionPayload.push({
+ url: url,
+ title: title,
+ author: author,
+ images: imageLinks
+ });
+
+ try {
+ const urlPath = new URL(url).pathname;
+ const cardAnchor = document.querySelector(`.post-card a[href="${urlPath}"]`) || document.querySelector(`.post-card a[href$="${urlPath}"]`);
+ if (cardAnchor) {
+ const card = cardAnchor.closest('.post-card');
+ if (card) {
+ card.classList.add('kemono-img-success');
+ setTimeout(() => card.classList.remove('kemono-img-success'), 150);
+ setTimeout(() => card.classList.add('kemono-img-success'), 300);
+ }
+ }
+ } catch(e) {}
+ }
+ } catch (err) {
+ console.error("Error cargando " + url, err);
+ }
+ }
+ document.body.removeChild(iframe);
+ };'''
+
+ images_block = images_block[:extraction_start] + new_extraction + images_block[extraction_end + len('document.body.removeChild(iframe);'):]
+
+ images_block = images_block.replace('type: "SAVE_KEMONO"', 'type: "DOWNLOAD_IMAGES_KEMONO"')
+ images_block = re.sub(r'textLinks:.*,', 'data: extractionPayload', images_block)
+ images_block = re.sub(r'textNoLinks:.*', '', images_block)
+
+ images_block = images_block.replace('// Toggle Logic para Kemono Descargas', '// Toggle Logic para Kemono Imagenes')
+ images_block = images_block.replace('Procesar Enlaces', 'Procesar Imágenes')
+
+ new_content = content[:end_idx] + images_block + '\n' + content[end_idx:]
+
+ with open('popup.js', 'w', encoding='utf-8') as f:
+ f.write(new_content)
+
+ print("Injection successful.")
+else:
+ print("Could not find blocks")
diff --git a/detector de enlaces - copia/instalar_python_host.bat b/detector de enlaces - copia/instalar_python_host.bat
new file mode 100644
index 0000000000000000000000000000000000000000..5bddcbc9a21f8245a7036aabd64226bc8406261d
--- /dev/null
+++ b/detector de enlaces - copia/instalar_python_host.bat
@@ -0,0 +1,46 @@
+@echo off
+setlocal
+echo ========================================================
+echo INSTALADOR DEL HOST DE DESCARGAS DE KEMONO (PYTHON)
+echo ========================================================
+echo.
+echo Para que Chrome pueda conectar con el script de Python,
+echo necesitamos el "ID" de tu extension.
+echo.
+echo 1. Abre Chrome y ve a chrome://extensions/
+echo 2. Busca "Detector de Enlaces Erome"
+echo 3. Copia el ID (ejemplo: aabbccddeeffgghhiijjkkllmmnnoopp)
+echo.
+set /p EXT_ID="Pega el ID de la extension y presiona ENTER: "
+
+echo.
+echo Creando manifest JSON para el host...
+
+set MANIFEST_PATH=%~dp0host\com.linkdetector.kemono.json
+set BAT_PATH=%~dp0host\kemono_host.bat
+set BAT_PATH=%BAT_PATH:\=\\%
+
+> "%MANIFEST_PATH%" echo {
+>> "%MANIFEST_PATH%" echo "name": "com.linkdetector.kemono",
+>> "%MANIFEST_PATH%" echo "description": "Extractor de enlaces de Kemono",
+>> "%MANIFEST_PATH%" echo "path": "%BAT_PATH%",
+>> "%MANIFEST_PATH%" echo "type": "stdio",
+>> "%MANIFEST_PATH%" echo "allowed_origins": [
+>> "%MANIFEST_PATH%" echo "chrome-extension://%EXT_ID%/"
+>> "%MANIFEST_PATH%" echo ]
+>> "%MANIFEST_PATH%" echo }
+
+echo Archivo JSON creado en: %MANIFEST_PATH%
+echo.
+echo Registrando en Windows Registry...
+REG ADD "HKCU\Software\Google\Chrome\NativeMessagingHosts\com.linkdetector.kemono" /ve /t REG_SZ /d "%MANIFEST_PATH%" /f
+
+echo.
+echo ========================================================
+echo INSTALACION COMPLETADA
+echo ========================================================
+echo Ya puedes usar la opcion de Extraer Descargas Kemono.
+echo Los enlaces se guardaran automaticamente en tu Escritorio
+echo en un archivo llamado "kemono_downloads_extraidos.txt".
+echo.
+pause
diff --git a/detector de enlaces - copia/manifest.json b/detector de enlaces - copia/manifest.json
new file mode 100644
index 0000000000000000000000000000000000000000..7f3a473c1f71ec3f6cc9109e08f32bf797a7233e
--- /dev/null
+++ b/detector de enlaces - copia/manifest.json
@@ -0,0 +1,41 @@
+{
+ "manifest_version": 3,
+ "name": "Detector de Enlaces Erome",
+ "version": "1.3",
+ "description": "Extrae enlaces directos de video (.mp4) de la página actual y escanea álbumes a fondo en segundo plano.",
+ "permissions": ["activeTab", "scripting", "nativeMessaging", "cookies", "storage"],
+ "host_permissions": [
+ "*://*.erome.com/*",
+ "*://*.facebook.com/*",
+ "*://*.tiktok.com/*",
+ "*://*.kemono.cr/*",
+ "*://*.kemono.su/*",
+ "*://*.pawchive.st/*",
+ "*://*.eporner.com/*",
+ "*://*.xhamster.com/*",
+ "*://*.ixxx.com/*",
+ "*://*.xhand.net/*",
+ "*://*.123av.com/*",
+ "*://*.123av.org/*",
+ "*://*.123av.me/*",
+ "*://*.missav.com/*",
+ "*://*.missav.ws/*",
+ "*://*.surrit.store/*",
+ "*://*.surrit.com/*",
+ "*://*.ladys.one/*",
+ "*://*.twpornstars.com/*",
+ "*://*.leakgallery.com/*",
+ "*://*.x.com/*",
+ "*://*.twitter.com/*",
+ "*://*.xvideos.com/*",
+ "*://*.xvideos.es/*",
+ "*://*.instagram.com/*",
+ "*://*.pornhub.com/*"
+ ],
+ "background": {
+ "service_worker": "background.js"
+ },
+ "action": {
+ "default_popup": "popup.html"
+ }
+}
diff --git a/detector de enlaces - copia/popup.html b/detector de enlaces - copia/popup.html
new file mode 100644
index 0000000000000000000000000000000000000000..27c474ce5e6ae9e9690a83c9a91434500532e8da
--- /dev/null
+++ b/detector de enlaces - copia/popup.html
@@ -0,0 +1,866 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ LinkDetector
+
+
+
+ 0 videos
+
+
+
+ Guía de Herramientas
+
+
+
+
+ Modo Extractor Erome
+
+ Escanea álbumes y extrae los enlaces de todos los videos. Exclusivo para Erome.
+
+
+
+
+
+ Modo Selector Kemono
+
+ Inyecta un menú en la página para dar clic en las portadas de Kemono y copiar la url de varias publicaciones a la vez. Solo aparece en Kemono.
+
+
+
+
+
+ Extraer Descargas Kemono
+
+ Selecciona portadas en Kemono: pero en lugar de copiar el enlace del post, entra a cada post por ti y extrae los enlaces directos de descarga (ZIPs, Mega, Drive).
+
+
+
+
+
+ Extraer Imágenes Kemono
+
+ Selecciona posts en Kemono para procesarlos en segundo plano, extraer todas sus imágenes y descargarlas organizadas en carpetas con Python.
+
+
+
+
+
+ Modo Selector Facebook
+
+ Selecciona reels interactivamente como en Kemono, o presiona "Buscar enlaces" para recolectar todos los videos que has visto al bajar página. Solo para Facebook.
+
+
+
+
+
+ Modo Selector Eporner
+
+ Selecciona miniaturas en Eporner de forma interactiva y copia los enlaces de los videos. Solo aparece en Eporner.
+
+
+
+
+
+ Modo Selector XHamster
+
+ Selecciona miniaturas en XHamster de forma interactiva y copia los enlaces de los videos. Solo aparece en XHamster.
+
+
+
+
+
+ Modo Selector iXXX
+
+ Selecciona miniaturas en iXXX de forma interactiva y copia los enlaces decodificados. Solo aparece en iXXX.
+
+
+
+
+
+ Modo Selector XHand
+
+ Selecciona miniaturas en XHand de forma interactiva y copia sus enlaces. Solo aparece en XHand.
+
+
+
+
+
+ Modo Extractor Ladys.one
+
+ Extrae todos los videos directos (.mp4) de las páginas y perfiles en Ladys.one.
+
+
+
+
+
+ Modo Extractor TWPornstars
+
+ Extrae automáticamente todos los videos directos (.mp4) de los perfiles en TWPornstars.
+
+
+
+
+
+ Modo Extractor LeakGallery
+
+ Extrae automáticamente todos los videos directos (.mp4) de los perfiles en LeakGallery.
+
+
+
+
+
+ Auto Extractor X (Videos)
+
+ Inyecta un menú flotante que busca y extrae automáticamente los enlaces a todos los videos de un perfil de X haciendo scroll.
+
+
+
+
+
+
+
+ Esta extensión está diseñada principalmente para Kemono, Pawchive, Erome, Eporner, Pornhub, XHamster, iXXX, XHand, Ladys.one, TWPornstars, LeakGallery y X (Twitter). Navega a una de esas páginas para usar las herramientas.
+
+
+
+
+
+
+
+
+
+
+
Modo Extractor Erome (Videos)
+
Extrae todos los videos de álbumes en Erome.
+
+
+
+
+
+
+
+ Escaneando página...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Extractor Erome (Imágenes)
+
Extrae todas las imágenes de álbumes en Erome.
+
+
+
+
+
+
+
+ Escaneando página...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Selector Kemono
+
Elige portadas interactivamente para copiar.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Extraer Descargas Kemono
+
Selecciona posts para extraer sus archivos (Zips, Mega, Drive).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Extraer Imágenes Kemono
+
Extrae y descarga las imágenes en carpetas automáticamente.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Selector Facebook
+
Selecciona o extrae reels y videos en lote.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Selector TikTok
+
Selecciona videos interactivamente o escanea perfiles.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Selector Eporner
+
Selecciona videos interactivamente y copia sus enlaces.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Selector XHamster
+
Selecciona videos interactivamente y copia sus enlaces.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Selector iXXX
+
Selecciona videos interactivamente y copia sus enlaces.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Selector XHand
+
Selecciona videos interactivamente y copia sus enlaces.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Selector JAV
+
Extrae enlaces HLS (.m3u8) de reproductores Surrit en 123AV y MissAV.
+
+
+
+
+
+
+
+ Escaneando reproductor JAV...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Extractor Ladys.one
+
Extrae todos los videos directos (.mp4) de la página de Ladys.one.
+
+
+
+
+
+
+
+ Escaneando videos de Ladys.one...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Extractor TWPornstars
+
Extrae todos los videos directos (.mp4) de los perfiles de TWPornstars.
+
+
+
+
+
+
+
+ Escaneando videos de TWPornstars...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Extractor LeakGallery
+
Extrae todos los videos directos (.mp4) de los perfiles de LeakGallery.
+
+
+
+
+
+
+
+ Escaneando videos de LeakGallery...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Selector XVideos
+
Selecciona miniaturas en XVideos de forma interactiva y copia los enlaces.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Selector Pornhub
+
Selecciona miniaturas en Pornhub de forma interactiva y copia los enlaces de los videos.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modo Selector Instagram
+
Selecciona publicaciones en Instagram de forma interactiva y copia los enlaces.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Auto Extractor X (Videos)
+
Extrae todos los videos del usuario haciendo scroll automáticamente.