xenova / chat-downloader

A simple tool used to retrieve chat messages from livestreams, videos, clips and past broadcasts. No authentication needed!
https://chat-downloader.readthedocs.io/
MIT License
902 stars 127 forks source link

[BUG] "Unable to find initial video contents" when trying to get chat on Youtube with cookies. #218

Open hiro-091 opened 1 year ago

hiro-091 commented 1 year ago

Basic information

Describe the bug

"[ERROR] Unable to find initial video contents" when trying to get chat on Youtube with cookies. This error occurs on all channels contents and archive, on live, upcoming. Especially a big problem when getting member-only content. The cookies used are in the Netscape format that can be load by http.cookiejar.MozillaCookieJar and were extracted from Mozilla, chrome, opera on Mac and Windows.

Command/Code used

If running from the command line, provide the following:

  1. The command used (including the verbose tag, -v):
    python3 -m chat_downloader -v --cookies ./cookies.txt "https://www.youtube.com/watch?v=zX7F6IyxTiw"
  2. Stderr output from the above command:
    [DEBUG] Python version: 3.11.4 (main, Jun 20 2023, 16:59:59) [Clang 14.0.3 (clang-1403.0.22.14.1)]
    [DEBUG] Program version: 0.2.7
    [DEBUG] Initialisation parameters: {'headers': None, 'cookies': './cookies.txt', 'proxy': None}
    [DEBUG] Created YouTubeChatDownloader session.
    [INFO] Site: youtube.com
    [DEBUG] Program parameters: {'url': 'https://www.youtube.com/watch?v=zX7F6IyxTiw', 'start_time': None, 'end_time': None, 'max_attempts': 15, 'retry_timeout': None, 'interruptible_retry': True, 'timeout': None, 'inactivity_timeout': None, 'max_messages': None, 'message_groups': ['messages'], 'message_types': None, 'output': None, 'overwrite': True, 'sort_keys': True, 'indent': 4, 'format': 'youtube', 'format_file': None, 'chat_type': 'live', 'ignore': None, 'message_receive_timeout': 0.1, 'buffer_size': 4096}
    [DEBUG] Starting new HTTPS connection (1): www.youtube.com:443
    [DEBUG] https://www.youtube.com:443 "GET /watch?v=zX7F6IyxTiw HTTP/1.1" 200 None
    [DEBUG] Initial YouTube data: {'responseContext': {'webResponseContextExtensionData': {'ytConfigData': {'visitorData': 'CgtpRGJwaHY1dU9vQSjzosKlBg%3D%3D', 'sessionIndex': 0, 'rootVisualElementType': 3832}}}}
    [ERROR] Unable to find initial video contents.
    [DEBUG] Session closed.

    If the output is too long, you can attach a text file or remove output which does not constitute to the problem.

TheTechRobo commented 1 year ago

Check your cookies.txt file. Does it have lines that start with #HttpOnly ? If so, remove the #HttpOnly from the line.

hiro-091 commented 1 year ago

Tanks for your reply. There is no line stating #HttpOnly. I can do request.get() with this cookies to web pages.