Skip to content

About

Watch YouTube from Google Sheets: a Flask service that turns a video ID into a shareable Google Drive link

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📺 StreamSheet

Watch YouTube videos from inside Google Sheets — a small cloud service that turns a video ID into a shareable Google Drive link.

Python Flask Google Drive Docker

✨ What it does

StreamSheet is the back end for watching YouTube from a Google Sheet. Send it a YouTube video ID and it checks the video, downloads it at up to 720p, uploads it to Google Drive and hands back a Drive link anyone can open — so a spreadsheet can list videos and play them from Drive.

🚀 Features

  • One simple endpoint — POST /download with a videoId, get back a Google Drive viewing link.
  • Safety checks first — uses the YouTube Data API to make sure a video is public, embeddable and not age-restricted before downloading anything.
  • Sensible quality — downloads the best video up to 720p plus audio, merged into a single MP4 named after the title and channel.
  • Size guards — rejects broken downloads (under 1 KB) and anything over 500 MB.
  • Auto-sharing — uploads to Drive with a service account and makes the file readable by anyone with the link.
  • Cleans up after itself — temp files are deleted once uploaded; a /test-access route checks the Drive connection.

🛠️ How it works

flowchart LR
    S[Google Sheet] -- videoId --> F[Flask /download]
    F --> Y[YouTube Data API<br/>public? embeddable? age-restricted?]
    Y --> D[yt-dlp + FFmpeg<br/>≤720p MP4]
    D --> G[Google Drive API<br/>upload + share]
    G -- Drive link --> S
Loading

It runs as a small container (Python 3.11 slim with FFmpeg), with a Procfile for one-click hosting on platforms like Heroku/Railway.

📦 Getting started

Set two environment variables:

Variable What it is
YOUTUBE_API_KEY A YouTube Data API v3 key
SERVICE_ACCOUNT_JSON The JSON key of a Google service account with Drive access

Run with Docker:

docker build -t streamsheet .
docker run -p 5000:5000 -e YOUTUBE_API_KEY=... -e SERVICE_ACCOUNT_JSON='{...}' streamsheet

Or locally: pip install -r requirements.txt && python main.py (needs FFmpeg). Then:

curl -X POST http://localhost:5000/download -H "Content-Type: application/json" -d '{"videoId":"dQw4w9WgXcQ"}'

🧰 Built with

  • Python 3.11, Flask
  • yt-dlp + FFmpeg
  • YouTube Data API v3, Google Drive API v3 (service account)
  • Docker

About

Watch YouTube from Google Sheets: a Flask service that turns a video ID into a shareable Google Drive link

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages