I want to implement a program with auto -renewal, and for this you need a script to download a file with Google Drive. Immediately I say that the file is in open and downloading access. But how to do this if you can’t get a link to the file itself, so I don't know how to implement it.
question@mail.ru
·
01.01.1970 03:00
How to use Python to download a file with Google Drive?
answer@mail.ru
·
01.01.1970 03:00
import urllib.requestlogo = urllib.request.urlopen ( "" https://drive.google.com/................dnload "" ). Read () f = open ( "" The name of the file with the extension "" , "" wb "" ) f.write (logo) f.close () I can give a visual example:
import urllib.requestlogo = urllib.request.urlopen ( "" https://drive.google.com/uc?id=1gktotz72ixxtq8w1bhmmlvayufie& ;Port=Download "" ). Read () f = Open ( "" Photo.jpg "" , "" wb "" ) f.write (logo) f.close () but to get such a link to download, you must first follow the reference indicated for the general access, and then click on the loading icon. And the link that has opened, its own, will end in download, and this is exactly what we needed. And then we just copy it into insert it.