From d3e769fc751e1f24ce940c5eab6ae077f6cb6c06 Mon Sep 17 00:00:00 2001 From: Kentaro Wada Date: Thu, 25 Jan 2024 13:12:53 +0900 Subject: [PATCH] Skip process only for gdrive files by breaking early --- gdown/download.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdown/download.py b/gdown/download.py index 592b6a1c..e274e60f 100644 --- a/gdown/download.py +++ b/gdown/download.py @@ -156,6 +156,9 @@ def download( while True: res = sess.get(url, stream=True, verify=verify) + if not (gdrive_file_id and is_gdrive_download_link): + break + if url == url_origin and res.status_code == 500: # The file could be Google Docs or Spreadsheets. url = "https://drive.google.com/open?id={id}".format(id=gdrive_file_id) @@ -213,8 +216,6 @@ def download( if "Content-Disposition" in res.headers: # This is the file break - if not (gdrive_file_id and is_gdrive_download_link): - break # Need to redirect with confirmation try: