Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Shallow download files from Google drive folder using gdown and selenium
from bs4 import BeautifulSoup
from selenium import webdriver
import gdown
import argparse
parser=argparse.ArgumentParser()
parser.add_argument("url")
args=parser.parse_args()
options = webdriver.ChromeOptions()
options.add_argument('headless')
driver = webdriver.Chrome(options=options)
print("geting files ids...")
driver.get(args.url);
soup=BeautifulSoup(driver.page_source,"lxml")
driver.close()
ids=[elem.attrs["data-id"] for elem in soup.select("[data-id]")]
print("downloading files...")
for id_ in ids:
gdown.download('https://drive.google.com/uc?id='+id_)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment