🧭 Introduction
Sometimes, downloading large files directly to your local system can be painfully slow, especially when the source server is far away, overloaded, or unstable.
In such cases, I found a neat trick using Google Colab and Python to speed things up, by downloading the file into my Google Drive first, and then fetching it from there when convenient.
This blog shares:
- A working Python script (using
gdown
) - Why this method might be faster in some cases
- When it’s worth using (and when it might not help)
⚙️ The Idea: Use Google’s Speed to Your Advantage
Here’s the general approach:
- Run a small script in Google Colab.
- Let Google’s servers download the file into your Google Drive.
- Later, download it to your device, often faster and more reliably than from the original source.
This has worked well for downloading:
- 📽️ Movies
- 📚 PDFs and eBooks
- 🧩 Software packages and installers
- 🎮 Game files
📜 The Python Code
# Step 1: Install required libraries
!pip install gdown
from google.colab import drive
import re
import os
import gdown
# Step 2: Mount Google Drive
drive.mount('/content/drive')
# Step 3: Function to download file
def download_file(file_url, save_path):
# Extract the original file name from the URL
file_name = os.path.basename(file_url)
# Download the file from the given URL
gdown.download(file_url, os.path.join(save_path, file_name), quiet=False)
# Example usage
file_url="https://file-examples.com/storage/feac45e876684fd51a206f4/2017/04/file_example_MP4_1920_18MG.mp4"
save_path = '/content/drive/MyDrive/Colab Notebooks/Downloads/' # Specify your folder
# Download the file
download_file(file_url, save_path)
print("\nDownload completed!")
⚠️ Make sure the URL ends with file name and extension (a direct download link)
🖥️ Executing the Script in Colab
Running the Python script inside Google Colab. Once executed, the file starts downloading to your Google Drive.
📂 File Saved in Google Drive
The downloaded file appears neatly in your specified Google Drive folder, ready to download or organize.
💡 Why Might This Be Faster?
To be honest, this part is partly based on my observations and assumptions:
- ⚡ Google Colab runs on Google’s own infrastructure, high-speed servers with great bandwidth.
- 🌍 Google Drive is likely replicated across multiple regions, so downloading from it might be faster depending on where you are.
- ⏳ Some direct file downloads are rate-limited or unreliable, but Google Drive rarely is.
- 🧠 Plus, once the file is in your Drive, you control it, you can rename, organize, or download it anytime, even if the original source goes offline.
🤔 But Is This Always Better?
Not necessarily. Here are a few considerations:
Situation | Should You Use This Method? |
---|---|
File is huge and downloads slowly | ✅ Yes |
Source server is flaky or unreliable | ✅ Yes |
File needs to be saved long-term | ✅ Yes |
You're on a fast network, direct is stable | ❌ Probably not |
File is behind a login / not public | ⚠️ May not work without auth headers |
So yes, this trick won’t magically speed up every download, but when it works, it can feel like magic ✨
🗣️ Final Thoughts
This might not be a universal solution, but for me, it’s been a smart workaround, especially for those annoying moments when a 1 GB file says “5 hours remaining.”
Try it out next time your download speed is crawling, and let me know if it helps!
Happy downloading 🚀