Using Powershell To Create Notes From Long Youtube Videos Exemplified On Oral History Of Donald Knuth
2 min readOct 30, 2021
The aim of this page📝 is to show how to highlight interesting parts of long youtube videos. I am using this for listening to Oral Histories of Computer History Museum.
I make a short note when listening and this is how I open a video at 28 min 51 second — which is based on a timestamp from the transcript provided by Youtube. The function also copies the generated URL to the clipboard that I save to my listening notes (see link for a quick example).
STEPS
- open long youtube video of oral history
- click
...
→ Open Transcript and copy the whole transcript into separate.txt
file - for programmatic retrieval of the transcript see something like youtube-transcript-api · PyPI
28:51
mathematics now I have a feeling that a
28:57
lot of the brightest students don't go
29:01
into mathematics because they
29:07
a curious thing that that they they
29:13
don't need algebra at the level I did I
- find and replace the above with the following regex
- find
(\d{1,}:\d{1,})\n
- replace
$1
- this brings
28:51 mathematics now I have a feeling that a
28:57 lot of the brightest students don't go
29:01 into mathematics because they
29:07 a curious thing that that they they
29:13 don't need algebra at the level I did I
- during listening make note of an interesting timestamp
- map it to the transcript — which is in minutes
- to create a link, you need to convert that to seconds and use youtube’s own naming convention for starting a video from a given place
- for this use the following PowerShell function that I have in
$profile
function yt ($url, $min, $sec) {
$second_stamp = (New-TimeSpan -Minutes $min -Seconds $sec).TotalSeconds
$yt_url = $url + "?t=" + $second_stamp
$yt_url | Set-Clipboard
Start-Process Chrome $yt_url
Write-Host $yt_url clipped
}
- it copies the URL to the clipboard and opens the video at a given moment (see above)