-
Notifications
You must be signed in to change notification settings - Fork 18
/
main.py
44 lines (41 loc) · 1.33 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Credits : @jagrit007 (GitHub)
# https://github.com/jagrit007
print("""Welcome to the Direct Link Generator by @jagrit007
for any issues report to me on Telegram : @notSbeve
Paste as much shareable links as you wish and when you're done just enter q
Make sure you've entered your own API key in main.py
Don't Forget to rename file after Download with extension!!
Thanks!""")
api = "PasteHERE"
file_id=""
i = ""
list1 = []
while i != "q":
i = input("Enter URL: ")
list1.append(i)
list1.pop(-1)
#print(list1)
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}
""")