class_docstr: Youtube Video info  by video id Table implementation
class_docstr_tok: ["Youtube","Video","info","by","video","id","Table","implementation"]
code: def get_captions_by_video_id(self, video_id):
      try:
          transcript_response = YouTubeTranscriptApi.get_transcript(
              video_id, preserve_formatting=True
          )
          json_formatted_transcript = JSONFormatter().format_transcript(
              transcript_response, indent=2
          )
          return json_formatted_transcript
  
      except Exception as e:
          logger.error(
              f"Encountered an error while fetching transcripts for video ${video_id}: ${e}"
          ),
          return "Transcript not available for this video"
  
imports: from typing import List
  from mindsdb.integrations.libs.api_handler import APITable
  from mindsdb.integrations.utilities.sql_utils import extract_comparison_conditions
  from mindsdb.utilities import log
  from mindsdb_sql.parser import ast
  from mindsdb.integrations.handlers.utilities.query_utilities import SELECTQueryParser, SELECTQueryExecutor, INSERTQueryParser
  import pandas
  import re
  from youtube_transcript_api import YouTubeTranscriptApi
  from youtube_transcript_api.formatters import JSONFormatter
label_desc: Use image node_id 4 for calling the YoutubeVideosTable obj's underlying member method code with example usage: obj.get_captions_by_video_id(video_id) and returns: json_formatted_transcript, str