Fix YouTube 500 error (n-challenge) and Telegram callback_data overflow
This commit is contained in:
parent
4629535e97
commit
326eabaa99
12 changed files with 292 additions and 254 deletions
27
bot.py
27
bot.py
|
|
@ -984,9 +984,14 @@ async def get_formats_from_service(url: str) -> list[dict] | None:
|
||||||
|
|
||||||
|
|
||||||
async def show_quality_selection(status_message: Message, formats: list[dict], locale: str):
|
async def show_quality_selection(status_message: Message, formats: list[dict], locale: str):
|
||||||
"""Показывает inline клавиатуру с выбором качества видео"""
|
"""Показывает inline клавиатуру с выбором качества видео
|
||||||
|
|
||||||
|
Используем короткий индекс (quality:0, quality:1, ...) вместо полного format_id,
|
||||||
|
т.к. Telegram ограничивает callback_data 64 байтами, а format_id может быть длинным
|
||||||
|
(например "308+251-drc/bestvideo[height<=1080]+bestaudio/best[height<=1080]").
|
||||||
|
"""
|
||||||
keyboard = []
|
keyboard = []
|
||||||
for fmt in formats:
|
for idx, fmt in enumerate(formats):
|
||||||
label = fmt.get('label', fmt.get('quality', 'Unknown'))
|
label = fmt.get('label', fmt.get('quality', 'Unknown'))
|
||||||
filesize = fmt.get('filesize_mb')
|
filesize = fmt.get('filesize_mb')
|
||||||
if filesize:
|
if filesize:
|
||||||
|
|
@ -995,7 +1000,7 @@ async def show_quality_selection(status_message: Message, formats: list[dict], l
|
||||||
button_text = label
|
button_text = label
|
||||||
keyboard.append([InlineKeyboardButton(
|
keyboard.append([InlineKeyboardButton(
|
||||||
text=button_text,
|
text=button_text,
|
||||||
callback_data=f"quality:{fmt['format_id']}"
|
callback_data=f"quality:{idx}"
|
||||||
)])
|
)])
|
||||||
|
|
||||||
# Кнопка отмены
|
# Кнопка отмены
|
||||||
|
|
@ -1032,8 +1037,17 @@ async def handle_format_selection(update: Update, context: ContextTypes.DEFAULT_
|
||||||
await status_message.edit_text(get_text(locale, 'quality_cancelled'))
|
await status_message.edit_text(get_text(locale, 'quality_cancelled'))
|
||||||
return
|
return
|
||||||
|
|
||||||
# Извлекаем format_id
|
# Извлекаем индекс формата и получаем format_id из сохранённого списка
|
||||||
format_id = callback_data.replace('quality:', '')
|
try:
|
||||||
|
format_index = int(callback_data.replace('quality:', ''))
|
||||||
|
formats_list = data.get('formats_list', [])
|
||||||
|
if format_index < 0 or format_index >= len(formats_list):
|
||||||
|
raise ValueError(f"Index {format_index} out of range")
|
||||||
|
format_id = formats_list[format_index].get('format_id', '')
|
||||||
|
except (ValueError, IndexError) as e:
|
||||||
|
logger.error(f"Invalid format selection: {e}")
|
||||||
|
await status_message.edit_text(get_text(locale, 'processing'))
|
||||||
|
format_id = None # Скачиваем без выбора качества
|
||||||
|
|
||||||
# Обновляем сообщение - добавляем в очередь
|
# Обновляем сообщение - добавляем в очередь
|
||||||
await status_message.edit_text(get_text(locale, 'processing'))
|
await status_message.edit_text(get_text(locale, 'processing'))
|
||||||
|
|
@ -1139,7 +1153,8 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||||
'chat_id': chat_id,
|
'chat_id': chat_id,
|
||||||
'chat_type': chat_type,
|
'chat_type': chat_type,
|
||||||
'original_message': update.message,
|
'original_message': update.message,
|
||||||
'status_message': status_message
|
'status_message': status_message,
|
||||||
|
'formats_list': formats, # для lookup по индексу в callback
|
||||||
}
|
}
|
||||||
await show_quality_selection(status_message, formats, locale)
|
await show_quality_selection(status_message, formats, locale)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,10 @@ services:
|
||||||
build: .
|
build: .
|
||||||
container_name: instagram_downloader_service
|
container_name: instagram_downloader_service
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
network_mode: host
|
||||||
- "5556:5556"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./downloads:/app/downloads
|
- ./downloads:/app/downloads
|
||||||
- ./instagram_cookies.txt:/app/instagram_cookies.txt
|
- ./instagram_cookies.txt:/app/instagram_cookies.txt
|
||||||
environment:
|
environment:
|
||||||
- INSTAGRAM_COOKIES_FILE=/app/instagram_cookies.txt
|
- INSTAGRAM_COOKIES_FILE=/app/instagram_cookies.txt
|
||||||
- PORT=5556
|
- PORT=5556
|
||||||
dns:
|
|
||||||
- 8.8.8.8
|
|
||||||
- 8.8.4.4
|
|
||||||
extra_hosts:
|
|
||||||
- "host.docker.internal:host-gateway"
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,5 +19,6 @@ RUN mkdir -p downloads
|
||||||
|
|
||||||
# Запуск приложения
|
# Запуск приложения
|
||||||
# Gunicorn: 1 worker (последовательная обработка), без таймаута
|
# Gunicorn: 1 worker (последовательная обработка), без таймаута
|
||||||
CMD ["gunicorn", "--workers=1", "--timeout=0", "--bind=0.0.0.0:5000", "app:app"]
|
# Порт берется из переменной окружения PORT (по умолчанию 5000)
|
||||||
|
CMD sh -c "gunicorn --workers=1 --timeout=0 --bind=0.0.0.0:${PORT:-5000} app:app"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,8 @@ services:
|
||||||
build: .
|
build: .
|
||||||
container_name: tiktok_downloader_service
|
container_name: tiktok_downloader_service
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
network_mode: host
|
||||||
- "5559:5000"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./downloads:/app/downloads
|
- ./downloads:/app/downloads
|
||||||
networks:
|
environment:
|
||||||
- tiktok_network
|
- PORT=5559
|
||||||
|
|
||||||
networks:
|
|
||||||
tiktok_network:
|
|
||||||
driver: bridge
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,6 @@ RUN mkdir -p downloads
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
# Gunicorn: 1 worker (последовательная обработка), без таймаута
|
# Gunicorn: 1 worker (последовательная обработка), без таймаута
|
||||||
CMD ["gunicorn", "--workers=1", "--timeout=0", "--bind=0.0.0.0:5000", "app:app"]
|
# Порт берется из переменной окружения PORT (по умолчанию 5000)
|
||||||
|
CMD sh -c "gunicorn --workers=1 --timeout=0 --bind=0.0.0.0:${PORT:-5000} app:app"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,8 @@ services:
|
||||||
build: .
|
build: .
|
||||||
container_name: vk_downloader_service
|
container_name: vk_downloader_service
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
network_mode: host
|
||||||
- "5555:5000"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./downloads:/app/downloads
|
- ./downloads:/app/downloads
|
||||||
networks:
|
environment:
|
||||||
- vk_network
|
- PORT=5555
|
||||||
|
|
||||||
networks:
|
|
||||||
vk_network:
|
|
||||||
driver: bridge
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,6 @@ RUN mkdir -p downloads
|
||||||
|
|
||||||
# Запуск приложения
|
# Запуск приложения
|
||||||
# Gunicorn: 1 worker (последовательная обработка), без таймаута
|
# Gunicorn: 1 worker (последовательная обработка), без таймаута
|
||||||
CMD ["gunicorn", "--workers=1", "--timeout=0", "--bind=0.0.0.0:5000", "app:app"]
|
# Порт берется из переменной окружения PORT (по умолчанию 5000)
|
||||||
|
CMD sh -c "gunicorn --workers=1 --timeout=0 --bind=0.0.0.0:${PORT:-5000} app:app"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,8 @@ services:
|
||||||
build: .
|
build: .
|
||||||
container_name: yapfiles_downloader_service
|
container_name: yapfiles_downloader_service
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
network_mode: host
|
||||||
- "5558:5000"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./downloads:/app/downloads
|
- ./downloads:/app/downloads
|
||||||
networks:
|
environment:
|
||||||
- yapfiles_network
|
- PORT=5558
|
||||||
|
|
||||||
networks:
|
|
||||||
yapfiles_network:
|
|
||||||
driver: bridge
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
FROM python:3.11-slim
|
FROM python:3.11-slim
|
||||||
|
|
||||||
# Устанавливаем зависимости для yt-dlp
|
# Устанавливаем зависимости для yt-dlp (включая Node.js для JS runtime)
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
wget \
|
wget \
|
||||||
|
nodejs \
|
||||||
|
npm \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ YouTube Video Downloader Service
|
||||||
Отдельный микросервис для скачивания видео с YouTube
|
Отдельный микросервис для скачивания видео с YouTube
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
import logging
|
import logging
|
||||||
import traceback
|
import traceback
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
@ -33,6 +34,15 @@ def _safe_filename(title: str) -> str:
|
||||||
return str(DOWNLOADS_DIR / f'{uuid.uuid4()}_{safe_title}.%(ext)s')
|
return str(DOWNLOADS_DIR / f'{uuid.uuid4()}_{safe_title}.%(ext)s')
|
||||||
|
|
||||||
|
|
||||||
|
def _cleanup_downloads():
|
||||||
|
"""Удаляет все файлы из папки загрузок"""
|
||||||
|
for f in DOWNLOADS_DIR.glob('*'):
|
||||||
|
try:
|
||||||
|
f.unlink()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def _is_valid_cookies_file(cookies_path: Path) -> bool:
|
def _is_valid_cookies_file(cookies_path: Path) -> bool:
|
||||||
"""Проверяет, что файл cookies существует и содержит данные (не только заголовки)"""
|
"""Проверяет, что файл cookies существует и содержит данные (не только заголовки)"""
|
||||||
logger.info(f"[COOKIES CHECK] Проверка файла cookies: {cookies_path.absolute()}")
|
logger.info(f"[COOKIES CHECK] Проверка файла cookies: {cookies_path.absolute()}")
|
||||||
|
|
@ -75,6 +85,84 @@ def _is_valid_cookies_file(cookies_path: Path) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_height(format_dict: dict) -> int:
|
||||||
|
"""Извлекает реальную высоту из формата: height/width/format_note"""
|
||||||
|
h = format_dict.get('height')
|
||||||
|
w = format_dict.get('width')
|
||||||
|
# Для вертикальных видео (Shorts) height и width могут быть перепутаны —
|
||||||
|
# берём меньшее значение как честный показатель разрешения
|
||||||
|
if h and w and isinstance(h, (int, float)) and isinstance(w, (int, float)):
|
||||||
|
real_h = min(int(h), int(w))
|
||||||
|
if real_h > 0:
|
||||||
|
return real_h
|
||||||
|
if h and isinstance(h, (int, float)) and h > 0:
|
||||||
|
return int(h)
|
||||||
|
# Если вообще нет размеров — парсим format_note (например "360p")
|
||||||
|
note = format_dict.get('format_note', '') or ''
|
||||||
|
match = re.search(r'(\d+)p', str(note))
|
||||||
|
if match:
|
||||||
|
return int(match.group(1))
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def _extract_height_from_format_id(format_id: str) -> int | None:
|
||||||
|
"""Извлекает ограничение по высоте из format_id (например 'best[height<=360]' -> 360)"""
|
||||||
|
match = re.search(r'height<[=]?\s*(\d+)', format_id)
|
||||||
|
if match:
|
||||||
|
return int(match.group(1))
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _make_base_ydl_opts(user_agent: str, cookies_file_path: Path | None = None) -> dict:
|
||||||
|
"""Формирует базовые опции yt-dlp, общие для info и download
|
||||||
|
|
||||||
|
Стратегия выбора player_client:
|
||||||
|
- Cookies есть → используем web клиенты (требуют n-challenge решения),
|
||||||
|
включаем js_runtimes + remote_components для решения n-challenge через Node.js.
|
||||||
|
- Cookies нет → используем android клиент (не поддерживает cookies,
|
||||||
|
но не требует n-challenge, хотя даёт меньше форматов).
|
||||||
|
"""
|
||||||
|
extractor_args = {}
|
||||||
|
cookies_available = cookies_file_path is not None and cookies_file_path.exists()
|
||||||
|
|
||||||
|
if not cookies_available:
|
||||||
|
# Без cookies используем android — он не требует n-challenge
|
||||||
|
extractor_args = {
|
||||||
|
'youtube': {
|
||||||
|
'player_client': ['android'],
|
||||||
|
'skip': ['translated_subs', 'hls'],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
opts = {
|
||||||
|
'quiet': False,
|
||||||
|
'no_warnings': False,
|
||||||
|
'user_agent': user_agent,
|
||||||
|
'socket_timeout': 60,
|
||||||
|
'extractor_retries': 3,
|
||||||
|
'http_headers': {
|
||||||
|
'User-Agent': user_agent,
|
||||||
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||||
|
'Accept-Language': 'en-us,en;q=0.5',
|
||||||
|
'Accept-Encoding': 'gzip, deflate',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://www.youtube.com/',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if extractor_args:
|
||||||
|
opts['extractor_args'] = extractor_args
|
||||||
|
|
||||||
|
if cookies_available:
|
||||||
|
opts['cookiefile'] = str(cookies_file_path.absolute())
|
||||||
|
# Включаем n-challenge решение через Node.js + EJS скрипт с GitHub
|
||||||
|
# yt-dlp скачает challenge solver скрипт из официального репозитория
|
||||||
|
opts['js_runtimes'] = {'node': {}}
|
||||||
|
opts['remote_components'] = ['ejs:github']
|
||||||
|
|
||||||
|
return opts
|
||||||
|
|
||||||
|
|
||||||
def download_youtube_video(url: str, max_retries: int = 3, format_id: str | None = None) -> Path:
|
def download_youtube_video(url: str, max_retries: int = 3, format_id: str | None = None) -> Path:
|
||||||
"""Скачивает видео с YouTube - используем cookies для обхода блокировок"""
|
"""Скачивает видео с YouTube - используем cookies для обхода блокировок"""
|
||||||
logger.info(f"[DOWNLOAD] Начало скачивания: {url}")
|
logger.info(f"[DOWNLOAD] Начало скачивания: {url}")
|
||||||
|
|
@ -93,51 +181,15 @@ def download_youtube_video(url: str, max_retries: int = 3, format_id: str | None
|
||||||
user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
|
user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
|
||||||
|
|
||||||
last_error = None
|
last_error = None
|
||||||
|
last_download_errors = [] # собираем ошибки по форматам для диагностики
|
||||||
for attempt in range(max_retries):
|
for attempt in range(max_retries):
|
||||||
try:
|
try:
|
||||||
# Определяем, это Shorts или обычное видео
|
|
||||||
is_shorts = '/shorts/' in url
|
is_shorts = '/shorts/' in url
|
||||||
|
|
||||||
# Базовые настройки для получения информации
|
# Базовые настройки для получения информации
|
||||||
# ВАЖНО: android и ios клиенты НЕ поддерживают cookies!
|
ydl_opts_info = _make_base_ydl_opts(user_agent, cookies_file_path if cookies_valid else None)
|
||||||
# Если используем cookies, используем только web клиент
|
|
||||||
# Если без cookies, используем android/ios/web для лучшей совместимости
|
|
||||||
if cookies_valid:
|
|
||||||
# С cookies используем только web клиент
|
|
||||||
player_clients = ['web']
|
|
||||||
logger.info(f"[DOWNLOAD] Используем только web клиент, т.к. android/ios не поддерживают cookies")
|
|
||||||
else:
|
|
||||||
# Без cookies используем все доступные клиенты
|
|
||||||
player_clients = ['android', 'ios', 'web'] if is_shorts else ['android', 'web']
|
|
||||||
logger.info(f"[DOWNLOAD] Используем клиенты без cookies: {player_clients}")
|
|
||||||
|
|
||||||
ydl_opts_info = {
|
logger.info(f"[DOWNLOAD] Попытка {attempt + 1}: {'cookies включены' if cookies_valid else 'работаем без cookies'}")
|
||||||
'quiet': False,
|
|
||||||
'no_warnings': False,
|
|
||||||
'user_agent': user_agent,
|
|
||||||
'socket_timeout': 60,
|
|
||||||
'extractor_args': {
|
|
||||||
'youtube': {
|
|
||||||
'player_client': player_clients,
|
|
||||||
'player_skip': ['webpage'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'http_headers': {
|
|
||||||
'User-Agent': user_agent,
|
|
||||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
||||||
'Accept-Language': 'en-us,en;q=0.5',
|
|
||||||
'Accept-Encoding': 'gzip, deflate',
|
|
||||||
'Connection': 'keep-alive',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
# Если есть валидный файл с cookies, используем его
|
|
||||||
if cookies_valid:
|
|
||||||
ydl_opts_info['cookiefile'] = str(cookies_file_path.absolute())
|
|
||||||
logger.info(f"[DOWNLOAD] Попытка {attempt + 1}: используем cookies из {cookies_file_path.absolute()}")
|
|
||||||
logger.info(f"[DOWNLOAD] Опции yt-dlp для получения info: cookiefile={cookies_file_path.absolute()}, player_clients={player_clients}")
|
|
||||||
else:
|
|
||||||
logger.info(f"[DOWNLOAD] Попытка {attempt + 1}: работаем без cookies")
|
|
||||||
|
|
||||||
# Пробуем получить информацию о видео
|
# Пробуем получить информацию о видео
|
||||||
info = None
|
info = None
|
||||||
|
|
@ -171,12 +223,8 @@ def download_youtube_video(url: str, max_retries: int = 3, format_id: str | None
|
||||||
|
|
||||||
if should_retry_without_cookies:
|
if should_retry_without_cookies:
|
||||||
logger.warning(f"[DOWNLOAD] Попытка {attempt + 1}: обнаружена ошибка, возможно связанная с cookies: {error_str[:200]}")
|
logger.warning(f"[DOWNLOAD] Попытка {attempt + 1}: обнаружена ошибка, возможно связанная с cookies: {error_str[:200]}")
|
||||||
logger.warning(f"[DOWNLOAD] Попытка {attempt + 1}: пробуем без cookies с android/ios клиентами...")
|
logger.warning(f"[DOWNLOAD] Попытка {attempt + 1}: пробуем без cookies...")
|
||||||
ydl_opts_info.pop('cookiefile', None)
|
ydl_opts_info.pop('cookiefile', None)
|
||||||
# Обновляем player_clients для работы без cookies
|
|
||||||
player_clients = ['android', 'ios', 'web'] if is_shorts else ['android', 'web']
|
|
||||||
ydl_opts_info['extractor_args']['youtube']['player_client'] = player_clients
|
|
||||||
logger.info(f"[DOWNLOAD] Попытка {attempt + 1}: обновлены player_clients для работы без cookies: {player_clients}")
|
|
||||||
try:
|
try:
|
||||||
with yt_dlp.YoutubeDL(ydl_opts_info) as ydl:
|
with yt_dlp.YoutubeDL(ydl_opts_info) as ydl:
|
||||||
info = ydl.extract_info(url, download=False)
|
info = ydl.extract_info(url, download=False)
|
||||||
|
|
@ -202,68 +250,54 @@ def download_youtube_video(url: str, max_retries: int = 3, format_id: str | None
|
||||||
# Это важно, т.к. format_id из get_youtube_formats() может не совпадать
|
# Это важно, т.к. format_id из get_youtube_formats() может не совпадать
|
||||||
# с format_id при повторном extract_info() в download_youtube_video().
|
# с format_id при повторном extract_info() в download_youtube_video().
|
||||||
default_format_options = [
|
default_format_options = [
|
||||||
'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best', # Предпочтительный
|
'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best',
|
||||||
'best[ext=mp4]/best', # Простой fallback
|
'best[ext=mp4]/best',
|
||||||
'bestvideo+bestaudio/best', # Без ограничения по расширению
|
'bestvideo+bestaudio/best',
|
||||||
'best', # Самый простой вариант
|
'best',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Добавляем fallback на combined форматы (например 18), которые всегда доступны
|
||||||
|
combined_fallback = ['best[ext=mp4]/best', 'best']
|
||||||
|
|
||||||
|
requested_height = None # высота, запрошенная пользователем
|
||||||
|
|
||||||
if format_id:
|
if format_id:
|
||||||
# Проверяем, является ли format_id конкретным code (содержит только цифры, +, /)
|
|
||||||
# или это format selector (содержит [])
|
|
||||||
is_specific_code = not ('[' in format_id or ']' in format_id)
|
is_specific_code = not ('[' in format_id or ']' in format_id)
|
||||||
|
requested_height = _extract_height_from_format_id(format_id)
|
||||||
|
|
||||||
|
format_options = [format_id]
|
||||||
|
|
||||||
|
if requested_height is not None:
|
||||||
if is_specific_code:
|
if is_specific_code:
|
||||||
# Конкретный format code — пробуем его, и если не нашелся,
|
|
||||||
# пробуем format selector для того же разрешения (если можем определить)
|
|
||||||
# и только потом стандартные fallback'и
|
|
||||||
logger.info(f"[DOWNLOAD] Конкретный format code: {format_id}")
|
logger.info(f"[DOWNLOAD] Конкретный format code: {format_id}")
|
||||||
|
|
||||||
# Пытаемся извлечь высоту из названия качества, которое пользователь выбрал
|
|
||||||
# (format_id может быть "18" для 360p или "137+140" для 1080p)
|
|
||||||
# Для таких случаев добавляем format selector как промежуточный fallback
|
|
||||||
format_options = [format_id] + default_format_options
|
|
||||||
else:
|
else:
|
||||||
# Это format selector — используем как раньше
|
logger.info(f"[DOWNLOAD] Format selector: {format_id}")
|
||||||
format_options = [format_id] + [opt for opt in default_format_options if opt != format_id]
|
logger.info(f"[DOWNLOAD] Добавляем качество-сохраняющий fallback для height<={requested_height}")
|
||||||
|
format_options.append(f"bestvideo[height<={requested_height}]+bestaudio/best[height<={requested_height}]")
|
||||||
|
format_options.extend(default_format_options)
|
||||||
|
format_options.extend(combined_fallback)
|
||||||
|
else:
|
||||||
|
format_options.extend(default_format_options)
|
||||||
|
|
||||||
logger.info(f"[DOWNLOAD] Используем указанный формат первым: {format_id}, затем стандартные fallback'и")
|
logger.info(f"[DOWNLOAD] Итоговый список format_options ({len(format_options)} шт.): {format_options}")
|
||||||
else:
|
else:
|
||||||
format_options = default_format_options
|
format_options = default_format_options
|
||||||
|
|
||||||
download_success = False
|
download_success = False
|
||||||
for format_option in format_options:
|
for format_option in format_options:
|
||||||
ydl_opts_download = {
|
ydl_opts_download = _make_base_ydl_opts(user_agent, cookies_file_path if cookies_valid else None)
|
||||||
|
ydl_opts_download.update({
|
||||||
'format': format_option,
|
'format': format_option,
|
||||||
'outtmpl': _safe_filename(video_title),
|
'outtmpl': _safe_filename(video_title),
|
||||||
'quiet': False,
|
# fragment_retries — для DASH форматов (видео без аудио),
|
||||||
'no_warnings': False,
|
# YouTube может разрывать фрагменты; увеличиваем retries
|
||||||
'user_agent': user_agent,
|
'fragment_retries': 3,
|
||||||
'socket_timeout': 60,
|
# allow_unplayable_formats — позволяет скачивать форматы,
|
||||||
'extractor_args': {
|
# которые YouTube помечает как "недоступные" для сторонних клиентов
|
||||||
'youtube': {
|
'allow_unplayable_formats': True,
|
||||||
# Используем те же клиенты, что и для получения информации
|
})
|
||||||
'player_client': player_clients,
|
|
||||||
'player_skip': ['webpage'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'http_headers': {
|
|
||||||
'User-Agent': user_agent,
|
|
||||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
||||||
'Accept-Language': 'en-us,en;q=0.5',
|
|
||||||
'Accept-Encoding': 'gzip, deflate',
|
|
||||||
'Connection': 'keep-alive',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
# Если есть валидный файл с cookies, используем его для скачивания
|
|
||||||
use_cookies_this_attempt = cookies_valid
|
use_cookies_this_attempt = cookies_valid
|
||||||
if use_cookies_this_attempt:
|
|
||||||
ydl_opts_download['cookiefile'] = str(cookies_file_path.absolute())
|
|
||||||
logger.info(f"[DOWNLOAD] Попытка {attempt + 1}: используем cookies для скачивания: {cookies_file_path.absolute()}")
|
|
||||||
else:
|
|
||||||
logger.info(f"[DOWNLOAD] Попытка {attempt + 1}: скачивание без cookies")
|
|
||||||
|
|
||||||
logger.info(f"[DOWNLOAD] Попытка {attempt + 1}/{max_retries}: начинаем скачивание (Shorts: {is_shorts}, формат: {format_option}, cookies: {use_cookies_this_attempt})")
|
logger.info(f"[DOWNLOAD] Попытка {attempt + 1}/{max_retries}: начинаем скачивание (Shorts: {is_shorts}, формат: {format_option}, cookies: {use_cookies_this_attempt})")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -272,7 +306,6 @@ def download_youtube_video(url: str, max_retries: int = 3, format_id: str | None
|
||||||
result_info = ydl.download([url])
|
result_info = ydl.download([url])
|
||||||
|
|
||||||
# Логируем информацию о том, что реально скачалось
|
# Логируем информацию о том, что реально скачалось
|
||||||
# result_info — это список словарей с информацией о каждом скачанном файле
|
|
||||||
if result_info:
|
if result_info:
|
||||||
for entry in result_info:
|
for entry in result_info:
|
||||||
if entry:
|
if entry:
|
||||||
|
|
@ -288,6 +321,7 @@ def download_youtube_video(url: str, max_retries: int = 3, format_id: str | None
|
||||||
except Exception as download_error:
|
except Exception as download_error:
|
||||||
error_str = str(download_error)
|
error_str = str(download_error)
|
||||||
error_lower = error_str.lower()
|
error_lower = error_str.lower()
|
||||||
|
last_download_errors.append(f"[{format_option}] {error_str[:300]}")
|
||||||
logger.error(f"[DOWNLOAD] Попытка {attempt + 1}: ошибка при скачивании формата {format_option}: {error_str}")
|
logger.error(f"[DOWNLOAD] Попытка {attempt + 1}: ошибка при скачивании формата {format_option}: {error_str}")
|
||||||
logger.error(f"[DOWNLOAD] Полный traceback:\n{traceback.format_exc()}")
|
logger.error(f"[DOWNLOAD] Полный traceback:\n{traceback.format_exc()}")
|
||||||
|
|
||||||
|
|
@ -295,15 +329,24 @@ def download_youtube_video(url: str, max_retries: int = 3, format_id: str | None
|
||||||
if use_cookies_this_attempt and ('cookies' in error_lower or 'bot' in error_lower or 'sign in' in error_lower or 'authentication' in error_lower):
|
if use_cookies_this_attempt and ('cookies' in error_lower or 'bot' in error_lower or 'sign in' in error_lower or 'authentication' in error_lower):
|
||||||
logger.warning(f"[DOWNLOAD] Попытка {attempt + 1}: обнаружена ошибка связанная с cookies для формата {format_option}: {error_str[:200]}")
|
logger.warning(f"[DOWNLOAD] Попытка {attempt + 1}: обнаружена ошибка связанная с cookies для формата {format_option}: {error_str[:200]}")
|
||||||
logger.warning(f"[DOWNLOAD] Попытка {attempt + 1}: пробуем без cookies...")
|
logger.warning(f"[DOWNLOAD] Попытка {attempt + 1}: пробуем без cookies...")
|
||||||
ydl_opts_download.pop('cookiefile', None)
|
# Пересоздаём opts без cookies
|
||||||
|
ydl_opts_download_no_cookies = _make_base_ydl_opts(user_agent, None)
|
||||||
|
ydl_opts_download_no_cookies.update({
|
||||||
|
'format': format_option,
|
||||||
|
'outtmpl': _safe_filename(video_title),
|
||||||
|
'fragment_retries': 3,
|
||||||
|
'allow_unplayable_formats': True,
|
||||||
|
})
|
||||||
try:
|
try:
|
||||||
with yt_dlp.YoutubeDL(ydl_opts_download) as ydl:
|
with yt_dlp.YoutubeDL(ydl_opts_download_no_cookies) as ydl:
|
||||||
ydl.download([url])
|
ydl.download([url])
|
||||||
logger.info(f"[DOWNLOAD] Попытка {attempt + 1}: успешно скачано без cookies")
|
logger.info(f"[DOWNLOAD] Попытка {attempt + 1}: успешно скачано без cookies")
|
||||||
download_success = True
|
download_success = True
|
||||||
cookies_valid = False # Отключаем cookies для следующих попыток
|
cookies_valid = False # Отключаем cookies для следующих попыток
|
||||||
break
|
break
|
||||||
except Exception as retry_error:
|
except Exception as retry_error:
|
||||||
|
retry_str = str(retry_error)
|
||||||
|
last_download_errors.append(f"[{format_option} без cookies] {retry_str[:300]}")
|
||||||
logger.error(f"[DOWNLOAD] Попытка {attempt + 1}: ошибка даже без cookies: {retry_error}")
|
logger.error(f"[DOWNLOAD] Попытка {attempt + 1}: ошибка даже без cookies: {retry_error}")
|
||||||
logger.error(f"[DOWNLOAD] Полный traceback без cookies:\n{traceback.format_exc()}")
|
logger.error(f"[DOWNLOAD] Полный traceback без cookies:\n{traceback.format_exc()}")
|
||||||
# Если и без cookies не получилось, пробуем следующий формат
|
# Если и без cookies не получилось, пробуем следующий формат
|
||||||
|
|
@ -319,7 +362,9 @@ def download_youtube_video(url: str, max_retries: int = 3, format_id: str | None
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not download_success:
|
if not download_success:
|
||||||
raise Exception("Не удалось скачать видео ни с одним из доступных форматов")
|
# Собираем детальный отчёт об ошибках
|
||||||
|
errors_summary = "; ".join(last_download_errors[-10:]) # последние 10 ошибок
|
||||||
|
raise Exception(f"Не удалось скачать видео ни с одним из доступных форматов. Ошибки: {errors_summary}")
|
||||||
|
|
||||||
# Находим скачанный файл
|
# Находим скачанный файл
|
||||||
downloaded_files = list(DOWNLOADS_DIR.glob('*'))
|
downloaded_files = list(DOWNLOADS_DIR.glob('*'))
|
||||||
|
|
@ -339,9 +384,7 @@ def download_youtube_video(url: str, max_retries: int = 3, format_id: str | None
|
||||||
# Если ошибка связана с форматом, пробуем другие настройки
|
# Если ошибка связана с форматом, пробуем другие настройки
|
||||||
if 'format is not available' in error_lower or 'requested format' in error_lower:
|
if 'format is not available' in error_lower or 'requested format' in error_lower:
|
||||||
logger.warning(f"[DOWNLOAD] Попытка {attempt + 1}: проблема с форматом, пробуем другие настройки на следующей попытке")
|
logger.warning(f"[DOWNLOAD] Попытка {attempt + 1}: проблема с форматом, пробуем другие настройки на следующей попытке")
|
||||||
# На следующей попытке попробуем другие player_client
|
|
||||||
if attempt < max_retries - 1:
|
if attempt < max_retries - 1:
|
||||||
import time
|
|
||||||
sleep_time = (attempt + 1) * 2
|
sleep_time = (attempt + 1) * 2
|
||||||
logger.info(f"[DOWNLOAD] Ожидание {sleep_time} секунд перед следующей попыткой...")
|
logger.info(f"[DOWNLOAD] Ожидание {sleep_time} секунд перед следующей попыткой...")
|
||||||
time.sleep(sleep_time)
|
time.sleep(sleep_time)
|
||||||
|
|
@ -352,16 +395,19 @@ def download_youtube_video(url: str, max_retries: int = 3, format_id: str | None
|
||||||
if cookies_valid and attempt == 0:
|
if cookies_valid and attempt == 0:
|
||||||
logger.warning(f"[DOWNLOAD] Попытка {attempt + 1}: обнаружена ошибка связанная с cookies: {error_str[:200]}")
|
logger.warning(f"[DOWNLOAD] Попытка {attempt + 1}: обнаружена ошибка связанная с cookies: {error_str[:200]}")
|
||||||
logger.warning(f"[DOWNLOAD] Попытка {attempt + 1}: на следующей попытке попробуем без cookies")
|
logger.warning(f"[DOWNLOAD] Попытка {attempt + 1}: на следующей попытке попробуем без cookies")
|
||||||
# На следующей попытке попробуем без cookies
|
|
||||||
cookies_valid = False
|
cookies_valid = False
|
||||||
|
|
||||||
if attempt < max_retries - 1:
|
if attempt < max_retries - 1:
|
||||||
import time
|
|
||||||
sleep_time = (attempt + 1) * 2
|
sleep_time = (attempt + 1) * 2
|
||||||
logger.info(f"[DOWNLOAD] Ожидание {sleep_time} секунд перед следующей попыткой...")
|
logger.info(f"[DOWNLOAD] Ожидание {sleep_time} секунд перед следующей попыткой...")
|
||||||
time.sleep(sleep_time)
|
time.sleep(sleep_time)
|
||||||
|
|
||||||
raise last_error or Exception("Неизвестная ошибка при скачивании с YouTube")
|
# Включаем в итоговую ошибку сводку по форматам
|
||||||
|
errors_summary = "; ".join(last_download_errors[-10:]) if last_download_errors else ""
|
||||||
|
error_msg = str(last_error) if last_error else "Неизвестная ошибка при скачивании с YouTube"
|
||||||
|
if errors_summary:
|
||||||
|
error_msg += f" | Ошибки форматов: {errors_summary}"
|
||||||
|
raise Exception(error_msg)
|
||||||
|
|
||||||
|
|
||||||
def get_youtube_formats(url: str) -> list[dict]:
|
def get_youtube_formats(url: str) -> list[dict]:
|
||||||
|
|
@ -376,25 +422,18 @@ def get_youtube_formats(url: str) -> list[dict]:
|
||||||
if not cookies_valid:
|
if not cookies_valid:
|
||||||
logger.warning(f"[FORMATS] Cookies файл не найден или невалиден. Работаем без cookies.")
|
logger.warning(f"[FORMATS] Cookies файл не найден или невалиден. Работаем без cookies.")
|
||||||
|
|
||||||
is_shorts = '/shorts/' in url
|
|
||||||
|
|
||||||
# Пробуем сначала с cookies (если есть), потом без
|
# Пробуем сначала с cookies (если есть), потом без
|
||||||
attempts_configs = []
|
attempts_configs = []
|
||||||
|
|
||||||
if cookies_valid:
|
if cookies_valid:
|
||||||
# С cookies используем только web клиент
|
|
||||||
attempts_configs.append({
|
attempts_configs.append({
|
||||||
'use_cookies': True,
|
'use_cookies': True,
|
||||||
'player_clients': ['web'],
|
'label': 'с cookies'
|
||||||
'label': 'с cookies (web)'
|
|
||||||
})
|
})
|
||||||
|
|
||||||
# Без cookies используем комбинированные клиенты
|
|
||||||
no_cookie_clients = ['android', 'ios', 'web'] if is_shorts else ['android', 'web']
|
|
||||||
attempts_configs.append({
|
attempts_configs.append({
|
||||||
'use_cookies': False,
|
'use_cookies': False,
|
||||||
'player_clients': no_cookie_clients,
|
'label': 'без cookies'
|
||||||
'label': f'без cookies ({", ".join(no_cookie_clients)})'
|
|
||||||
})
|
})
|
||||||
|
|
||||||
last_error = None
|
last_error = None
|
||||||
|
|
@ -404,26 +443,15 @@ def get_youtube_formats(url: str) -> list[dict]:
|
||||||
try:
|
try:
|
||||||
logger.info(f"[FORMATS] Попытка: {config['label']}")
|
logger.info(f"[FORMATS] Попытка: {config['label']}")
|
||||||
|
|
||||||
ydl_opts = {
|
# Для /formats используем те же улучшенные опции (player_client, retries и т.д.),
|
||||||
'quiet': True,
|
# но с quiet=True чтобы не засорять логи
|
||||||
'no_warnings': True,
|
ydl_opts = _make_base_ydl_opts(
|
||||||
'user_agent': user_agent,
|
user_agent,
|
||||||
'socket_timeout': 30,
|
cookies_file_path if config['use_cookies'] else None
|
||||||
'extractor_args': {
|
)
|
||||||
'youtube': {
|
ydl_opts['quiet'] = True
|
||||||
'player_client': config['player_clients'],
|
ydl_opts['no_warnings'] = True
|
||||||
'player_skip': ['webpage'],
|
ydl_opts['socket_timeout'] = 30
|
||||||
},
|
|
||||||
},
|
|
||||||
'http_headers': {
|
|
||||||
'User-Agent': user_agent,
|
|
||||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
||||||
'Accept-Language': 'en-us,en;q=0.5',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
if config['use_cookies']:
|
|
||||||
ydl_opts['cookiefile'] = str(cookies_file_path.absolute())
|
|
||||||
|
|
||||||
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
||||||
info = ydl.extract_info(url, download=False)
|
info = ydl.extract_info(url, download=False)
|
||||||
|
|
@ -438,7 +466,14 @@ def get_youtube_formats(url: str) -> list[dict]:
|
||||||
|
|
||||||
# Если это была попытка с cookies, и ошибка похожа на проблему с cookies -
|
# Если это была попытка с cookies, и ошибка похожа на проблему с cookies -
|
||||||
# продолжаем дальше (следующая попытка будет без cookies)
|
# продолжаем дальше (следующая попытка будет без cookies)
|
||||||
if config['use_cookies'] and ('cookiefile' in error_str.lower() or 'requested format' in error_str.lower() or 'http error' in error_str.lower()):
|
if config['use_cookies'] and (
|
||||||
|
'cookiefile' in error_str.lower()
|
||||||
|
or 'requested format' in error_str.lower()
|
||||||
|
or 'http error' in error_str.lower()
|
||||||
|
or 'only images are available' in error_str.lower()
|
||||||
|
or 'n challenge' in error_str.lower()
|
||||||
|
or 'challenge solving' in error_str.lower()
|
||||||
|
):
|
||||||
logger.info(f"[FORMATS] Ошибка с cookies, пробуем без cookies...")
|
logger.info(f"[FORMATS] Ошибка с cookies, пробуем без cookies...")
|
||||||
continue
|
continue
|
||||||
continue
|
continue
|
||||||
|
|
@ -493,10 +528,10 @@ def get_youtube_formats(url: str) -> list[dict]:
|
||||||
for f in formats:
|
for f in formats:
|
||||||
vcodec = f.get('vcodec', 'none')
|
vcodec = f.get('vcodec', 'none')
|
||||||
acodec = f.get('acodec', 'none')
|
acodec = f.get('acodec', 'none')
|
||||||
height = f.get('height') or 0
|
height = _parse_height(f)
|
||||||
format_id = f.get('format_id', '')
|
format_id = f.get('format_id', '')
|
||||||
|
|
||||||
if vcodec != 'none' and height:
|
if vcodec != 'none' and height > 0:
|
||||||
available_heights.add(height)
|
available_heights.add(height)
|
||||||
|
|
||||||
if vcodec == 'none' and acodec != 'none':
|
if vcodec == 'none' and acodec != 'none':
|
||||||
|
|
@ -508,18 +543,23 @@ def get_youtube_formats(url: str) -> list[dict]:
|
||||||
logger.info(f"[FORMATS] Лучший аудиопоток: {best_audio_info['size']} bytes, {best_audio_info['ext']}, format_id={best_audio_info['format_id']}")
|
logger.info(f"[FORMATS] Лучший аудиопоток: {best_audio_info['size']} bytes, {best_audio_info['ext']}, format_id={best_audio_info['format_id']}")
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
used_heights = set() # чтобы не дублировать форматы
|
used_heights = set()
|
||||||
|
|
||||||
|
# Определяем реальную максимальную высоту видео
|
||||||
|
max_actual_height = max(available_heights) if available_heights else 2160
|
||||||
|
|
||||||
for max_height, label in quality_tiers:
|
for max_height, label in quality_tiers:
|
||||||
# Ищем лучший видеоформат не выше этого разрешения
|
if max_height > max_actual_height:
|
||||||
|
continue # не показываем 4K для видео с макс высотой 1080p
|
||||||
|
|
||||||
best_video = None
|
best_video = None
|
||||||
best_video_height = 0
|
best_video_height = 0
|
||||||
|
|
||||||
for f in formats:
|
for f in formats:
|
||||||
vcodec = f.get('vcodec', 'none')
|
vcodec = f.get('vcodec', 'none')
|
||||||
height = f.get('height') or 0
|
height = _parse_height(f)
|
||||||
|
|
||||||
if vcodec == 'none' or not height:
|
if vcodec == 'none' or height <= 0:
|
||||||
continue
|
continue
|
||||||
if height <= max_height and height > best_video_height:
|
if height <= max_height and height > best_video_height:
|
||||||
best_video = f
|
best_video = f
|
||||||
|
|
@ -528,50 +568,37 @@ def get_youtube_formats(url: str) -> list[dict]:
|
||||||
if not best_video:
|
if not best_video:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Пропускаем, если такой высоты уже добавили (предотвращаем дубли)
|
|
||||||
if best_video_height in used_heights:
|
if best_video_height in used_heights:
|
||||||
continue
|
continue
|
||||||
used_heights.add(best_video_height)
|
used_heights.add(best_video_height)
|
||||||
|
|
||||||
# Считаем примерный размер: видео + аудио
|
|
||||||
video_size = _get_filesize(best_video)
|
video_size = _get_filesize(best_video)
|
||||||
has_audio = best_video.get('acodec', 'none') != 'none'
|
has_audio = best_video.get('acodec', 'none') != 'none'
|
||||||
total_size = video_size + (best_audio_info['size'] if not has_audio else 0)
|
total_size = video_size + (best_audio_info['size'] if not has_audio else 0)
|
||||||
|
|
||||||
# Определяем реальное расширение и кодек
|
|
||||||
video_ext = best_video.get('ext', 'mp4')
|
video_ext = best_video.get('ext', 'mp4')
|
||||||
format_note = best_video.get('format_note', '') or ''
|
|
||||||
video_format_id = best_video.get('format_id', '')
|
video_format_id = best_video.get('format_id', '')
|
||||||
|
|
||||||
# Красивое название: используем format_note от YouTube если есть
|
# Честный лейбл из реальной высоты
|
||||||
display_label = label
|
format_note = best_video.get('format_note', '') or ''
|
||||||
if format_note:
|
if format_note and str(best_video_height) in format_note:
|
||||||
display_label = format_note
|
display_label = format_note
|
||||||
|
else:
|
||||||
|
display_label = f"{best_video_height}p"
|
||||||
|
|
||||||
logger.info(f"[FORMATS] {display_label} (height={best_video_height}): video_size={video_size}, has_audio={has_audio}, total={total_size}, format_id={video_format_id}")
|
logger.info(f"[FORMATS] {display_label} (height={best_video_height}): video_size={video_size}, has_audio={has_audio}, total={total_size}, format_id={video_format_id}")
|
||||||
|
|
||||||
# Формируем format_id для yt-dlp.
|
# format_selector без /best в конце — чтобы yt-dlp не молча скатывался на другой размер
|
||||||
# Используем ДВА подхода в одном format_id через / (fallback):
|
|
||||||
# 1. Сначала пробуем конкретный format code (если есть)
|
|
||||||
# 2. Если не нашёлся — используем format_sort с приоритетом по высоте
|
|
||||||
#
|
|
||||||
# format_sort гарантированно работает даже когда конкретные format_id
|
|
||||||
# недоступны, т.к. yt-dlp сам подберёт подходящий формат.
|
|
||||||
if has_audio:
|
if has_audio:
|
||||||
# Видео уже с аудио — используем его format_id,
|
format_selector = f"{video_format_id}/bestvideo[height<={best_video_height}]+bestaudio/best[height<={best_video_height}]"
|
||||||
# а как fallback — best с ограничением по высоте
|
|
||||||
format_selector = f"{video_format_id}/best[height<={best_video_height}]/best"
|
|
||||||
elif best_audio_info['format_id']:
|
elif best_audio_info['format_id']:
|
||||||
# Видео без аудио + лучший аудио — точное объединение,
|
|
||||||
# fallback — bestvideo+bestaudio с ограничением по высоте
|
|
||||||
format_selector = (
|
format_selector = (
|
||||||
f"{video_format_id}+{best_audio_info['format_id']}/"
|
f"{video_format_id}+{best_audio_info['format_id']}/"
|
||||||
f"bestvideo[height<={best_video_height}]+bestaudio/"
|
f"bestvideo[height<={best_video_height}]+bestaudio/"
|
||||||
f"best[height<={best_video_height}]"
|
f"best[height<={best_video_height}]"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# Видео без аудио, аудио не найден — fallback
|
format_selector = f"{video_format_id}+bestaudio/bestvideo[height<={best_video_height}]+bestaudio/best[height<={best_video_height}]"
|
||||||
format_selector = f"{video_format_id}+bestaudio/best[height<={best_video_height}]/best"
|
|
||||||
|
|
||||||
result.append({
|
result.append({
|
||||||
'format_id': format_selector,
|
'format_id': format_selector,
|
||||||
|
|
@ -592,47 +619,31 @@ def get_youtube_formats(url: str) -> list[dict]:
|
||||||
})
|
})
|
||||||
|
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
# Если получено слишком мало уникальных высот (<= 2) —
|
# Если реальных форматов совсем нет — генерируем оценочные
|
||||||
# значит cookies недействительны и YouTube вернул ограниченные данные.
|
# (бывает при очень плохих cookies, когда даже format_note пустой)
|
||||||
# В этом случае генерируем все стандартные разрешения с оценкой
|
|
||||||
# размера на основе типичных битрейтов YouTube и длительности видео.
|
|
||||||
# Это гарантирует, что пользователь увидит все варианты качества,
|
|
||||||
# а format_selector будет корректно разрешён yt-dlp при скачивании.
|
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
FALLBACK_THRESHOLD = 2 # при таком количестве высот переходим к оценкам
|
if len(result) == 0:
|
||||||
ESTIMATE_REQUIRED = len(used_heights) <= FALLBACK_THRESHOLD
|
logger.info(f"[FORMATS] Реальных форматов не найдено, генерируем оценочные")
|
||||||
|
|
||||||
if ESTIMATE_REQUIRED:
|
max_available_height = max(available_heights) if available_heights else 2160
|
||||||
logger.info(f"[FORMATS] Недостаточно данных от YouTube (найдено {len(used_heights)} высот), генерируем оценочные форматы")
|
available_tiers = [(h, l) for h, l in quality_tiers if h <= max_available_height]
|
||||||
|
|
||||||
# Типичные битрейты для видео (в кбит/с) для разных разрешений YouTube (h264)
|
|
||||||
# Значения консервативные — для реалистичной оценки размера файла
|
|
||||||
TYPICAL_VIDEO_BITRATES: dict[int, int] = {
|
TYPICAL_VIDEO_BITRATES: dict[int, int] = {
|
||||||
2160: 40000, # 4K: ~40 Mbps
|
2160: 40000, 1440: 20000, 1080: 10000, 720: 5000,
|
||||||
1440: 20000, # 1440p: ~20 Mbps
|
480: 2500, 360: 1200, 240: 600, 144: 300,
|
||||||
1080: 10000, # 1080p: ~10 Mbps
|
|
||||||
720: 5000, # 720p: ~5 Mbps
|
|
||||||
480: 2500, # 480p: ~2.5 Mbps
|
|
||||||
360: 1200, # 360p: ~1.2 Mbps
|
|
||||||
240: 600, # 240p: ~600 Kbps
|
|
||||||
144: 300, # 144p: ~300 Kbps
|
|
||||||
}
|
}
|
||||||
AUDIO_BITRATE = 128 # кбит/с — типичный битрейт аудио YouTube
|
AUDIO_BITRATE = 128
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
if duration:
|
if duration:
|
||||||
for max_height, label in quality_tiers:
|
for max_height, label in available_tiers:
|
||||||
video_kbps = TYPICAL_VIDEO_BITRATES.get(max_height, 1000)
|
video_kbps = TYPICAL_VIDEO_BITRATES.get(max_height, 1000)
|
||||||
# Размер = (видеобитрейт + аудиобитрейт) * длительность / 8 / 1024 / 1024
|
|
||||||
total_kbps = video_kbps + AUDIO_BITRATE
|
total_kbps = video_kbps + AUDIO_BITRATE
|
||||||
estimated_bytes = total_kbps * 1000 / 8 * duration # кбит/с * 1000 / 8 = байт/с
|
estimated_bytes = total_kbps * 1000 / 8 * duration
|
||||||
estimated_mb = round(estimated_bytes / 1024 / 1024, 1)
|
estimated_mb = round(estimated_bytes / 1024 / 1024, 1)
|
||||||
|
|
||||||
# Используем best[height<=...] вместо bestvideo[height<=...]+bestaudio
|
format_selector = f"bestvideo[height<={max_height}]+bestaudio/best[height<={max_height}]"
|
||||||
# Это гарантированно работает, т.к. yt-dlp сам подберёт подходящий формат
|
|
||||||
# (с аудио или без) с ограничением по высоте
|
|
||||||
format_selector = f"best[height<={max_height}]/best"
|
|
||||||
|
|
||||||
result.append({
|
result.append({
|
||||||
'format_id': format_selector,
|
'format_id': format_selector,
|
||||||
|
|
@ -643,7 +654,6 @@ def get_youtube_formats(url: str) -> list[dict]:
|
||||||
})
|
})
|
||||||
logger.info(f"[FORMATS] Оценка: {label}: ~{estimated_mb} МБ (битрейт {video_kbps} кбит/с)")
|
logger.info(f"[FORMATS] Оценка: {label}: ~{estimated_mb} МБ (битрейт {video_kbps} кбит/с)")
|
||||||
|
|
||||||
# Аудиодорожка: только аудио, ~128 kbps
|
|
||||||
audio_bytes = AUDIO_BITRATE * 1000 / 8 * duration
|
audio_bytes = AUDIO_BITRATE * 1000 / 8 * duration
|
||||||
audio_mb = round(audio_bytes / 1024 / 1024, 1)
|
audio_mb = round(audio_bytes / 1024 / 1024, 1)
|
||||||
result.append({
|
result.append({
|
||||||
|
|
@ -653,11 +663,9 @@ def get_youtube_formats(url: str) -> list[dict]:
|
||||||
'ext': 'm4a',
|
'ext': 'm4a',
|
||||||
'filesize_mb': audio_mb,
|
'filesize_mb': audio_mb,
|
||||||
})
|
})
|
||||||
logger.info(f"[FORMATS] Оценка: Audio: ~{audio_mb} МБ")
|
|
||||||
else:
|
else:
|
||||||
# Если длительность неизвестна, показываем без размеров
|
for max_height, label in available_tiers:
|
||||||
for max_height, label in quality_tiers:
|
format_selector = f"bestvideo[height<={max_height}]+bestaudio/best[height<={max_height}]"
|
||||||
format_selector = f"best[height<={max_height}]/best"
|
|
||||||
result.append({
|
result.append({
|
||||||
'format_id': format_selector,
|
'format_id': format_selector,
|
||||||
'label': label,
|
'label': label,
|
||||||
|
|
@ -677,6 +685,25 @@ def get_youtube_formats(url: str) -> list[dict]:
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
# Простой кэш форматов: {normalized_url: (timestamp, list_of_formats)}
|
||||||
|
# Форматы YouTube не меняются часто, кэшируем на 30 минут
|
||||||
|
_formats_cache: dict[str, tuple[float, list[dict]]] = {}
|
||||||
|
_FORMATS_CACHE_TTL = 30 * 60 # 30 минут в секундах
|
||||||
|
|
||||||
|
|
||||||
|
def _normalize_youtube_url(url: str) -> str:
|
||||||
|
"""Нормализует YouTube URL: убирает tracking параметры (?si=...),
|
||||||
|
приводит к единому виду для кэширования."""
|
||||||
|
import re
|
||||||
|
# Оставляем только video ID из youtu.be или youtube.com
|
||||||
|
# youtu.be/VIDEO_ID?si=... -> youtu.be/VIDEO_ID
|
||||||
|
m = re.search(r'(youtu\.be/|youtube\.com/watch\?v=)([a-zA-Z0-9_-]{11})', url)
|
||||||
|
if m:
|
||||||
|
prefix, video_id = m.group(1), m.group(2)
|
||||||
|
return f"https://www.youtube.com/watch?v={video_id}"
|
||||||
|
return url # если не распознали, кэшируем как есть
|
||||||
|
|
||||||
|
|
||||||
@app.route('/health', methods=['GET'])
|
@app.route('/health', methods=['GET'])
|
||||||
def health():
|
def health():
|
||||||
"""Health check endpoint"""
|
"""Health check endpoint"""
|
||||||
|
|
@ -699,9 +726,25 @@ def formats():
|
||||||
if 'youtube.com' not in url and 'youtu.be' not in url:
|
if 'youtube.com' not in url and 'youtu.be' not in url:
|
||||||
return jsonify({'error': 'Only YouTube URLs are supported'}), 400
|
return jsonify({'error': 'Only YouTube URLs are supported'}), 400
|
||||||
|
|
||||||
|
# Нормализуем URL и проверяем кэш
|
||||||
|
cache_key = _normalize_youtube_url(url)
|
||||||
|
now = time.time()
|
||||||
|
|
||||||
|
if cache_key in _formats_cache:
|
||||||
|
cached_time, cached_formats = _formats_cache[cache_key]
|
||||||
|
if now - cached_time < _FORMATS_CACHE_TTL:
|
||||||
|
logger.info(f"[FORMATS {request_id}] Возвращаем из кэша ({len(cached_formats)} форматов, возраст {now - cached_time:.0f}с)")
|
||||||
|
return jsonify({'formats': cached_formats}), 200
|
||||||
|
else:
|
||||||
|
logger.info(f"[FORMATS {request_id}] Кэш устарел ({now - cached_time:.0f}с > {_FORMATS_CACHE_TTL}с), обновляем...")
|
||||||
|
del _formats_cache[cache_key]
|
||||||
|
|
||||||
format_list = get_youtube_formats(url)
|
format_list = get_youtube_formats(url)
|
||||||
|
|
||||||
logger.info(f"[FORMATS {request_id}] Найдено {len(format_list)} форматов")
|
# Сохраняем в кэш
|
||||||
|
_formats_cache[cache_key] = (time.time(), format_list)
|
||||||
|
logger.info(f"[FORMATS {request_id}] Сохранено в кэш {len(format_list)} форматов для {cache_key}")
|
||||||
|
|
||||||
return jsonify({'formats': format_list}), 200
|
return jsonify({'formats': format_list}), 200
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Flask==3.0.0
|
Flask==3.0.0
|
||||||
flask-cors==4.0.0
|
flask-cors==4.0.0
|
||||||
yt-dlp>=2024.12.13
|
yt-dlp>=2025.12.01
|
||||||
gunicorn==21.2.0
|
gunicorn==21.2.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,31 +12,31 @@
|
||||||
.youtube.com TRUE / FALSE 1771971074000 ST-1dsf764 session_logininfo=AFmmF2swRQIgZPfEOdmfC8u5sHvE1aOagKEvp5rRUe5hRUeLiYmxLDwCIQDqFIR59yZ_aBb5BLYSpK7LGdJ6YZqnh32USuOyMZTC5g%3AQUQ3MjNmd0ZzX01fTjViQ2kzMDJEWG5Ed09zMGF1TlhJcm81YWt3WWdKS2RCZkY3Z2NmMVhudUF4MFVZdFlHd0YtaEU0R3VHNHQ3VmFSZHdfR1RIcnBJNUtXeWhKWVVScE1ZcXNJdzRfdkFGVi1lZzY2dWxCcVVGZ0FPSjNzVmFjTVg1YTBYS0xBajEzU1REM3dnbUc5U3E3NHVtLVRLLXRn
|
.youtube.com TRUE / FALSE 1771971074000 ST-1dsf764 session_logininfo=AFmmF2swRQIgZPfEOdmfC8u5sHvE1aOagKEvp5rRUe5hRUeLiYmxLDwCIQDqFIR59yZ_aBb5BLYSpK7LGdJ6YZqnh32USuOyMZTC5g%3AQUQ3MjNmd0ZzX01fTjViQ2kzMDJEWG5Ed09zMGF1TlhJcm81YWt3WWdKS2RCZkY3Z2NmMVhudUF4MFVZdFlHd0YtaEU0R3VHNHQ3VmFSZHdfR1RIcnBJNUtXeWhKWVVScE1ZcXNJdzRfdkFGVi1lZzY2dWxCcVVGZ0FPSjNzVmFjTVg1YTBYS0xBajEzU1REM3dnbUc5U3E3NHVtLVRLLXRn
|
||||||
.youtube.com TRUE / FALSE 1772057340000 ST-hcbf8d session_logininfo=AFmmF2swRQIgZPfEOdmfC8u5sHvE1aOagKEvp5rRUe5hRUeLiYmxLDwCIQDqFIR59yZ_aBb5BLYSpK7LGdJ6YZqnh32USuOyMZTC5g%3AQUQ3MjNmd0ZzX01fTjViQ2kzMDJEWG5Ed09zMGF1TlhJcm81YWt3WWdKS2RCZkY3Z2NmMVhudUF4MFVZdFlHd0YtaEU0R3VHNHQ3VmFSZHdfR1RIcnBJNUtXeWhKWVVScE1ZcXNJdzRfdkFGVi1lZzY2dWxCcVVGZ0FPSjNzVmFjTVg1YTBYS0xBajEzU1REM3dnbUc5U3E3NHVtLVRLLXRn
|
.youtube.com TRUE / FALSE 1772057340000 ST-hcbf8d session_logininfo=AFmmF2swRQIgZPfEOdmfC8u5sHvE1aOagKEvp5rRUe5hRUeLiYmxLDwCIQDqFIR59yZ_aBb5BLYSpK7LGdJ6YZqnh32USuOyMZTC5g%3AQUQ3MjNmd0ZzX01fTjViQ2kzMDJEWG5Ed09zMGF1TlhJcm81YWt3WWdKS2RCZkY3Z2NmMVhudUF4MFVZdFlHd0YtaEU0R3VHNHQ3VmFSZHdfR1RIcnBJNUtXeWhKWVVScE1ZcXNJdzRfdkFGVi1lZzY2dWxCcVVGZ0FPSjNzVmFjTVg1YTBYS0xBajEzU1REM3dnbUc5U3E3NHVtLVRLLXRn
|
||||||
.youtube.com TRUE / FALSE 1772093274000 ST-1b disableCache=true&session_logininfo=AFmmF2swRQIgZPfEOdmfC8u5sHvE1aOagKEvp5rRUe5hRUeLiYmxLDwCIQDqFIR59yZ_aBb5BLYSpK7LGdJ6YZqnh32USuOyMZTC5g%3AQUQ3MjNmd0ZzX01fTjViQ2kzMDJEWG5Ed09zMGF1TlhJcm81YWt3WWdKS2RCZkY3Z2NmMVhudUF4MFVZdFlHd0YtaEU0R3VHNHQ3VmFSZHdfR1RIcnBJNUtXeWhKWVVScE1ZcXNJdzRfdkFGVi1lZzY2dWxCcVVGZ0FPSjNzVmFjTVg1YTBYS0xBajEzU1REM3dnbUc5U3E3NHVtLVRLLXRn&endpoint=%7B%22browseEndpoint%22%3A%7B%22browseId%22%3A%22FEwhat_to_watch%22%7D%2C%22commandMetadata%22%3A%7B%22webCommandMetadata%22%3A%7B%22url%22%3A%22%2F%22%2C%22rootVe%22%3A3854%2C%22webPageType%22%3A%22WEB_PAGE_TYPE_BROWSE%22%7D%7D%7D
|
.youtube.com TRUE / FALSE 1772093274000 ST-1b disableCache=true&session_logininfo=AFmmF2swRQIgZPfEOdmfC8u5sHvE1aOagKEvp5rRUe5hRUeLiYmxLDwCIQDqFIR59yZ_aBb5BLYSpK7LGdJ6YZqnh32USuOyMZTC5g%3AQUQ3MjNmd0ZzX01fTjViQ2kzMDJEWG5Ed09zMGF1TlhJcm81YWt3WWdKS2RCZkY3Z2NmMVhudUF4MFVZdFlHd0YtaEU0R3VHNHQ3VmFSZHdfR1RIcnBJNUtXeWhKWVVScE1ZcXNJdzRfdkFGVi1lZzY2dWxCcVVGZ0FPSjNzVmFjTVg1YTBYS0xBajEzU1REM3dnbUc5U3E3NHVtLVRLLXRn&endpoint=%7B%22browseEndpoint%22%3A%7B%22browseId%22%3A%22FEwhat_to_watch%22%7D%2C%22commandMetadata%22%3A%7B%22webCommandMetadata%22%3A%7B%22url%22%3A%22%2F%22%2C%22rootVe%22%3A3854%2C%22webPageType%22%3A%22WEB_PAGE_TYPE_BROWSE%22%7D%7D%7D
|
||||||
.youtube.com TRUE / FALSE 1840568188 HSID AyQ5v_SYe7XVSwk4B
|
.youtube.com TRUE / FALSE 1840620810 HSID AyQ5v_SYe7XVSwk4B
|
||||||
.youtube.com TRUE / TRUE 1840568188 SSID A6URSCEMDAehLdZmX
|
.youtube.com TRUE / TRUE 1840620810 SSID A6URSCEMDAehLdZmX
|
||||||
.youtube.com TRUE / FALSE 1840568188 APISID 8dbTFmLBSXBgxwR5/Aqxn9OCBXLwhMCr-P
|
.youtube.com TRUE / FALSE 1840620810 APISID 8dbTFmLBSXBgxwR5/Aqxn9OCBXLwhMCr-P
|
||||||
.youtube.com TRUE / TRUE 1840568188 SAPISID T-VywQwW6YYwPZ05/AVcBJlwHBEyhqZuI6
|
.youtube.com TRUE / TRUE 1840620810 SAPISID T-VywQwW6YYwPZ05/AVcBJlwHBEyhqZuI6
|
||||||
.youtube.com TRUE / TRUE 1840568188 __Secure-1PAPISID T-VywQwW6YYwPZ05/AVcBJlwHBEyhqZuI6
|
.youtube.com TRUE / TRUE 1840620810 __Secure-1PAPISID T-VywQwW6YYwPZ05/AVcBJlwHBEyhqZuI6
|
||||||
.youtube.com TRUE / TRUE 1840568188 __Secure-3PAPISID T-VywQwW6YYwPZ05/AVcBJlwHBEyhqZuI6
|
.youtube.com TRUE / TRUE 1840620810 __Secure-3PAPISID T-VywQwW6YYwPZ05/AVcBJlwHBEyhqZuI6
|
||||||
.youtube.com TRUE / FALSE 1840568188 SID g.a0009QhwIAjsJeEH4Uk3fS-2YhTESYDuXNp-hbD_qK82-c1DCe9UFglG42pGDAV3fH8v_IdUbQACgYKAb4SARISFQHGX2Mi2MRVdnnHtievElr-sawatxoVAUF8yKqJbjGJNuJJc9f0zJ6nQODx0076
|
.youtube.com TRUE / FALSE 1840620810 SID g.a0009QhwIHIkg4t_oMWmKHHoJyYI4VKCwXZzgObCsdqkdliI_o1E-iILBJwqGZqsMai74aasEQACgYKAUMSARISFQHGX2Mi8v7RPSIIRSpCy6cyYpF6OBoVAUF8yKpoHCEtgIdkpfFVsSxnHcMb0076
|
||||||
.youtube.com TRUE / TRUE 1840568188 __Secure-1PSID g.a0009QhwIAjsJeEH4Uk3fS-2YhTESYDuXNp-hbD_qK82-c1DCe9UV77l4zyNM4M7L6cxMSikLwACgYKASsSARISFQHGX2MizVX644sLyMaifiVJhHUFQRoVAUF8yKqbGkTKiR4USA4ymE8IjsRi0076
|
.youtube.com TRUE / TRUE 1840620810 __Secure-1PSID g.a0009QhwIHIkg4t_oMWmKHHoJyYI4VKCwXZzgObCsdqkdliI_o1EPUsVlK9u7TV_DmO1S_HjsAACgYKAcUSARISFQHGX2MieEAf3c2YDM23ElqwWQedxxoVAUF8yKr3lCeiD3YRIEUhEGm-xT2E0076
|
||||||
.youtube.com TRUE / TRUE 1840568188 __Secure-3PSID g.a0009QhwIAjsJeEH4Uk3fS-2YhTESYDuXNp-hbD_qK82-c1DCe9U3seg5Og5yCL2bD4ELOg8EgACgYKARgSARISFQHGX2MiYIK5CaWgiCwM7iYdtpcnNhoVAUF8yKoSn5HQ-rCCYvS-s5HwD8qV0076
|
.youtube.com TRUE / TRUE 1840620810 __Secure-3PSID g.a0009QhwIHIkg4t_oMWmKHHoJyYI4VKCwXZzgObCsdqkdliI_o1E5UX-Uejh1R-eG6Kej6fVxQACgYKARcSARISFQHGX2MiKiX8dJY-eTnU5GRrj77ExRoVAUF8yKpJxnl1sW6_ZLm33PtAOTLY0076
|
||||||
.youtube.com TRUE / TRUE 1791136352432 __Secure-BUCKET CMoC
|
.youtube.com TRUE / TRUE 1791136352432 __Secure-BUCKET CMoC
|
||||||
.youtube.com TRUE / TRUE 1793047950 __Secure-YNID 18.YT=mbJjtAOEjwsnG_Ken5S2j7VUoI66lBOzExTymg3unWj9WqdhDb65sn6-JcoIjVjBa4vmyfPlLCSVOaxZROVyIPFSJ99oIFttUq3h-Cdd-00k5TxIytOfKrzMVzwTbZUizv_BR-GaIf8PhMQwli439-PIMy9ezB42Vb1jfdPYCRNAdATxCmcM5ac40opEZLDnCbqjsll0DSQx_Fg2R5bG1X3mMv8-ZiZTs8Mn7k7UoIu7yPMWWaU2nPvdhMKWBRyLkGh3gXIqtfnzR79_A4U2ihafFTO9UYT_HdvgwdOb44t52sDKUG-tFNaVaKySk37-14WEjEMTxikH8w_dWh_0MA
|
.youtube.com TRUE / TRUE 1793100810 __Secure-YNID 18.YT=xHpVaJh_WysK3C312T879F3rw8GoX1zMaW4NSER6VNGzGdn03Fq3GgfAwDfRLFmTUzZL1KuA4i3Xzl6xseIv84nIRZN7eKqGx_uV903913AsRH6iS6KXklN0GQBJBGys48rdXAaC1mu_gYxqBx4x-2yrBuQWNzhK_rHjgqWH5tND2NT5vPk1o0TDNAdfnrc-kNGeINuM8L37VfNPOgRLKmxi5ifGNhMIIaZe9hUuAzcmD8zhf5bWpjOfTSwinw3aMR7Vv7bpE_qTUv3schu56JjgC5wc4SnBWZFbp3E_9NZKw0UGbYAy-nin_OmO9Ep-o69rFo_Ph2SA3zM07viMdw
|
||||||
.youtube.com TRUE / TRUE 1793047950 __Secure-ROLLOUT_TOKEN CKPS2eDK6Lu50QEQwdv1spXZkQMY5ObYtfiTlAM%3D
|
.youtube.com TRUE / TRUE 1793100810 __Secure-ROLLOUT_TOKEN CKPS2eDK6Lu50QEQwdv1spXZkQMYz_CUq72VlAM%3D
|
||||||
.youtube.com TRUE / FALSE 1776287761000 ST-yve142 session_logininfo=AFmmF2swRQIgZPfEOdmfC8u5sHvE1aOagKEvp5rRUe5hRUeLiYmxLDwCIQDqFIR59yZ_aBb5BLYSpK7LGdJ6YZqnh32USuOyMZTC5g%3AQUQ3MjNmd0ZzX01fTjViQ2kzMDJEWG5Ed09zMGF1TlhJcm81YWt3WWdKS2RCZkY3Z2NmMVhudUF4MFVZdFlHd0YtaEU0R3VHNHQ3VmFSZHdfR1RIcnBJNUtXeWhKWVVScE1ZcXNJdzRfdkFGVi1lZzY2dWxCcVVGZ0FPSjNzVmFjTVg1YTBYS0xBajEzU1REM3dnbUc5U3E3NHVtLVRLLXRn
|
.youtube.com TRUE / FALSE 1776287761000 ST-yve142 session_logininfo=AFmmF2swRQIgZPfEOdmfC8u5sHvE1aOagKEvp5rRUe5hRUeLiYmxLDwCIQDqFIR59yZ_aBb5BLYSpK7LGdJ6YZqnh32USuOyMZTC5g%3AQUQ3MjNmd0ZzX01fTjViQ2kzMDJEWG5Ed09zMGF1TlhJcm81YWt3WWdKS2RCZkY3Z2NmMVhudUF4MFVZdFlHd0YtaEU0R3VHNHQ3VmFSZHdfR1RIcnBJNUtXeWhKWVVScE1ZcXNJdzRfdkFGVi1lZzY2dWxCcVVGZ0FPSjNzVmFjTVg1YTBYS0xBajEzU1REM3dnbUc5U3E3NHVtLVRLLXRn
|
||||||
.youtube.com TRUE / TRUE 1807824503515 __Secure-1PSIDTS sidts-CjUBWhotCSAL5EMsgNfc0JD8UVvU5vyCYbx9ZFc0Nnry9Qc7YHRzl6a7o8Zm6bPYHoFyKALKlBAA
|
.youtube.com TRUE / TRUE 1807824503515 __Secure-1PSIDTS sidts-CjUBWhotCSAL5EMsgNfc0JD8UVvU5vyCYbx9ZFc0Nnry9Qc7YHRzl6a7o8Zm6bPYHoFyKALKlBAA
|
||||||
.youtube.com TRUE / TRUE 1807824503517 __Secure-3PSIDTS sidts-CjUBWhotCSAL5EMsgNfc0JD8UVvU5vyCYbx9ZFc0Nnry9Qc7YHRzl6a7o8Zm6bPYHoFyKALKlBAA
|
.youtube.com TRUE / TRUE 1807824503517 __Secure-3PSIDTS sidts-CjUBWhotCSAL5EMsgNfc0JD8UVvU5vyCYbx9ZFc0Nnry9Qc7YHRzl6a7o8Zm6bPYHoFyKALKlBAA
|
||||||
.youtube.com TRUE / TRUE 1793054181 VISITOR_INFO1_LIVE vFr43YvHJaE
|
.youtube.com TRUE / TRUE 1793109764 VISITOR_INFO1_LIVE vFr43YvHJaE
|
||||||
.youtube.com TRUE / TRUE 1793054181 VISITOR_PRIVACY_METADATA CgJSVRIEGgAgMg%3D%3D
|
.youtube.com TRUE / TRUE 1793109764 VISITOR_PRIVACY_METADATA CgJSVRIEGgAgMg%3D%3D
|
||||||
.youtube.com TRUE / FALSE 1776288519000 ST-tladcw session_logininfo=AFmmF2swRQIgZPfEOdmfC8u5sHvE1aOagKEvp5rRUe5hRUeLiYmxLDwCIQDqFIR59yZ_aBb5BLYSpK7LGdJ6YZqnh32USuOyMZTC5g%3AQUQ3MjNmd0ZzX01fTjViQ2kzMDJEWG5Ed09zMGF1TlhJcm81YWt3WWdKS2RCZkY3Z2NmMVhudUF4MFVZdFlHd0YtaEU0R3VHNHQ3VmFSZHdfR1RIcnBJNUtXeWhKWVVScE1ZcXNJdzRfdkFGVi1lZzY2dWxCcVVGZ0FPSjNzVmFjTVg1YTBYS0xBajEzU1REM3dnbUc5U3E3NHVtLVRLLXRn
|
.youtube.com TRUE / FALSE 1776288519000 ST-tladcw session_logininfo=AFmmF2swRQIgZPfEOdmfC8u5sHvE1aOagKEvp5rRUe5hRUeLiYmxLDwCIQDqFIR59yZ_aBb5BLYSpK7LGdJ6YZqnh32USuOyMZTC5g%3AQUQ3MjNmd0ZzX01fTjViQ2kzMDJEWG5Ed09zMGF1TlhJcm81YWt3WWdKS2RCZkY3Z2NmMVhudUF4MFVZdFlHd0YtaEU0R3VHNHQ3VmFSZHdfR1RIcnBJNUtXeWhKWVVScE1ZcXNJdzRfdkFGVi1lZzY2dWxCcVVGZ0FPSjNzVmFjTVg1YTBYS0xBajEzU1REM3dnbUc5U3E3NHVtLVRLLXRn
|
||||||
.youtube.com TRUE / FALSE 0 PREF tz=UTC&f7=100&f6=40000000&hl=en
|
.youtube.com TRUE / FALSE 0 PREF tz=UTC&f7=100&f6=40000000&hl=en
|
||||||
.youtube.com TRUE / FALSE 1776288527000 ST-xuwub9 session_logininfo=AFmmF2swRQIgZPfEOdmfC8u5sHvE1aOagKEvp5rRUe5hRUeLiYmxLDwCIQDqFIR59yZ_aBb5BLYSpK7LGdJ6YZqnh32USuOyMZTC5g%3AQUQ3MjNmd0ZzX01fTjViQ2kzMDJEWG5Ed09zMGF1TlhJcm81YWt3WWdKS2RCZkY3Z2NmMVhudUF4MFVZdFlHd0YtaEU0R3VHNHQ3VmFSZHdfR1RIcnBJNUtXeWhKWVVScE1ZcXNJdzRfdkFGVi1lZzY2dWxCcVVGZ0FPSjNzVmFjTVg1YTBYS0xBajEzU1REM3dnbUc5U3E3NHVtLVRLLXRn
|
.youtube.com TRUE / FALSE 1776288527000 ST-xuwub9 session_logininfo=AFmmF2swRQIgZPfEOdmfC8u5sHvE1aOagKEvp5rRUe5hRUeLiYmxLDwCIQDqFIR59yZ_aBb5BLYSpK7LGdJ6YZqnh32USuOyMZTC5g%3AQUQ3MjNmd0ZzX01fTjViQ2kzMDJEWG5Ed09zMGF1TlhJcm81YWt3WWdKS2RCZkY3Z2NmMVhudUF4MFVZdFlHd0YtaEU0R3VHNHQ3VmFSZHdfR1RIcnBJNUtXeWhKWVVScE1ZcXNJdzRfdkFGVi1lZzY2dWxCcVVGZ0FPSjNzVmFjTVg1YTBYS0xBajEzU1REM3dnbUc5U3E3NHVtLVRLLXRn
|
||||||
.youtube.com TRUE / FALSE 1809038181 SIDCC AKEyXzWb8W4-fWxJRVKwdo9xRM8jFdE2-hQPSLdAVjkB-PRdkN7C58VuGVd_Ct3clpvdwFxFQpcp
|
.youtube.com TRUE / FALSE 1809093764 SIDCC AKEyXzVuQ1CJQldvhHlCwcxliD-5HoCB4nz-1_bWYcCGuntiTxyQ3zu2dKQ4e3cRVw0qxx_E4oVX
|
||||||
.youtube.com TRUE / TRUE 1809038181 __Secure-1PSIDCC AKEyXzVdiXk_GObRZmRJB8eItLemo7AzA2RrXhpfRpcJENGXerqtoydek6U7k_FB5Ha0cfmsrShe
|
.youtube.com TRUE / TRUE 1809093764 __Secure-1PSIDCC AKEyXzW5L7zbNTopC4iWw_0rNkDB3asr9lB-mwtstrlNvT9qZ0YJq7QKK7wBm33Bi-e6H-vQiJOr
|
||||||
.youtube.com TRUE / TRUE 1809038181 __Secure-3PSIDCC AKEyXzWI_z6Gy5kuoLVXPZwTKHhY_bMcflpI4LQS-Rx5Sk9-gQktqVjeT6d1CtdCxlTu50rY56xJ
|
.youtube.com TRUE / TRUE 1809093764 __Secure-3PSIDCC AKEyXzXALMvWYXgR6z2KCVBMX-wN_wvpUOdOQ9GZ_J3fhKVMgy8QhkwKXCr4zzQKqo9vgZAxEDuq
|
||||||
.youtube.com TRUE / FALSE 1776288585000 ST-3opvp5 session_logininfo=AFmmF2swRQIgZPfEOdmfC8u5sHvE1aOagKEvp5rRUe5hRUeLiYmxLDwCIQDqFIR59yZ_aBb5BLYSpK7LGdJ6YZqnh32USuOyMZTC5g%3AQUQ3MjNmd0ZzX01fTjViQ2kzMDJEWG5Ed09zMGF1TlhJcm81YWt3WWdKS2RCZkY3Z2NmMVhudUF4MFVZdFlHd0YtaEU0R3VHNHQ3VmFSZHdfR1RIcnBJNUtXeWhKWVVScE1ZcXNJdzRfdkFGVi1lZzY2dWxCcVVGZ0FPSjNzVmFjTVg1YTBYS0xBajEzU1REM3dnbUc5U3E3NHVtLVRLLXRn
|
.youtube.com TRUE / FALSE 1776288585000 ST-3opvp5 session_logininfo=AFmmF2swRQIgZPfEOdmfC8u5sHvE1aOagKEvp5rRUe5hRUeLiYmxLDwCIQDqFIR59yZ_aBb5BLYSpK7LGdJ6YZqnh32USuOyMZTC5g%3AQUQ3MjNmd0ZzX01fTjViQ2kzMDJEWG5Ed09zMGF1TlhJcm81YWt3WWdKS2RCZkY3Z2NmMVhudUF4MFVZdFlHd0YtaEU0R3VHNHQ3VmFSZHdfR1RIcnBJNUtXeWhKWVVScE1ZcXNJdzRfdkFGVi1lZzY2dWxCcVVGZ0FPSjNzVmFjTVg1YTBYS0xBajEzU1REM3dnbUc5U3E3NHVtLVRLLXRn
|
||||||
.youtube.com TRUE / TRUE 0 YSC n30rSbsEVHk
|
.youtube.com TRUE / TRUE 0 YSC IewJyGJN7Aw
|
||||||
.instagram.com TRUE / TRUE 1801240452128 datr hGdNaS-QqakSYV8X2eqVTIyA
|
.instagram.com TRUE / TRUE 1801240452128 datr hGdNaS-QqakSYV8X2eqVTIyA
|
||||||
.instagram.com TRUE / TRUE 1798216452128 ig_did 2C886E85-30B9-4495-B882-D9F545DF28E4
|
.instagram.com TRUE / TRUE 1798216452128 ig_did 2C886E85-30B9-4495-B882-D9F545DF28E4
|
||||||
.instagram.com TRUE / TRUE 1801240453000 mid aU1nhAAEAAGuKRzTGE9SdmhLzZ5Z
|
.instagram.com TRUE / TRUE 1801240453000 mid aU1nhAAEAAGuKRzTGE9SdmhLzZ5Z
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue