{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# WebVTT Reading and Chunking Test" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from datetime import datetime, timedelta\n", "from functools import partial\n", "from html import escape\n", "from io import BytesIO\n", "from IPython.display import display_html\n", "from itertools import chain\n", "import re\n", "from webvtt import Caption, WebVTT\n", "from webvtt.models import Timestamp\n", "from zoneinfo import ZoneInfo\n", "\n", "display_html = partial(display_html, raw=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "FILE_PATH = 'GMT20250411-223535_Recording.transcript.vtt'\n", "TIME_ZONE = ZoneInfo(\"America/New_York\")\n", "BASE_TIME = datetime(2025, 4, 11, hour=22, minute=35, second=35, tzinfo=ZoneInfo(\"GMT\")).astimezone(TIME_ZONE)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "with open(FILE_PATH, 'rb') as file:\n", " web_vtt = WebVTT.from_buffer(BytesIO(file.read()))" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "