GDrive-Streaming-Link
Stream from GDrive link in your favourite video player using your GDrive API_KEY.
Contents
Requirements
- file_id from GDrive link.
- api_key from your Google Cloud Console.
How to?
- How to get file_id?
- How to get api_key?
How to get file_id?
- file_id can be obtained:
- from a GDrive link which is already publicly (or)
- by making a shareable link from a your GDrive
- For example, here,
https://drive.google.com/open?id=1hpBqbuHQr6UhVawkcsANAe63P70s9Ycu
1hpBqbuHQr6UhVawkcsANAe63P70s9Ycu is the file_id.
How to get api_key?
api_key can be obtained from Google Cloud Console. Following pictures guide you on how to get api_key:
-
Go to Google Cloud Console and create a new project.
-
Now click on APIs & Services and go to Credentials.
-
Click on Create Credentials and then on API key and copy.
-
Copy and save the api_key somewhere.
stream.py
This is where you obtain the streamable link. As this is my first project, I thought of writing it in python with just two functions. That is print
and input
. You can get the py from here
prompt = "Enter your file_id:"
file_id = input(prompt)
prompt = "Enter your api_key:"
api_key = input(prompt)
print(f"https://www.googleapis.com/drive/v3/files/{file_id}/?key={api_key}&alt=media")
Credits
Thanks to Yuno.