├── .gitignore ├── README.md └── main.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Google Drive Permanent Direct Link Generator 2 | ### Requirements: 3 | 1. Python3 4 | 2. Google Account 5 | 6 | ### HOW-TO: 7 | 1. Getting API Key: 8 | 9 | * Visit the [Google Cloud Console](https://console.developers.google.com/apis/credentials) 10 | * Go to the OAuth Consent tab, fill it, and save. 11 | * Go to the Credentials tab and click Create Credentials -> API KEY 12 | * Choose Other and Create. 13 | * Copy your API KEY 14 | * In terminal, `nano main.py` 15 | * Replace `PasteHere` with the api you got. 16 | ```api = "PasteHere"``` 17 | 18 | 2. Enable the Drive API: 19 | 20 | * Visit the [Google API Library](https://console.developers.google.com/apis/library) page. 21 | * Search for Drive. 22 | * Make sure that it's enabled. Enable it if not. 23 | 24 | 3. CD into the cloned for and open up and terminal and type > 25 | ```python3 main.py``` 26 | *Paste as many links as your wish to and enter ```q``` to exit and get direct links.* 27 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | # Credits : @jagrit007 (GitHub) 2 | # https://github.com/jagrit007 3 | print("""Welcome to the Direct Link Generator by @jagrit007 4 | for any issues report to me on Telegram : @notSbeve 5 | Paste as much shareable links as you wish and when you're done just enter q 6 | Make sure you've entered your own API key in main.py 7 | Don't Forget to rename file after Download with extension!! 8 | 9 | Thanks!""") 10 | 11 | api = "PasteHERE" 12 | file_id="" 13 | i = "" 14 | list1 = [] 15 | while i != "q": 16 | i = input("Enter URL: ") 17 | list1.append(i) 18 | 19 | list1.pop(-1) 20 | #print(list1) 21 | for link in list1: 22 | if link.find("file/d/") != -1: 23 | id_part = link.find("file/d/") 24 | id = link[id_part+7:] 25 | new_id = id.replace("/view?usp=drivesdk", "") 26 | final_url = f"https://www.googleapis.com/drive/v3/files/{new_id}?alt=media&key={api}" 27 | print(f""" 28 | {final_url} 29 | """) 30 | elif link.find("&export=download") == -1: 31 | id_part = link.find("id=") 32 | id = link[id_part+3:] 33 | #print(id) 34 | final_url = f"https://www.googleapis.com/drive/v3/files/{id}?alt=media&key={api}" 35 | print(f""" 36 | {final_url} 37 | """) 38 | else: 39 | id_part = link.find("id=") 40 | id = link[id_part+3:-16] 41 | final_url = f"https://www.googleapis.com/drive/v3/files/{id}?alt=media&key={api}" 42 | print(f""" 43 | {final_url} 44 | """) 45 | --------------------------------------------------------------------------------