I had a Bash script that parsed my browser history, and for every YouTube video it would run yt-dlp with "--write-info-json --write-subtitles --download-archive=already-downloaded.db" flags. Creating it was the easy part, but keeping it running has presented some challenges. For example, Google started rate limiting my IP quickly, so I had to offload this process to a NAS, where it could keep running for hours overnight, persistently downloading stuff at near dialup speeds. Then I was running out of storage quickly, so I had to add video filtering, and I planned to add basic garbage collection. And of course I had to have youtube-dl (and later yt-dlp) updated at all times.
In the end, I decided it is not worth it. In the scenario you described, I would take the video link/ID and paste it into Bing and Yandex. There is large chance they still have that page cached in their index.
FWIW if you are going to create your own tool, my advice will be to make it a browser extension, and try to pull the video straight from YouTube's <video> element.