2.9 KiB
2.9 KiB
YouTube Chat Listener (Version 2) - Project Progress Log
This document chronicles the key steps, findings, and decisions made during the development and research phases of the YouTube Chat Listener (Version 2) project.
Initial State
- Existing
youtube_chat_terminalproject used YouTube Data API v3 polling. - Concerns about API quota exhaustion led to the conception of
youtube-chat-webhook-v2.
Research Phase - Initial Plan (gRPC Misconception)
- Goal: Find a quota-friendly, compliant solution.
- Initial Hypothesis:
liveChatMessages.streamList(gRPC) was believed to be the ideal solution. - Action: A detailed "Deep Research Plan" was outlined in
README.mdandDEVELOPMENT_PLAN.md. - Finding: Subsequent research (via
google_web_search) revealed thatliveChatMessages.streamList(gRPC) is not publicly available for the YouTube Data API v3. This was a critical correction to the initial understanding.
Research Phase - Revised Plan (Focus on Sustainability & pytchat)
- Goal: Identify a sustainable, quota-friendly, compliant, open-source, Linux-compatible method for real-time YouTube Live Chat, explicitly ruling out API quota increases.
- Revised Strategy: Shifted focus to:
- Deep dive into YouTube's web client communication.
- Re-exploration of YouTube Data API v3 (creative use).
- Community solutions and open-source projects.
- Re-evaluation of third-party services.
- Action:
README.mdandDEVELOPMENT_PLAN.mdwere updated to reflect this revised plan.
Experimental Implementation - pytchat Exploration
- Objective: Experiment with
pytchatas a direct (but risky) solution for zero-quota live chat fetching. - Action: Installed
pytchatand createdpytchat_listener.pyfor basic chat fetching and display. - Status:
pytchat_listener.pyis working as expected. - Internal Mechanism Analysis of
pytchat:- Endpoint:
POST https://www.youtube.com/youtubei/v1/live_chat/get_live_chat(internal, undocumented API). - Authentication/Session: Relies on mimicking browser headers (
User-Agent),visitorData(extracted from previous responses), dynamically generatedclientVersion, andhttpx.Client's automatic cookie handling. - Continuation Token: Complex, encoded parameter generated using custom Protocol Buffers-like encoding and timestamps.
- Channel ID Discovery: Performs lightweight scraping of YouTube's
embedorm.youtube.compages using regex. - Implications: Highly fragile (subject to breaking), critical compliance risk (violates YouTube's Terms of Service).
- Endpoint:
- Action:
DEVELOPMENT_PLAN.mdwas updated with these findings.
Next Steps
- Proceed with "Integration with
richDisplay" as outlined inDEVELOPMENT_PLAN.md. - Continue with other phases of the revised research plan, keeping the compliance and fragility risks of
pytchatin mind.