Created
April 12, 2020 13:42
-
-
Save py7hon/1623fd16985581eba68eaaca761b6a55 to your computer and use it in GitHub Desktop.
google drive downloader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api = "AIzaSyBPO_VhHtvTL-gs35Nb24cSsjuxQasjlN0" | |
file_id="" | |
i = "" | |
list1 = [] | |
while i != "q": | |
i = input("Enter URL: ") | |
list1.append(i) | |
list1.pop(-1) | |
for link in list1: | |
if link.find("file/d/") != -1: | |
id_part = link.find("file/d/") | |
id = link[id_part+7:] | |
new_id = id.replace("/view?usp=drivesdk", "") | |
final_url = f"https://www.googleapis.com/drive/v3/files/{new_id}?alt=media&key={api}" | |
print(f""" | |
{final_url} | |
""") | |
elif link.find("&export=download") == -1: | |
id_part = link.find("id=") | |
id = link[id_part+3:] | |
#print(id) | |
final_url = f"https://www.googleapis.com/drive/v3/files/{id}?alt=media&key={api}" | |
print(f""" | |
{final_url} | |
""") | |
else: | |
id_part = link.find("id=") | |
id = link[id_part+3:-16] | |
final_url = f"https://www.googleapis.com/drive/v3/files/{id}?alt=media&key={api}" | |
print(f""" | |
{final_url} | |
""") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment