I'd like to make a function which converts Google Drive videos into VLC streamable links (eg vlc://https://WEBSITE.com/FILE_ID.mkv
.
I've tried methods which were shared on stack overflow, such as modifying the Google Drive link to: https://drive.google.com/uc?export=download&id=FILE_ID
All the methods I've tried seem to not work anymore. Any ideas?
I've figured out the answer.
Google Drives' API has a download feature, you just need to make a request to https://www.googleapis.com/drive/v3/files/FILE_ID?alt=media&key=API_KEY
Now this doesn't generate a direct file path ending with .mp4
or .mkv
but VLC and PotPlayer are able to recognize this link like this:
potplayer://https://www.googleapis.com/drive/v3/files/FILE_ID?alt=media&key=API_KEY
vlc://https://www.googleapis.com/drive/v3/files/FILE_ID?alt=media&key=API_KEY
Edit: this doesn't work in development, Google prevents bots from making requests like that. To work around this you need to set a header in your request. eg
url = "https://www.googleapis.com/drive/v3/files/FILE_ID?alt=media&key=API_KEY"
r = requests.get(url, headers={"Authorization":"Bearer " + accessToken})
You get the accessToken
from the Google Drive API
Just make the file public and copy your ID. You can find it here: /file/d/ YOUR ID /view?usp=sharing. Copy your ID and paste it in this: drive.google.com/uc?export=view&id= YOUR ID
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.