Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] socs.value missing from cookies #238

Open
CanOfSocks opened this issue Feb 7, 2024 · 0 comments · May be fixed by #239
Open

[BUG] socs.value missing from cookies #238

CanOfSocks opened this issue Feb 7, 2024 · 0 comments · May be fixed by #239
Labels
bug Something isn't working

Comments

@CanOfSocks
Copy link

Basic information

  • Program version: 3.12.0
  • Python version: 0.2.8
  • Operating system: Debian (docker)

Describe the bug

A clear and concise description of what the bug is.

Command/Code used

If running from the command line, provide the following:

  1. The command used (including the verbose tag, -v):
chat_downloader -v -o /app/temp/temp.json --cookies "/app/cookies.txt" https://youtu.be/m78eqo-ApIk
  1. Output from the above command:
[DEBUG] Python version: 3.12.0 (main, Nov 21 2023, 17:49:02) [GCC 12.2.0]
[DEBUG] Program version: 0.2.8
[DEBUG] Initialisation parameters: {'headers': None, 'cookies': '/app/cookies.txt', 'proxy': None}
[DEBUG] Created YouTubeChatDownloader session.
Traceback (most recent call last):
  File "/usr/local/bin/chat_downloader", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.12/site-packages/chat_downloader/cli.py", line 194, in main
    run(**args.__dict__)
  File "/usr/local/lib/python3.12/site-packages/chat_downloader/chat_downloader.py", line 351, in run
    chat = downloader.get_chat(**chat_params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/chat_downloader/chat_downloader.py", line 208, in get_chat
    self.create_session(site)
  File "/usr/local/lib/python3.12/site-packages/chat_downloader/chat_downloader.py", line 304, in create_session
    self.sessions[session_name] = chat_downloader_class(
                                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/chat_downloader/sites/youtube.py", line 62, in __init__
    self._initialize_consent()
  File "/usr/local/lib/python3.12/site-packages/chat_downloader/sites/youtube.py", line 1369, in _initialize_consent
    if socs and not socs.value.startswith('CAA'):  # not consented
                    ^^^^^^^^^^
AttributeError: 'str' object has no attribute 'value'

Expected behavior

Adding cookies file does not seem to work with consent, with the string not seemingly working at all. SOCS cookies does appear to be within the cookies file being accessed.

Additional context/information

Cookies file (values replaces with random, but SOCS is there in the cookies). The export from the cookies.txt extension was edited by yt-dlp to produce the file below.

# Netscape HTTP Cookie File
# This file is generated by yt-dlp.  Do not edit.

.youtube.com    TRUE    /       FALSE   0       PREF    hl=en&tz=UTC
.youtube.com    TRUE    /       TRUE    0       SOCS    CAI
.youtube.com    TRUE    /       TRUE    0       YSC     ft54gh6ry7
.youtube.com    TRUE    /       TRUE    34578534645      VISITOR_INFO1_LIVE      dhgjhgjghjdgj
.youtube.com    TRUE    /       TRUE    654645654546      VISITOR_PRIVACY_METADATA        fgjhgfhjdgfhjdfg
.youtube.com    TRUE    /       TRUE    546546456      CONSENT PENDING+011
.youtube.com    TRUE    /       TRUE    546456456456      GPS     1
@CanOfSocks CanOfSocks added the bug Something isn't working label Feb 7, 2024
9001 added a commit to 9001/chat-downloader that referenced this issue Feb 7, 2024
before this fix, python 3.11 would fail like this:
AttributeError: 'str' object has no attribute 'value'

assuming that socs.value is the correct way to retrieve the value in
some versions of python, avoid the issue by casting to string
@9001 9001 linked a pull request Feb 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant