Is is possible to get a permanent URL to a file uploaded to Google drive?

后端 未结 9 1030
终归单人心
终归单人心 2021-02-05 03:09

I can\'t find the answer to this in the API docs or elsewhere. I see in the docs says you can get a downloadURL of a file, but it refers to it as a \'short lived URL\'. What d

相关标签:
9条回答
  • 2021-02-05 03:37

    https://developers.google.com/drive/v2/reference/files#webContentLink

    downloadUrl is short lived, but webContentLink is a permanent link. It's odd that one is a URL and the other is a "link", but I guess it probably has to do with the additional query params in the strong. Maybe that makes it not just a URL? :)

    That property is only available for files that are publically readable, so you may have to use the SDK/API to set the permissions first.

    0 讨论(0)
  • 2021-02-05 03:39

    It seems if you have file ID you can access it with such url:

    https://drive.google.com/open?id=file-id-here
    

    If file is public, you'll see it immediately but if not, you're be asked to login

    0 讨论(0)
  • 2021-02-05 03:41

    Yes, you can get a permalink to any file hosted on Google Drive in a public folder. Just note the folderID: Google Drive folder ID and paste it to the following URL: http://googledrive.com/host/<folderID>/<filename> or you can create a short custom alias using G Drives: http://gdriv.es/<alias>/<filename>

    0 讨论(0)
  • 2021-02-05 03:44

    In case someone encounter the same problem and don't want to do with deprecated Google Drive solution above and requires frequently changed files with exact same url, you can use Dropbox. Steps:

    • Download the program and share a folder (tutorial)
    • Copy a file into that folder; wait for sync with Dropbox
    • Go to your dropbox.com account
    • Share your file by button, get something like: https://www.dropbox.com/s/d28d8scvr3rfy48/foo.exe?dl=0
    • Rename it to:
      https://dl.dropboxusercontent.com/s/d28d8scvr3rfy48/foo.exe?dl=0

    Now you have a public, unchanged url for all your foo.exe changes. Enjoy, don't waste time with sites offering you file hosting and they change the URL for same files.

    0 讨论(0)
  • 2021-02-05 03:44

    If you share a file publicly in GDrive, you can use the following link to make the file download directly:

    https://drive.google.com/uc?export=download&id=FILEID

    The problem happens when you want to change the file (for version controlled download, in instance) and keep the same downloading link.

    You can use a URL Shortener like bitly.com and use a Branded Bitlink to change the destination URL keeping the input URL.

    I hope it works, good luck!

    0 讨论(0)
  • 2021-02-05 03:55

    I don't know if such API for google drive exists, but I think you should also have a look at dropbox, which will meet all the demands that you mention in your question.

    Also there are some very cool applications developed just for dropbox, like pancake.io which lets you share links of text, html files, in an html page format.

    that + permanent link is always there.

    0 讨论(0)
提交回复
热议问题