Skip to content

Instantly share code, notes, and snippets.

@mplekh
mplekh / ytpbspeed.py
Last active March 24, 2026 16:24
Calculate a comfortable playback speed for YouTube videos
import re
import numpy as np
from youtube_transcript_api import YouTubeTranscriptApi
def fetch_transcript(video_id: str):
api = YouTubeTranscriptApi()
transcript_list = api.list(video_id)
# 1. Try manual English
try:
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp