Implementing a Google Drive Video Downloader in TypeScript
Implementing Google Drive Downloader
Welcome to the first lesson in this course! In this unit, you'll build a system that allows users to preview, download, and transcribe videos directly from Google Drive URLs.
Heads-up:
Support for LinkedIn video downloads is also present in the codebase via a separate service. You’re welcome to try it now — but we’ll explore it in depth in Unit 2.
Overview
Here’s what you’ll accomplish in this unit:
- Extract Google Drive File ID from URLs
- Preview videos in-browser before downloading
- Download the video using curl
- Load and display the downloaded video for playback
- Transcribe the first 30 seconds of audio using Whisper
Understanding Google Drive URL Formats
Google Drive URLs typically follow one of two structures:
-
Direct file path
https://drive.google.com/file/d/{fileid}/view -
Open ID parameter
https://drive.google.com/open?id={fileid}
Both of these formats are supported by the application.
The getDriveFileId() function checks for both patterns:
This approach ensures maximum compatibility with typical Google Drive sharing links.
Previewing the Video (before Download)
public/index.html
public/app.js
The embedded iframe provides users a preview of the Drive-hosted video before they download it.
Handling the Load Button (Client Side)
public/app.js
When the user clicks "Load", the video URL is posted to /process-url, which in turn invokes the backend downloader service.
