Skip to content

Commit

Permalink
WIP bin
Browse files Browse the repository at this point in the history
  • Loading branch information
b-ggs committed Jan 11, 2025
1 parent 3bf9a72 commit 96886b7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bin/.bin/drive_share_to_download_link.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python3

import sys

def drive_share_to_download_link(share_link: str) -> str:
"""Convert Google Drive share link to download link."""
if not share_link.startswith("https://drive.google.com/file/d/"):
return "Invalid share link."
file_id = share_link.split("/")[5]
download_link = f"https://drive.google.com/uc?id={file_id}&export=download"
return download_link

share_link = sys.argv.pop(1)
print(drive_share_to_download_link(share_link))

0 comments on commit 96886b7

Please sign in to comment.