The steps
Install gdown with pip install gdown
- the command worked in a Standard Windows 11 PowerShell for me. (Make sure You have Python and Pip installed for this command)
Make a .txt file with Your links, listed in the following manner:
https://drive.google.com/file/d/someID/view
https://drive.google.com/file/d/someotherID/view
and so on - Don't put anything that is not a link here
Edit the variables at the top in the below script to fit Your needs.
Run it
If everything goes right - You'll find Your files in the directory You specified
The Script
from os import chdir
from typing import List
from gdown import download
from requests.exceptions import MissingSchema
my_links_file_path: str = r'C:\Users\Jakub\Desktop\a\download_links.txt' # EDIT THIS!
my_output_directory_path: str = r'C:\Users\Jakub\Desktop\a' # EDIT THIS!
def google_drive_bulk_download(links_file_path: str, output_directory_path: str):
try:
file = open(links_file_path, 'r')
except FileNotFoundError:
print(f"\n!!! The File '{links_file_path}' is Invalid!\n")
return
try:
chdir(my_output_directory_path)
except FileNotFoundError:
print(f"\n!!! The File '{output_directory_path}' is Invalid!\n")
return
file_lines: List[str] = [stripped_line for stripped_line in
[line.strip() for line in file.readlines()]
if stripped_line]
file_lines_count: int = len(file_lines)
print('\n\n==> Started Downloading!\n')
for i, url_raw in enumerate(file_lines, start=1):
download_url: str = url_raw.strip()
print(f'\n-> Downloading... [{i}/{file_lines_count}]')
try:
download(url=download_url, quiet=False, fuzzy=True)
except: # If anyone knows what exact errors can gdown raise then please edit this answer to be more explicit or leave a comment. For now I will leave the 'bad practice' broad error catch
print(f"!!! The URL '{download_url}' is Invalid or Failed To Download!")
print('Finished!')
print('\n\n==> Finished Downloading!')
google_drive_bulk_download(my_links_file_path, my_output_directory_path)
The Notes
This method worked for me. On Windows 11, Python 3.10 and Python 3.11.
This script may or may not work with other formats of google drive links.
You may want to try using a VPN if the Downloads fail - I had to.
There are many browser extensions that help You list the URLs of Your currently open browser tabs. No need to do it by hand.