Add Playwright tools for extracting M3U8 URLs and proxy management
- Introduced `playwright_extract_m3u8.py` to extract M3U8 URLs from YouTube videos using Playwright. - Added `README_PLAYWRIGHT.md` for usage instructions and requirements. - Created `expand_and_test_proxies.py` to expand user-provided proxies and test their validity. - Implemented `generate_proxy_whitelist.py` to generate a whitelist of working proxies based on testing results. - Added sample proxy files: `user_proxies.txt` for user-defined proxies and `proxies_sample.txt` as a template. - Generated `expanded_proxies.txt`, `whitelist.json`, and `whitelist.txt` for storing expanded and valid proxies. - Included error handling and logging for proxy testing results.
This commit is contained in:
parent
c9f8c9290b
commit
2923510c51
@ -3,8 +3,8 @@ FROM python:3.11-slim
|
|||||||
|
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
# Instalar ffmpeg, Node.js (LTS via NodeSource) y herramientas necesarias
|
# Instalar ffmpeg, Node.js 20 LTS y herramientas necesarias
|
||||||
# Node.js + yt-dlp-utils son requeridos para resolver el n-challenge y signature de YouTube
|
# Node.js es requerido por yt-dlp --js-runtimes para resolver n-challenge/signature de YouTube
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
@ -13,8 +13,7 @@ RUN apt-get update \
|
|||||||
gnupg \
|
gnupg \
|
||||||
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
||||||
&& apt-get install -y --no-install-recommends nodejs \
|
&& apt-get install -y --no-install-recommends nodejs \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
&& npm install -g yt-dlp-utils 2>/dev/null || true
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@ -22,7 +21,7 @@ WORKDIR /app
|
|||||||
COPY requirements.txt /app/requirements.txt
|
COPY requirements.txt /app/requirements.txt
|
||||||
RUN pip install --no-cache-dir -r /app/requirements.txt
|
RUN pip install --no-cache-dir -r /app/requirements.txt
|
||||||
|
|
||||||
# Instalar yt-dlp desde la última versión del binario oficial (no pip) para tener siempre la más reciente
|
# Instalar yt-dlp desde el binario oficial más reciente (no pip) para siempre tener la última versión
|
||||||
RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp \
|
RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp \
|
||||||
&& chmod a+rx /usr/local/bin/yt-dlp
|
&& chmod a+rx /usr/local/bin/yt-dlp
|
||||||
|
|
||||||
@ -42,5 +41,5 @@ USER appuser
|
|||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# Comando por defecto para ejecutar la API
|
# Comando para ejecutar la API
|
||||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
|
|||||||
@ -1,23 +1,31 @@
|
|||||||
services:
|
services:
|
||||||
# Servicio FastAPI - Backend API
|
|
||||||
tubescript-api:
|
tubescript-api:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.api
|
dockerfile: Dockerfile.api
|
||||||
args:
|
args:
|
||||||
# Invalida solo la capa COPY . /app para que siempre tome el código más reciente
|
# Invalida la capa COPY . /app sin necesidad de --no-cache completo
|
||||||
# sin necesidad de --no-cache (que descarga todo desde cero)
|
|
||||||
CACHEBUST: "${CACHEBUST:-1}"
|
CACHEBUST: "${CACHEBUST:-1}"
|
||||||
image: tubescript-api:latest
|
image: tubescript-api:latest
|
||||||
container_name: tubescript_api
|
container_name: tubescript_api
|
||||||
ports:
|
ports:
|
||||||
- "8282:8000"
|
- "8282:8000"
|
||||||
volumes:
|
volumes:
|
||||||
|
# Datos persistentes: cookies.txt, config, etc.
|
||||||
- ./data:/app/data:rw
|
- ./data:/app/data:rw
|
||||||
|
# ── Perfiles de navegador del HOST (read-only) ──────────────────────────
|
||||||
|
# yt-dlp puede leer cookies directamente del navegador con
|
||||||
|
# POST /extract_chrome_cookies?browser=chrome
|
||||||
|
# Descomenta el navegador que tengas instalado en el host:
|
||||||
|
- ${HOME}/.config/google-chrome:/host-chrome:ro
|
||||||
|
# - ${HOME}/.config/chromium:/host-chromium:ro
|
||||||
|
# - ${HOME}/.config/BraveSoftware/Brave-Browser:/host-brave:ro
|
||||||
|
# - ${HOME}/.mozilla/firefox:/host-firefox:ro
|
||||||
|
# - ${HOME}/.config/microsoft-edge:/host-edge:ro
|
||||||
environment:
|
environment:
|
||||||
- PYTHONUNBUFFERED=1
|
- PYTHONUNBUFFERED=1
|
||||||
- API_COOKIES_PATH=/app/data/cookies.txt
|
- API_COOKIES_PATH=/app/data/cookies.txt
|
||||||
# Optional: set API_PROXY when you want the container to use a SOCKS/HTTP proxy
|
# Proxy opcional: socks5h://127.0.0.1:9050
|
||||||
- API_PROXY=${API_PROXY:-}
|
- API_PROXY=${API_PROXY:-}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@ -1,125 +1,83 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Script para reconstruir TubeScript-API desde cero
|
||||||
# Script para reconstruir las imágenes Docker de TubeScript
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RED='\033[0;31m'; NC='\033[0m'
|
||||||
|
ok() { echo -e "${GREEN}✅ $1${NC}"; }
|
||||||
|
warn() { echo -e "${YELLOW}⚠️ $1${NC}"; }
|
||||||
|
err() { echo -e "${RED}❌ $1${NC}"; }
|
||||||
|
|
||||||
echo "════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════"
|
||||||
echo " 🔨 TubeScript-API - Rebuild de Docker"
|
echo " 🔨 TubeScript-API — Rebuild completo"
|
||||||
echo "════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Colores
|
# ── Verificar Docker (plugin compose, no docker-compose legacy) ──────────────
|
||||||
GREEN='\033[0;32m'
|
if ! docker compose version &>/dev/null; then
|
||||||
YELLOW='\033[1;33m'
|
err "docker compose no está disponible. Instala Docker Desktop o el plugin compose."
|
||||||
RED='\033[0;31m'
|
|
||||||
NC='\033[0m'
|
|
||||||
|
|
||||||
print_success() {
|
|
||||||
echo -e "${GREEN}✅ $1${NC}"
|
|
||||||
}
|
|
||||||
|
|
||||||
print_warning() {
|
|
||||||
echo -e "${YELLOW}⚠️ $1${NC}"
|
|
||||||
}
|
|
||||||
|
|
||||||
print_error() {
|
|
||||||
echo -e "${RED}❌ $1${NC}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Verificar Docker
|
|
||||||
echo "🔍 Verificando Docker..."
|
|
||||||
if ! command -v docker &> /dev/null; then
|
|
||||||
print_error "Docker no está instalado"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
ok "Docker compose disponible: $(docker compose version --short 2>/dev/null || echo 'ok')"
|
||||||
if ! command -v docker-compose &> /dev/null; then
|
|
||||||
print_error "Docker Compose no está instalado"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
print_success "Docker encontrado"
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Asegurar carpeta data para montajes de configuración
|
# ── Carpeta data ──────────────────────────────────────────────────────────────
|
||||||
echo "📁 Asegurando carpeta './data' para montaje de configuración..."
|
mkdir -p ./data
|
||||||
if [ ! -d "./data" ]; then
|
chmod 777 ./data 2>/dev/null || true
|
||||||
mkdir -p ./data
|
ok "Carpeta ./data lista (permisos 777)"
|
||||||
chmod 755 ./data || true
|
echo " Coloca cookies.txt en ./data/cookies.txt para autenticación"
|
||||||
print_success "Carpeta ./data creada"
|
echo ""
|
||||||
|
|
||||||
|
# ── Detener contenedores existentes ──────────────────────────────────────────
|
||||||
|
echo "🛑 Deteniendo contenedores..."
|
||||||
|
docker compose down --remove-orphans 2>/dev/null || true
|
||||||
|
ok "Contenedores detenidos"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# ── Eliminar imagen anterior para forzar build limpio ─────────────────────────
|
||||||
|
echo "🧹 Eliminando imagen anterior (tubescript-api:latest)..."
|
||||||
|
docker rmi tubescript-api:latest 2>/dev/null && ok "Imagen anterior eliminada" || warn "No había imagen previa"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# ── Build sin caché ───────────────────────────────────────────────────────────
|
||||||
|
echo "🔨 Construyendo imagen desde cero (--no-cache)..."
|
||||||
|
echo " Esto puede tardar 3-5 minutos la primera vez..."
|
||||||
|
echo ""
|
||||||
|
CACHEBUST=$(date +%s) docker compose build --no-cache
|
||||||
|
|
||||||
|
ok "Imagen construida exitosamente"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# ── Iniciar servicios ─────────────────────────────────────────────────────────
|
||||||
|
echo "🚀 Iniciando servicios..."
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
ok "Servicios iniciados"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# ── Esperar y mostrar estado ──────────────────────────────────────────────────
|
||||||
|
echo "⏳ Esperando que la API arranque (15s)..."
|
||||||
|
sleep 15
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "📊 Estado de contenedores:"
|
||||||
|
docker compose ps
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# ── Health check ──────────────────────────────────────────────────────────────
|
||||||
|
echo "🩺 Verificando API..."
|
||||||
|
if curl -sf http://localhost:8282/docs -o /dev/null; then
|
||||||
|
ok "API respondiendo en http://localhost:8282"
|
||||||
else
|
else
|
||||||
print_success "Carpeta ./data ya existe"
|
warn "API aún no responde (puede necesitar más tiempo). Revisa: docker compose logs -f"
|
||||||
fi
|
|
||||||
echo "Nota: coloca aquí archivos persistentes como stream_config.json, streams_state.json y cookies.txt (ej: ./data/cookies.txt)"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Detener contenedores
|
|
||||||
echo "🛑 Deteniendo contenedores existentes..."
|
|
||||||
docker compose down 2>/dev/null || true
|
|
||||||
print_success "Contenedores detenidos"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Limpiar imágenes antiguas (opcional)
|
|
||||||
echo "🧹 ¿Deseas eliminar las imágenes antiguas? (s/N)"
|
|
||||||
read -p "> " clean_images
|
|
||||||
if [ "$clean_images" = "s" ] || [ "$clean_images" = "S" ]; then
|
|
||||||
echo "Eliminando imágenes antiguas..."
|
|
||||||
docker compose down --rmi all 2>/dev/null || true
|
|
||||||
print_success "Imágenes antiguas eliminadas"
|
|
||||||
fi
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Reconstruir con CACHEBUST para invalidar solo la capa COPY . /app
|
|
||||||
# CACHEBUST=$(date +%s) se exporta para que docker-compose.yml lo tome via ${CACHEBUST:-1}
|
|
||||||
echo "🔨 Reconstruyendo imagen con código actualizado..."
|
|
||||||
echo "Usando CACHEBUST=$(date +%s) para forzar copia fresca del código..."
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
export CACHEBUST="$(date +%s)"
|
|
||||||
docker compose build
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
print_success "Imagen reconstruida exitosamente"
|
|
||||||
else
|
|
||||||
print_error "Error al reconstruir imagen"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Preguntar si desea iniciar
|
|
||||||
echo "🚀 ¿Deseas iniciar los servicios ahora? (S/n)"
|
|
||||||
read -p "> " start_services
|
|
||||||
if [ "$start_services" != "n" ] && [ "$start_services" != "N" ]; then
|
|
||||||
echo ""
|
|
||||||
echo "🚀 Iniciando servicios..."
|
|
||||||
docker compose up -d
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
print_success "Servicios iniciados"
|
|
||||||
echo ""
|
|
||||||
echo "📊 Estado de los servicios:"
|
|
||||||
sleep 3
|
|
||||||
docker compose ps
|
|
||||||
echo ""
|
|
||||||
echo "════════════════════════════════════════════════════════════"
|
|
||||||
print_success "¡Rebuild completado!"
|
|
||||||
echo "════════════════════════════════════════════════════════════"
|
|
||||||
echo ""
|
|
||||||
echo "🌐 Servicios disponibles:"
|
|
||||||
echo " API: http://localhost:8282"
|
|
||||||
echo " Docs API: http://localhost:8282/docs"
|
|
||||||
echo ""
|
|
||||||
else
|
|
||||||
print_error "Error al iniciar servicios"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
print_success "Rebuild completado (servicios no iniciados)"
|
|
||||||
echo ""
|
|
||||||
echo "Para iniciar los servicios:"
|
|
||||||
echo " CACHEBUST=\$(date +%s) docker compose up -d --build"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
echo "════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════"
|
||||||
|
ok "¡Rebuild completado!"
|
||||||
|
echo "════════════════════════════════════════════════════════════"
|
||||||
|
echo ""
|
||||||
|
echo " API: http://localhost:8282"
|
||||||
|
echo " Docs: http://localhost:8282/docs"
|
||||||
|
echo " Logs: docker compose logs -f"
|
||||||
|
echo " Cookies: curl -X POST http://localhost:8282/upload_cookies -F 'file=@cookies.txt'"
|
||||||
|
echo ""
|
||||||
|
|||||||
141
export-chrome-cookies.sh
Executable file
141
export-chrome-cookies.sh
Executable file
@ -0,0 +1,141 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
# export-chrome-cookies.sh
|
||||||
|
# Exporta cookies de YouTube desde el perfil del navegador del HOST
|
||||||
|
# usando yt-dlp, y las copia a ./data/cookies.txt para que la API las use.
|
||||||
|
#
|
||||||
|
# Uso:
|
||||||
|
# ./export-chrome-cookies.sh # Chrome (default)
|
||||||
|
# ./export-chrome-cookies.sh chromium # Chromium
|
||||||
|
# ./export-chrome-cookies.sh brave # Brave
|
||||||
|
# ./export-chrome-cookies.sh firefox # Firefox
|
||||||
|
# ./export-chrome-cookies.sh edge # Edge
|
||||||
|
#
|
||||||
|
# IMPORTANTE:
|
||||||
|
# - Cierra el navegador antes de ejecutar (Chrome bloquea el archivo de cookies)
|
||||||
|
# - En Linux no requiere contraseña ni keychain especial
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
BROWSER="${1:-chrome}"
|
||||||
|
OUTPUT="./data/cookies.txt"
|
||||||
|
GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RED='\033[0;31m'; NC='\033[0m'
|
||||||
|
|
||||||
|
ok() { echo -e "${GREEN}✅ $1${NC}"; }
|
||||||
|
warn() { echo -e "${YELLOW}⚠️ $1${NC}"; }
|
||||||
|
err() { echo -e "${RED}❌ $1${NC}"; exit 1; }
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "🍪 Exportando cookies de YouTube desde: $BROWSER"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Verificar yt-dlp
|
||||||
|
if ! command -v yt-dlp &>/dev/null; then
|
||||||
|
err "yt-dlp no está instalado. Instala con: pip install yt-dlp"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verificar que el navegador no esté corriendo (puede causar errores de bloqueo)
|
||||||
|
BROWSER_PROC=""
|
||||||
|
case "$BROWSER" in
|
||||||
|
chrome) BROWSER_PROC="google-chrome\|chrome" ;;
|
||||||
|
chromium) BROWSER_PROC="chromium" ;;
|
||||||
|
brave) BROWSER_PROC="brave" ;;
|
||||||
|
firefox) BROWSER_PROC="firefox" ;;
|
||||||
|
edge) BROWSER_PROC="msedge\|microsoft-edge" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -n "$BROWSER_PROC" ] && pgrep -f "$BROWSER_PROC" &>/dev/null; then
|
||||||
|
warn "El navegador '$BROWSER' parece estar corriendo."
|
||||||
|
warn "Ciérralo antes de exportar para evitar errores de bloqueo del DB."
|
||||||
|
echo ""
|
||||||
|
read -p "¿Continuar de todos modos? (s/N): " confirm
|
||||||
|
[[ "$confirm" =~ ^[sS]$ ]] || { echo "Cancelado."; exit 0; }
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Crear directorio de destino
|
||||||
|
mkdir -p "$(dirname "$OUTPUT")"
|
||||||
|
|
||||||
|
# Detectar ruta del perfil
|
||||||
|
PROFILE_PATH=""
|
||||||
|
case "$BROWSER" in
|
||||||
|
chrome)
|
||||||
|
for p in "$HOME/.config/google-chrome/Default" "$HOME/.config/google-chrome/Profile 1"; do
|
||||||
|
[ -d "$p" ] && PROFILE_PATH="$p" && break
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
chromium)
|
||||||
|
PROFILE_PATH="$HOME/.config/chromium/Default"
|
||||||
|
;;
|
||||||
|
brave)
|
||||||
|
PROFILE_PATH="$HOME/.config/BraveSoftware/Brave-Browser/Default"
|
||||||
|
;;
|
||||||
|
firefox)
|
||||||
|
# Firefox: yt-dlp detecta el perfil automáticamente
|
||||||
|
PROFILE_PATH=""
|
||||||
|
;;
|
||||||
|
edge)
|
||||||
|
PROFILE_PATH="$HOME/.config/microsoft-edge/Default"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
err "Navegador '$BROWSER' no soportado. Usa: chrome, chromium, brave, firefox, edge"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -n "$PROFILE_PATH" ] && [ ! -d "$PROFILE_PATH" ]; then
|
||||||
|
err "No se encontró el perfil de $BROWSER en: $PROFILE_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Construir argumento --cookies-from-browser
|
||||||
|
if [ -n "$PROFILE_PATH" ]; then
|
||||||
|
BROWSER_ARG="${BROWSER}:${PROFILE_PATH}"
|
||||||
|
echo " Perfil: $PROFILE_PATH"
|
||||||
|
else
|
||||||
|
BROWSER_ARG="$BROWSER"
|
||||||
|
echo " Perfil: detectado automáticamente"
|
||||||
|
fi
|
||||||
|
echo " Destino: $OUTPUT"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Exportar cookies con yt-dlp
|
||||||
|
echo "⏳ Extrayendo cookies..."
|
||||||
|
yt-dlp \
|
||||||
|
--cookies-from-browser "$BROWSER_ARG" \
|
||||||
|
--cookies "$OUTPUT" \
|
||||||
|
--skip-download \
|
||||||
|
--no-warnings \
|
||||||
|
--extractor-args "youtube:player_client=tv_embedded" \
|
||||||
|
"https://www.youtube.com/watch?v=dQw4w9WgXcQ" 2>&1 || {
|
||||||
|
err "Error al extraer cookies. Asegúrate de que el navegador está cerrado y tienes sesión en YouTube."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Verificar resultado
|
||||||
|
if [ ! -f "$OUTPUT" ] || [ ! -s "$OUTPUT" ]; then
|
||||||
|
err "No se generó el archivo de cookies o está vacío."
|
||||||
|
fi
|
||||||
|
|
||||||
|
YT_LINES=$(grep -c "youtube.com" "$OUTPUT" 2>/dev/null || echo 0)
|
||||||
|
FILE_SIZE=$(du -h "$OUTPUT" | cut -f1)
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
ok "Cookies exportadas exitosamente"
|
||||||
|
echo " Archivo: $OUTPUT"
|
||||||
|
echo " Tamaño: $FILE_SIZE"
|
||||||
|
echo " Líneas youtube.com: $YT_LINES"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
if [ "$YT_LINES" -lt 3 ]; then
|
||||||
|
warn "Pocas cookies de YouTube encontradas ($YT_LINES)."
|
||||||
|
warn "Verifica que estás logueado en YouTube en $BROWSER."
|
||||||
|
else
|
||||||
|
ok "Cookies de YouTube encontradas: $YT_LINES líneas"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "📋 Próximos pasos:"
|
||||||
|
echo " 1. Si el contenedor está corriendo, las cookies ya están disponibles en /app/data/"
|
||||||
|
echo " 2. Si no está corriendo: docker compose up -d"
|
||||||
|
echo " 3. Prueba: curl http://localhost:8282/cookies/status"
|
||||||
|
echo ""
|
||||||
|
|
||||||
27
tools/README_PLAYWRIGHT.md
Normal file
27
tools/README_PLAYWRIGHT.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
Playwright extractor
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Este script abre un video de YouTube con Playwright, captura peticiones de red y busca
|
||||||
|
URLs M3U8/HLS. Opcionalmente exporta cookies al formato Netscape en `./data/cookies.txt`.
|
||||||
|
|
||||||
|
Requisitos (host):
|
||||||
|
pip install playwright
|
||||||
|
python -m playwright install
|
||||||
|
|
||||||
|
Uso ejemplo (headful, usando tu perfil de Chrome):
|
||||||
|
python3 tools/playwright_extract_m3u8.py --video https://www.youtube.com/watch?v=cmqVmX2UVBM --profile ~/.config/google-chrome --headless
|
||||||
|
|
||||||
|
Si no usas perfil, quita `--profile` y el script abrirá un contexto temporal.
|
||||||
|
|
||||||
|
Salida JSON:
|
||||||
|
{
|
||||||
|
"m3u8_urls": [ ... ],
|
||||||
|
"cookies_file": "./data/cookies.txt",
|
||||||
|
"errors": []
|
||||||
|
}
|
||||||
|
|
||||||
|
Consejos:
|
||||||
|
- Ejecuta en el host (no en contenedor) si quieres usar tu perfil real de Chrome.
|
||||||
|
- Si Playwright no encuentra el ejecutable del navegador, corre `python -m playwright install`.
|
||||||
|
- Para usar las cookies exportadas desde la API: `curl -s http://localhost:8282/cookies/status` para comprobarlas.
|
||||||
|
|
||||||
113
tools/expand_and_test_proxies.py
Normal file
113
tools/expand_and_test_proxies.py
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
expand_and_test_proxies.py
|
||||||
|
|
||||||
|
Lee tools/user_proxies.txt, genera variantes (intenta también SOCKS5/SOCKS5H en puertos comunes)
|
||||||
|
y ejecuta tools/generate_proxy_whitelist.py con la lista expandida.
|
||||||
|
|
||||||
|
Uso:
|
||||||
|
python3 tools/expand_and_test_proxies.py
|
||||||
|
|
||||||
|
Salida:
|
||||||
|
- tools/expanded_proxies.txt (lista expandida)
|
||||||
|
- llama a generate_proxy_whitelist.py y produce tools/whitelist.json y tools/whitelist.txt
|
||||||
|
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
BASE = Path(__file__).resolve().parent
|
||||||
|
USER_FILE = BASE / 'user_proxies.txt'
|
||||||
|
EXPANDED_FILE = BASE / 'expanded_proxies.txt'
|
||||||
|
GEN_SCRIPT = BASE / 'generate_proxy_whitelist.py'
|
||||||
|
|
||||||
|
COMMON_SOCKS_PORTS = [1080, 10808, 9050]
|
||||||
|
|
||||||
|
|
||||||
|
def normalize_line(line: str) -> str | None:
|
||||||
|
s = line.strip()
|
||||||
|
if not s or s.startswith('#'):
|
||||||
|
return None
|
||||||
|
return s
|
||||||
|
|
||||||
|
|
||||||
|
def parse_host_port(s: str):
|
||||||
|
# remove scheme if present
|
||||||
|
m = re.match(r'^(?:(?P<scheme>[a-zA-Z0-9+.-]+)://)?(?P<host>[^:/@]+)(?::(?P<port>\d+))?(?:@.*)?$', s)
|
||||||
|
if not m:
|
||||||
|
return None, None, None
|
||||||
|
scheme = m.group('scheme')
|
||||||
|
host = m.group('host')
|
||||||
|
port = m.group('port')
|
||||||
|
port = int(port) if port else None
|
||||||
|
return scheme, host, port
|
||||||
|
|
||||||
|
|
||||||
|
def build_variants(s: str):
|
||||||
|
scheme, host, port = parse_host_port(s)
|
||||||
|
variants = []
|
||||||
|
# keep original if it has scheme
|
||||||
|
if scheme:
|
||||||
|
variants.append(s)
|
||||||
|
else:
|
||||||
|
# assume http by default if none
|
||||||
|
if port:
|
||||||
|
variants.append(f'http://{host}:{port}')
|
||||||
|
else:
|
||||||
|
variants.append(f'http://{host}:80')
|
||||||
|
|
||||||
|
# Try socks5h on same port if port present
|
||||||
|
if port:
|
||||||
|
variants.append(f'socks5h://{host}:{port}')
|
||||||
|
# Try socks5h on common ports
|
||||||
|
for p in COMMON_SOCKS_PORTS:
|
||||||
|
variants.append(f'socks5h://{host}:{p}')
|
||||||
|
|
||||||
|
# Deduplicate preserving order
|
||||||
|
seen = set()
|
||||||
|
out = []
|
||||||
|
for v in variants:
|
||||||
|
if v in seen:
|
||||||
|
continue
|
||||||
|
seen.add(v)
|
||||||
|
out.append(v)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if not USER_FILE.exists():
|
||||||
|
print(f'No se encontró {USER_FILE}. Crea el archivo con proxies (uno por línea).')
|
||||||
|
return
|
||||||
|
|
||||||
|
all_variants = []
|
||||||
|
with USER_FILE.open('r', encoding='utf-8') as fh:
|
||||||
|
for line in fh:
|
||||||
|
s = normalize_line(line)
|
||||||
|
if not s:
|
||||||
|
continue
|
||||||
|
vars = build_variants(s)
|
||||||
|
all_variants.extend(vars)
|
||||||
|
|
||||||
|
# write expanded file
|
||||||
|
with EXPANDED_FILE.open('w', encoding='utf-8') as fh:
|
||||||
|
for v in all_variants:
|
||||||
|
fh.write(v + '\n')
|
||||||
|
|
||||||
|
print(f'Wrote expanded proxies to {EXPANDED_FILE} ({len(all_variants)} entries)')
|
||||||
|
|
||||||
|
# Call generator
|
||||||
|
cmd = [ 'python3', str(GEN_SCRIPT), '--input', str(EXPANDED_FILE), '--out-json', str(BASE / 'whitelist.json'), '--out-txt', str(BASE / 'whitelist.txt'), '--test-url', 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', '--concurrency', '6']
|
||||||
|
print('Running generator...')
|
||||||
|
try:
|
||||||
|
res = subprocess.run(cmd, capture_output=True, text=True, timeout=600)
|
||||||
|
print('Generator exit code:', res.returncode)
|
||||||
|
print('stdout:\n', res.stdout)
|
||||||
|
print('stderr:\n', res.stderr)
|
||||||
|
except Exception as e:
|
||||||
|
print('Error running generator:', e)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
||||||
30
tools/expanded_proxies.txt
Normal file
30
tools/expanded_proxies.txt
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
http://48.210.225.96:80
|
||||||
|
socks5h://48.210.225.96:80
|
||||||
|
socks5h://48.210.225.96:1080
|
||||||
|
socks5h://48.210.225.96:10808
|
||||||
|
socks5h://48.210.225.96:9050
|
||||||
|
http://107.174.231.218:8888
|
||||||
|
socks5h://107.174.231.218:8888
|
||||||
|
socks5h://107.174.231.218:1080
|
||||||
|
socks5h://107.174.231.218:10808
|
||||||
|
socks5h://107.174.231.218:9050
|
||||||
|
http://188.239.43.6:80
|
||||||
|
socks5h://188.239.43.6:80
|
||||||
|
socks5h://188.239.43.6:1080
|
||||||
|
socks5h://188.239.43.6:10808
|
||||||
|
socks5h://188.239.43.6:9050
|
||||||
|
http://52.229.30.3:80
|
||||||
|
socks5h://52.229.30.3:80
|
||||||
|
socks5h://52.229.30.3:1080
|
||||||
|
socks5h://52.229.30.3:10808
|
||||||
|
socks5h://52.229.30.3:9050
|
||||||
|
http://142.93.202.130:3128
|
||||||
|
socks5h://142.93.202.130:3128
|
||||||
|
socks5h://142.93.202.130:1080
|
||||||
|
socks5h://142.93.202.130:10808
|
||||||
|
socks5h://142.93.202.130:9050
|
||||||
|
http://154.219.101.86:8888
|
||||||
|
socks5h://154.219.101.86:8888
|
||||||
|
socks5h://154.219.101.86:1080
|
||||||
|
socks5h://154.219.101.86:10808
|
||||||
|
socks5h://154.219.101.86:9050
|
||||||
242
tools/generate_proxy_whitelist.py
Normal file
242
tools/generate_proxy_whitelist.py
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
generate_proxy_whitelist.py
|
||||||
|
|
||||||
|
Lee una lista de proxies desde un archivo (proxies.txt), prueba cada proxy con yt-dlp
|
||||||
|
intentando descargar metadata mínimo de YouTube, mide latencia y genera:
|
||||||
|
- whitelist.json : lista estructurada de proxies con estado y métricas
|
||||||
|
- whitelist.txt : solo proxies válidos, ordenados por latencia
|
||||||
|
|
||||||
|
Formato de proxies.txt: una URL por línea, ejemplos:
|
||||||
|
socks5h://127.0.0.1:1080
|
||||||
|
http://10.0.0.1:3128
|
||||||
|
|
||||||
|
Uso:
|
||||||
|
python3 tools/generate_proxy_whitelist.py --input tools/proxies.txt --out tools/whitelist.json --test-url https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
||||||
|
|
||||||
|
Notas:
|
||||||
|
- Requiere tener `yt-dlp` instalado en el entorno donde se ejecuta este script.
|
||||||
|
- Este script intenta usar yt-dlp porque valida directamente que el proxy funciona
|
||||||
|
para las llamadas a YouTube (incluye manejo de JS/firma en yt-dlp cuando aplique).
|
||||||
|
- Ajusta timeouts y pruebas por concurrencia según tus necesidades.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
import subprocess
|
||||||
|
import time
|
||||||
|
import os
|
||||||
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
# Mensajes que indican bloqueo/bot-check de yt-dlp
|
||||||
|
BOT_MARKERS = ("sign in to confirm", "not a bot", "sign in to", "HTTP Error 403", "HTTP Error 429")
|
||||||
|
|
||||||
|
|
||||||
|
def test_proxy(proxy: str, test_url: str, timeout: int = 25) -> dict:
|
||||||
|
"""Prueba un proxy ejecutando yt-dlp --dump-json sobre test_url.
|
||||||
|
Retorna dict con info: proxy, ok, rc, stderr, elapsed_ms, stdout_preview
|
||||||
|
"""
|
||||||
|
proxy = proxy.strip()
|
||||||
|
if not proxy:
|
||||||
|
return {"proxy": proxy, "ok": False, "error": "empty"}
|
||||||
|
|
||||||
|
cmd = [
|
||||||
|
"yt-dlp",
|
||||||
|
"--skip-download",
|
||||||
|
"--dump-json",
|
||||||
|
"--no-warnings",
|
||||||
|
"--extractor-args", "youtube:player_client=tv_embedded",
|
||||||
|
"--socket-timeout", "10",
|
||||||
|
test_url,
|
||||||
|
"--proxy", proxy,
|
||||||
|
]
|
||||||
|
|
||||||
|
start = time.perf_counter()
|
||||||
|
try:
|
||||||
|
proc = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
|
||||||
|
elapsed = (time.perf_counter() - start) * 1000.0
|
||||||
|
stdout = proc.stdout or ""
|
||||||
|
stderr = proc.stderr or ""
|
||||||
|
rc = proc.returncode
|
||||||
|
|
||||||
|
# heurística de éxito: rc == 0 y stdout no vacío y no markers de bot en stderr
|
||||||
|
stderr_low = stderr.lower()
|
||||||
|
bot_hit = any(m.lower() in stderr_low for m in BOT_MARKERS)
|
||||||
|
ok = (rc == 0 and stdout.strip() != "" and not bot_hit)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"proxy": proxy,
|
||||||
|
"ok": ok,
|
||||||
|
"rc": rc,
|
||||||
|
"elapsed_ms": int(elapsed),
|
||||||
|
"bot_detected": bool(bot_hit),
|
||||||
|
"stderr_preview": stderr[:1000],
|
||||||
|
"stdout_preview": stdout[:2000],
|
||||||
|
}
|
||||||
|
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
elapsed = (time.perf_counter() - start) * 1000.0
|
||||||
|
return {"proxy": proxy, "ok": False, "error": "timeout", "elapsed_ms": int(elapsed)}
|
||||||
|
except FileNotFoundError:
|
||||||
|
return {"proxy": proxy, "ok": False, "error": "yt-dlp-not-found"}
|
||||||
|
except Exception as e:
|
||||||
|
elapsed = (time.perf_counter() - start) * 1000.0
|
||||||
|
return {"proxy": proxy, "ok": False, "error": str(e), "elapsed_ms": int(elapsed)}
|
||||||
|
|
||||||
|
|
||||||
|
def generate_whitelist(input_file: str, out_json: str, out_txt: str, test_url: str, concurrency: int = 6):
|
||||||
|
proxies = []
|
||||||
|
with open(input_file, 'r', encoding='utf-8') as fh:
|
||||||
|
for line in fh:
|
||||||
|
line = line.strip()
|
||||||
|
if not line or line.startswith('#'):
|
||||||
|
continue
|
||||||
|
proxies.append(line)
|
||||||
|
|
||||||
|
results = []
|
||||||
|
with ThreadPoolExecutor(max_workers=concurrency) as ex:
|
||||||
|
futures = {ex.submit(test_proxy, p, test_url): p for p in proxies}
|
||||||
|
for fut in as_completed(futures):
|
||||||
|
try:
|
||||||
|
r = fut.result()
|
||||||
|
except Exception as e:
|
||||||
|
r = {"proxy": futures[fut], "ok": False, "error": str(e)}
|
||||||
|
results.append(r)
|
||||||
|
print(f"Tested: {r.get('proxy')} ok={r.get('ok')} rc={r.get('rc', '-') } elapsed={r.get('elapsed_ms','-')}ms")
|
||||||
|
|
||||||
|
# Ordenar proxies válidos por elapsed asc
|
||||||
|
valid = [r for r in results if r.get('ok')]
|
||||||
|
valid_sorted = sorted(valid, key=lambda x: x.get('elapsed_ms', 999999))
|
||||||
|
|
||||||
|
# Guardar JSON completo
|
||||||
|
out = {"tested_at": int(time.time()), "test_url": test_url, "results": results, "valid_count": len(valid_sorted)}
|
||||||
|
with open(out_json, 'w', encoding='utf-8') as fh:
|
||||||
|
json.dump(out, fh, indent=2, ensure_ascii=False)
|
||||||
|
|
||||||
|
# Guardar lista TXT (whitelist) con orden preferido
|
||||||
|
with open(out_txt, 'w', encoding='utf-8') as fh:
|
||||||
|
for r in valid_sorted:
|
||||||
|
fh.write(r['proxy'] + '\n')
|
||||||
|
|
||||||
|
return out, valid_sorted
|
||||||
|
|
||||||
|
|
||||||
|
def _extract_proxies_from_json(obj):
|
||||||
|
"""Dado un objeto JSON (parsed), intenta extraer una lista de proxies en forma de URLs.
|
||||||
|
Soporta varias estructuras comunes:
|
||||||
|
- lista simple de strings: ["socks5h://1.2.3.4:1080", ...]
|
||||||
|
- lista de objetos con keys como ip, port, protocol
|
||||||
|
- objetos anidados con 'proxy' o 'url' o 'address'
|
||||||
|
"""
|
||||||
|
proxies = []
|
||||||
|
if isinstance(obj, list):
|
||||||
|
for item in obj:
|
||||||
|
if isinstance(item, str):
|
||||||
|
proxies.append(item.strip())
|
||||||
|
elif isinstance(item, dict):
|
||||||
|
# intentar keys comunes
|
||||||
|
# ejemplos: {"ip":"1.2.3.4","port":1080, "protocol":"socks5"}
|
||||||
|
ip = item.get('ip') or item.get('host') or item.get('address') or item.get('ip_address')
|
||||||
|
port = item.get('port') or item.get('p')
|
||||||
|
proto = item.get('protocol') or item.get('proto') or item.get('type') or item.get('scheme')
|
||||||
|
if ip and port:
|
||||||
|
proto = proto or 'http'
|
||||||
|
proxies.append(f"{proto}://{ip}:{port}")
|
||||||
|
continue
|
||||||
|
# buscar valores en keys que puedan contener url
|
||||||
|
for k in ('proxy','url','address','connect'):
|
||||||
|
v = item.get(k)
|
||||||
|
if isinstance(v, str) and v.strip():
|
||||||
|
proxies.append(v.strip())
|
||||||
|
break
|
||||||
|
elif isinstance(obj, dict):
|
||||||
|
# encontrar listas dentro del dict
|
||||||
|
for v in obj.values():
|
||||||
|
if isinstance(v, (list, dict)):
|
||||||
|
proxies.extend(_extract_proxies_from_json(v))
|
||||||
|
# si el dict mismo tiene un campo 'proxy' o similar
|
||||||
|
for k in ('proxies','list','data'):
|
||||||
|
if k in obj and isinstance(obj[k], (list,dict)):
|
||||||
|
proxies.extend(_extract_proxies_from_json(obj[k]))
|
||||||
|
return [p for p in proxies if p]
|
||||||
|
|
||||||
|
|
||||||
|
def download_and_write_proxies(url: str, out_file: str) -> int:
|
||||||
|
"""Descarga JSON desde `url`, extrae proxies y las escribe en `out_file`.
|
||||||
|
Retorna número de proxies escritas.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
r = requests.get(url, timeout=30)
|
||||||
|
r.raise_for_status()
|
||||||
|
data = r.json()
|
||||||
|
except Exception as e:
|
||||||
|
raise RuntimeError(f"Error descargando/parsing JSON desde {url}: {e}")
|
||||||
|
|
||||||
|
proxies = _extract_proxies_from_json(data)
|
||||||
|
# normalizar: si la entrada es 'ip:port' convertir a http://ip:port
|
||||||
|
normalized = []
|
||||||
|
for p in proxies:
|
||||||
|
p = p.strip()
|
||||||
|
if not p:
|
||||||
|
continue
|
||||||
|
# si es 'ip:port' o 'ip port'
|
||||||
|
if ':' in p and not p.lower().startswith(('http://','https://','socks5://','socks5h://','socks4://')):
|
||||||
|
# asumir http
|
||||||
|
normalized.append('http://' + p)
|
||||||
|
else:
|
||||||
|
normalized.append(p)
|
||||||
|
|
||||||
|
# dedup preserving order
|
||||||
|
seen = set()
|
||||||
|
out = []
|
||||||
|
for p in normalized:
|
||||||
|
if p in seen:
|
||||||
|
continue
|
||||||
|
seen.add(p)
|
||||||
|
out.append(p)
|
||||||
|
|
||||||
|
if not out:
|
||||||
|
# como fallback, si JSON es una estructura plana de objetos con 'ip' y 'port'
|
||||||
|
# ya manejado, si nada, error
|
||||||
|
raise RuntimeError(f"No se extrajeron proxies del JSON: {url}")
|
||||||
|
|
||||||
|
with open(out_file, 'w', encoding='utf-8') as fh:
|
||||||
|
for p in out:
|
||||||
|
fh.write(p + '\n')
|
||||||
|
return len(out)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
parser = argparse.ArgumentParser(description='Test a list of proxies with yt-dlp and generate a whitelist')
|
||||||
|
parser.add_argument('--input', default='tools/proxies.txt', help='Input file with proxies (one per line)')
|
||||||
|
parser.add_argument('--out-json', default='tools/whitelist.json', help='Output JSON results')
|
||||||
|
parser.add_argument('--out-txt', default='tools/whitelist.txt', help='Output whitelist (one proxy per line)')
|
||||||
|
parser.add_argument('--test-url', default='https://www.youtube.com/watch?v=dQw4w9WgXcQ', help='YouTube test URL to use')
|
||||||
|
parser.add_argument('--concurrency', type=int, default=6, help='Concurrent workers')
|
||||||
|
parser.add_argument('--from-url', default='', help='Download a JSON of proxies from a URL and use it as input')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# If from-url provided, download and write to temporary input file
|
||||||
|
input_file = args.input
|
||||||
|
temp_written = False
|
||||||
|
try:
|
||||||
|
if args.from_url:
|
||||||
|
print(f"Downloading proxies JSON from: {args.from_url}")
|
||||||
|
written = download_and_write_proxies(args.from_url, input_file)
|
||||||
|
print(f"Wrote {written} proxies to {input_file}")
|
||||||
|
temp_written = True
|
||||||
|
|
||||||
|
if not os.path.exists(input_file):
|
||||||
|
print(f"Input file {input_file} not found. Create it with one proxy per line or use --from-url.")
|
||||||
|
raise SystemExit(1)
|
||||||
|
|
||||||
|
out, valid_sorted = generate_whitelist(input_file, args.out_json, args.out_txt, args.test_url, args.concurrency)
|
||||||
|
print('\nSummary:')
|
||||||
|
print(f" Tested: {len(out['results'])}, Valid: {len(valid_sorted)}")
|
||||||
|
print(f" JSON: {args.out_json}, TXT whitelist: {args.out_txt}")
|
||||||
|
finally:
|
||||||
|
# optionally remove temp file? keep it for inspection
|
||||||
|
pass
|
||||||
177
tools/playwright_extract_m3u8.py
Executable file
177
tools/playwright_extract_m3u8.py
Executable file
@ -0,0 +1,177 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""playwright_extract_m3u8.py
|
||||||
|
|
||||||
|
Abre una página de YouTube con Playwright y captura la primera URL m3u8/HLS
|
||||||
|
visible en las peticiones de red. También puede exportar cookies al formato
|
||||||
|
Netscape para usarlas con yt-dlp/tu API.
|
||||||
|
|
||||||
|
Uso:
|
||||||
|
python3 tools/playwright_extract_m3u8.py --video https://www.youtube.com/watch?v=ID [--profile /path/to/profile] [--headless]
|
||||||
|
|
||||||
|
Requisitos (host):
|
||||||
|
pip install playwright
|
||||||
|
python -m playwright install
|
||||||
|
|
||||||
|
Notas:
|
||||||
|
- Recomiendo ejecutarlo en el host (no en el contenedor) para usar el perfil de Chrome
|
||||||
|
y para que Playwright pueda manejar la interfaz gráfica si necesitas login/manual.
|
||||||
|
- Si pasas --profile, se lanzará una sesión persistente usando ese directorio (útil
|
||||||
|
para usar tu sesión de Chrome ya logueada). Si dejas vacío, se usa un contexto limpio.
|
||||||
|
"""
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
import time
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
try:
|
||||||
|
from playwright.sync_api import sync_playwright, TimeoutError as PWTimeout
|
||||||
|
except Exception as e:
|
||||||
|
print("playwright no está instalado. Instala con: pip install playwright && python -m playwright install")
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
def write_netscape_cookie_file(cookies, target_path):
|
||||||
|
# cookies: list of dicts like Playwright provides
|
||||||
|
lines = ["# Netscape HTTP Cookie File"]
|
||||||
|
for c in cookies:
|
||||||
|
domain = c.get("domain", "")
|
||||||
|
flag = "TRUE" if domain.startswith('.') else "FALSE"
|
||||||
|
path = c.get("path", "/")
|
||||||
|
secure = "TRUE" if c.get("secure") else "FALSE"
|
||||||
|
expires = str(int(c.get("expires", 0))) if c.get("expires") else "0"
|
||||||
|
name = c.get("name", "")
|
||||||
|
value = c.get("value", "")
|
||||||
|
lines.append("\t".join([domain, flag, path, secure, expires, name, value]))
|
||||||
|
Path(target_path).parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
with open(target_path, "w", encoding="utf-8") as fh:
|
||||||
|
fh.write("\n".join(lines) + "\n")
|
||||||
|
|
||||||
|
|
||||||
|
def extract_m3u8(video_url: str, profile: str | None, headless: bool, timeout: int = 45, save_cookies: bool = True):
|
||||||
|
result = {"m3u8_urls": [], "cookies_file": None, "errors": []}
|
||||||
|
data_dir = Path.cwd() / "data"
|
||||||
|
data_dir.mkdir(exist_ok=True)
|
||||||
|
target_cookies = str(data_dir / "cookies.txt")
|
||||||
|
|
||||||
|
with sync_playwright() as p:
|
||||||
|
# Usar Chromium para mejor compatibilidad con Chrome profile
|
||||||
|
browser_type = p.chromium
|
||||||
|
# establecer User-Agent a uno real para simular navegador
|
||||||
|
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
||||||
|
extra_headers = {"Accept-Language": "en-US,en;q=0.9", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}
|
||||||
|
|
||||||
|
launch_args = ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage']
|
||||||
|
if profile:
|
||||||
|
# persistent context uses a profile dir (user data dir)
|
||||||
|
user_data_dir = profile
|
||||||
|
# avoid passing user_agent due to some Playwright builds missing API; set headers only
|
||||||
|
context = browser_type.launch_persistent_context(user_data_dir=user_data_dir, headless=headless, extra_http_headers=extra_headers, args=launch_args)
|
||||||
|
else:
|
||||||
|
# pass common args to help in container environments
|
||||||
|
browser = browser_type.launch(headless=headless, args=launch_args)
|
||||||
|
# do not pass user_agent param; rely on browser default and headers
|
||||||
|
context = browser.new_context(extra_http_headers=extra_headers)
|
||||||
|
|
||||||
|
# debug info
|
||||||
|
try:
|
||||||
|
print(f"[playwright] started browser headless={headless} profile={'yes' if profile else 'no'}")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
page = context.new_page()
|
||||||
|
|
||||||
|
collected = set()
|
||||||
|
|
||||||
|
def on_response(resp):
|
||||||
|
try:
|
||||||
|
url = resp.url
|
||||||
|
# heurística: m3u8 en URL o content-type de respuesta
|
||||||
|
if ".m3u8" in url.lower():
|
||||||
|
collected.add(url)
|
||||||
|
else:
|
||||||
|
ct = resp.headers.get("content-type", "")
|
||||||
|
if "application/vnd.apple.mpegurl" in ct or "vnd.apple.mpegurl" in ct or "application/x-mpegURL" in ct:
|
||||||
|
collected.add(url)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
page.on("response", on_response)
|
||||||
|
|
||||||
|
try:
|
||||||
|
page.goto(video_url, timeout=timeout * 1000)
|
||||||
|
# esperar un poco para que las peticiones de manifest se disparen
|
||||||
|
wait_seconds = 6
|
||||||
|
for i in range(wait_seconds):
|
||||||
|
time.sleep(1)
|
||||||
|
# si encontramos algo temprano, romper
|
||||||
|
if collected:
|
||||||
|
break
|
||||||
|
|
||||||
|
# Si no encontramos m3u8, intentar forzar la apertura del player y realizar scroll
|
||||||
|
if not collected:
|
||||||
|
try:
|
||||||
|
# click play
|
||||||
|
page.evaluate("() => { const v = document.querySelector('video'); if (v) v.play(); }")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
# esperar más
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
# recopilar URLs
|
||||||
|
result_urls = list(collected)
|
||||||
|
# desduplicar y ordenar
|
||||||
|
result_urls = sorted(set(result_urls))
|
||||||
|
result['m3u8_urls'] = result_urls
|
||||||
|
|
||||||
|
# guardar cookies si se pidió
|
||||||
|
if save_cookies:
|
||||||
|
try:
|
||||||
|
cookies = context.cookies()
|
||||||
|
write_netscape_cookie_file(cookies, target_cookies)
|
||||||
|
result['cookies_file'] = target_cookies
|
||||||
|
except Exception as e:
|
||||||
|
result['errors'].append(f"cookie_export_error:{e}")
|
||||||
|
|
||||||
|
except PWTimeout as e:
|
||||||
|
result['errors'].append(f"page_timeout: {e}")
|
||||||
|
except Exception as e:
|
||||||
|
import traceback
|
||||||
|
result['errors'].append(traceback.format_exc())
|
||||||
|
finally:
|
||||||
|
# intentar cerrar context y browser si existen
|
||||||
|
try:
|
||||||
|
if 'context' in locals() and context:
|
||||||
|
try:
|
||||||
|
context.close()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if 'browser' in locals() and browser:
|
||||||
|
try:
|
||||||
|
browser.close()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
parser = argparse.ArgumentParser(description='Playwright m3u8 extractor for YouTube')
|
||||||
|
parser.add_argument('--video', required=True, help='Video URL or ID (e.g. https://www.youtube.com/watch?v=ID)')
|
||||||
|
parser.add_argument('--profile', default='', help='Path to browser profile (user data dir) to reuse logged session')
|
||||||
|
parser.add_argument('--headless', action='store_true', help='Run headless')
|
||||||
|
parser.add_argument('--timeout', type=int, default=45, help='Timeout for page load (seconds)')
|
||||||
|
parser.add_argument('--no-cookies', dest='save_cookies', action='store_false', help='Don\'t save cookies to ./data/cookies.txt')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
video = args.video
|
||||||
|
if len(video) == 11 and not video.startswith('http'):
|
||||||
|
video = f'https://www.youtube.com/watch?v={video}'
|
||||||
|
|
||||||
|
res = extract_m3u8(video, profile=args.profile or None, headless=args.headless, timeout=args.timeout, save_cookies=args.save_cookies)
|
||||||
|
print(json.dumps(res, indent=2, ensure_ascii=False))
|
||||||
0
tools/proxies_sample.txt
Normal file
0
tools/proxies_sample.txt
Normal file
10
tools/user_proxies.txt
Normal file
10
tools/user_proxies.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Proxies proporcionados por el usuario (formato: esquema://ip:port)
|
||||||
|
# Fuente: lista JSON proporcionada por el usuario — comprobadas por Google (campo "google": true)
|
||||||
|
|
||||||
|
http://48.210.225.96:80
|
||||||
|
http://107.174.231.218:8888
|
||||||
|
http://188.239.43.6:80
|
||||||
|
http://52.229.30.3:80
|
||||||
|
http://142.93.202.130:3128
|
||||||
|
http://154.219.101.86:8888
|
||||||
|
|
||||||
256
tools/whitelist.json
Normal file
256
tools/whitelist.json
Normal file
@ -0,0 +1,256 @@
|
|||||||
|
{
|
||||||
|
"tested_at": 1772912928,
|
||||||
|
"test_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
|
||||||
|
"results": [
|
||||||
|
{
|
||||||
|
"proxy": "http://107.174.231.218:8888",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 2714,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: ('Unable to connect to proxy', OSError('Tunnel connection failed: 400 Bad Request')) (caused by ProxyError(\"('Unable to connect to proxy', OSError('Tunnel connection failed: 400 Bad Request'))\")); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://107.174.231.218:8888",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 1473,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: ('[Errno 0] Invalid response version from server. Expected 05 got 48', InvalidVersionError(0, 'Invalid response version from server. Expected 05 got 48')) (caused by ProxyError(\"('[Errno 0] Invalid response version from server. Expected 05 got 48', InvalidVersionError(0, 'Invalid response version from server. Expected 05 got 48'))\")); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://48.210.225.96:9050",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 4559,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: ('[Errno 0] Invalid response version from server. Expected 05 got 48', InvalidVersionError(0, 'Invalid response version from server. Expected 05 got 48')) (caused by ProxyError(\"('[Errno 0] Invalid response version from server. Expected 05 got 48', InvalidVersionError(0, 'Invalid response version from server. Expected 05 got 48'))\")); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://48.210.225.96:80",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 4850,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: ('[Errno 0] Invalid response version from server. Expected 05 got 48', InvalidVersionError(0, 'Invalid response version from server. Expected 05 got 48')) (caused by ProxyError(\"('[Errno 0] Invalid response version from server. Expected 05 got 48', InvalidVersionError(0, 'Invalid response version from server. Expected 05 got 48'))\")); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "http://48.210.225.96:80",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 5159,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: ('Unable to connect to proxy', OSError('Tunnel connection failed: 400 Bad Request')) (caused by ProxyError(\"('Unable to connect to proxy', OSError('Tunnel connection failed: 400 Bad Request'))\")); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://107.174.231.218:1080",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 1057,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused (caused by TransportError(\"SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused\"))\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://107.174.231.218:10808",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 1208,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused (caused by TransportError(\"SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused\"))\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://107.174.231.218:9050",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 1123,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused (caused by TransportError(\"SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused\"))\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://188.239.43.6:80",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 7075,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 104] Connection reset by peer (caused by TransportError(\"SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 104] Connection reset by peer\"))\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "http://188.239.43.6:80",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 7192,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) (caused by TransportError(\"('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))\"))\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "http://52.229.30.3:80",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 2332,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: ('Unable to connect to proxy', OSError('Tunnel connection failed: 400 Bad Request')) (caused by ProxyError(\"('Unable to connect to proxy', OSError('Tunnel connection failed: 400 Bad Request'))\")); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://52.229.30.3:80",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 2265,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: ('[Errno 0] Invalid response version from server. Expected 05 got 48', InvalidVersionError(0, 'Invalid response version from server. Expected 05 got 48')) (caused by ProxyError(\"('[Errno 0] Invalid response version from server. Expected 05 got 48', InvalidVersionError(0, 'Invalid response version from server. Expected 05 got 48'))\")); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://48.210.225.96:1080",
|
||||||
|
"ok": false,
|
||||||
|
"error": "timeout",
|
||||||
|
"elapsed_ms": 25022
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://48.210.225.96:10808",
|
||||||
|
"ok": false,
|
||||||
|
"error": "timeout",
|
||||||
|
"elapsed_ms": 25036
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://52.229.30.3:9050",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 2430,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: ('[Errno 0] Invalid response version from server. Expected 05 got 48', InvalidVersionError(0, 'Invalid response version from server. Expected 05 got 48')) (caused by ProxyError(\"('[Errno 0] Invalid response version from server. Expected 05 got 48', InvalidVersionError(0, 'Invalid response version from server. Expected 05 got 48'))\")); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "http://142.93.202.130:3128",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 1668,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: ('Unable to connect to proxy', OSError('Tunnel connection failed: 400 Bad Request')) (caused by ProxyError(\"('Unable to connect to proxy', OSError('Tunnel connection failed: 400 Bad Request'))\")); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://142.93.202.130:3128",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 1652,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: ('[Errno 0] Invalid response version from server. Expected 05 got 48', InvalidVersionError(0, 'Invalid response version from server. Expected 05 got 48')) (caused by ProxyError(\"('[Errno 0] Invalid response version from server. Expected 05 got 48', InvalidVersionError(0, 'Invalid response version from server. Expected 05 got 48'))\")); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://188.239.43.6:1080",
|
||||||
|
"ok": false,
|
||||||
|
"error": "timeout",
|
||||||
|
"elapsed_ms": 25031
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://188.239.43.6:10808",
|
||||||
|
"ok": false,
|
||||||
|
"error": "timeout",
|
||||||
|
"elapsed_ms": 25030
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://142.93.202.130:1080",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 1364,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused (caused by TransportError(\"SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused\"))\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://142.93.202.130:10808",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 1405,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused (caused by TransportError(\"SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused\"))\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://142.93.202.130:9050",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 1322,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused (caused by TransportError(\"SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused\"))\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://154.219.101.86:1080",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 2199,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused (caused by TransportError(\"SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused\"))\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "http://154.219.101.86:8888",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 3651,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: ('Unable to connect to proxy', OSError('Tunnel connection failed: 400 Bad Request')) (caused by ProxyError(\"('Unable to connect to proxy', OSError('Tunnel connection failed: 400 Bad Request'))\")); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://154.219.101.86:8888",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 3628,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: ('[Errno 0] Invalid response version from server. Expected 05 got 48', InvalidVersionError(0, 'Invalid response version from server. Expected 05 got 48')) (caused by ProxyError(\"('[Errno 0] Invalid response version from server. Expected 05 got 48', InvalidVersionError(0, 'Invalid response version from server. Expected 05 got 48'))\")); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://154.219.101.86:10808",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 1981,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused (caused by TransportError(\"SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused\"))\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://188.239.43.6:9050",
|
||||||
|
"ok": false,
|
||||||
|
"error": "timeout",
|
||||||
|
"elapsed_ms": 25023
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://154.219.101.86:9050",
|
||||||
|
"ok": false,
|
||||||
|
"rc": 1,
|
||||||
|
"elapsed_ms": 1962,
|
||||||
|
"bot_detected": false,
|
||||||
|
"stderr_preview": "ERROR: [youtube] dQw4w9WgXcQ: Unable to download API page: SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused (caused by TransportError(\"SocksHTTPSConnection(host='www.youtube.com', port=443): Failed to establish a new connection: [Errno 111] Connection refused\"))\n",
|
||||||
|
"stdout_preview": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://52.229.30.3:1080",
|
||||||
|
"ok": false,
|
||||||
|
"error": "timeout",
|
||||||
|
"elapsed_ms": 25026
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"proxy": "socks5h://52.229.30.3:10808",
|
||||||
|
"ok": false,
|
||||||
|
"error": "timeout",
|
||||||
|
"elapsed_ms": 25028
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"valid_count": 0
|
||||||
|
}
|
||||||
0
tools/whitelist.txt
Normal file
0
tools/whitelist.txt
Normal file
Loading…
x
Reference in New Issue
Block a user