import time
import yt_dlp
opts = {
    'quiet': True, 'no_warnings': True, 'skip_download': True,
    'noplaylist': True, 'cookiefile': 'cookies.txt',
    'socket_timeout': 30, 'retries': 3,
    'extractor_args': {'youtube': {'player_client':
        ['default', '-android_sdkless', '-android', '-ios']}},
}
print("START", time.strftime("%H:%M:%S"))
try:
    with yt_dlp.YoutubeDL(opts) as ydl:
        info = ydl.extract_info("https://youtu.be/jNQXAC9IVRw", download=False)
    print("RESULT: OK ✅")
    print("TITLE:", info.get("title"))
    print("FORMATS:", len(info.get("formats") or []))
except Exception as e:
    print("RESULT: FAILED ❌")
    print("ERROR:", str(e)[:500])
print("END", time.strftime("%H:%M:%S"))
