From 433695f7496862e5c034ae677df77bbfa966a151 Mon Sep 17 00:00:00 2001 From: Shivanker Goel Date: Mon, 3 Feb 2025 14:04:04 +0000 Subject: [PATCH] remove debug logging for ytsubs --- session.py | 4 +--- ytsubs.py | 14 +------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/session.py b/session.py index 45e5e09..2757cc3 100644 --- a/session.py +++ b/session.py @@ -60,9 +60,7 @@ def extract(text): if match: url = match.group(1) if is_youtube_video(url): - logger.warning( - f"SHIV1 Fetching youtube transcript for {url}. Original text {text}" - ) + logger.warning(f"Fetching youtube transcript for {url}. Original text {text}") return yt_transcript(url) or f"Failed to extract transcript for {url}." logger.info(f"Reading text from [{url}]. Original text {text}") return scrape_text(url) or f"Failed to scrape text from {url}." diff --git a/ytsubs.py b/ytsubs.py index 7ed6123..8f3374c 100644 --- a/ytsubs.py +++ b/ytsubs.py @@ -45,36 +45,24 @@ def extract_video_id(url): def yt_transcript(url: str) -> Union[str, None]: """Function to fetch the transcript of a YouTube video, given the URL.""" - logger.warning(f"SHIV1 Fetching youtube transcript for {url}") cached_transcript = s3_cache.get_cache(CACHE_NAMESPACE, url) if cached_transcript: - logger.warning(f"SHIV1 Found cached transcript for {url}") return cached_transcript try: - logger.warning(f"SHIV1 Extracting video id for {url}") video_id = extract_video_id(url) if video_id: - logger.warning(f"SHIV1 Found video id {video_id} for {url}") transcript = YouTubeTranscriptApi.get_transcript(video_id) if transcript: - logger.warning( - f"SHIV1 Found transcript for {url}, beginning with {transcript[:50]}" - ) transcript = " ".join( f"[{segment['start']:.2f}] {segment['text']}" for segment in transcript ) s3_cache.set_cache(CACHE_NAMESPACE, url, transcript) return transcript - else: - logger.warning(f"SHIV1 No transcript found for {url}") - else: - logger.warning(f"SHIV1 No video id found for {url}") except Exception as e: logger.exception( - f"SHIV1 Failed to extract transcript for {url}." + str(e), + f"Failed to extract transcript for {url}." + str(e), stack_info=True, ) - # logger.error(f"SHIV1 Failed to extract transcript for {url}." + str(e)) return None return ""