mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-18 10:45:31 -04:00
4c41834dc7
Make src.youtube_handler a compatibility wrapper around services.youtube.youtube_handler so transcript state, URL parsing, and timeout behavior no longer diverge.
24 lines
1.1 KiB
Python
24 lines
1.1 KiB
Python
"""Compatibility wrapper for the canonical services.youtube.youtube_handler module.
|
|
|
|
Odysseus historically carried two independent copies of the YouTube handler —
|
|
one here under ``src`` and one under ``services.youtube``. They drifted: the
|
|
comment-fetch timeout fix landed only in the ``src`` copy, while ``app.py``
|
|
calls ``services.youtube.init_youtube()`` at startup. Because the chat flow
|
|
imported ``extract_transcript_async`` from ``src.youtube_handler`` (a different
|
|
module object), the ``YOUTUBE_AVAILABLE`` / ``YouTubeTranscriptApi`` globals set
|
|
by ``init_youtube`` never reached it and transcript extraction always reported
|
|
"YouTube transcript API not available".
|
|
|
|
Keep the old ``src.youtube_handler`` import path working, but make it resolve to
|
|
the single source of truth so module state and behavior can't diverge again.
|
|
"""
|
|
|
|
import importlib
|
|
import sys
|
|
|
|
# Import the canonical module directly (services.youtube.youtube_handler)
|
|
# without triggering the heavy services/__init__.py top-level imports.
|
|
_youtube_handler = importlib.import_module("services.youtube.youtube_handler")
|
|
|
|
sys.modules[__name__] = _youtube_handler
|