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

后端 未结 9 1011
终归单人心
终归单人心 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:58

    I don't know how often this changes but I was looking for a dynamic solution where I wouldn't need to manually upload to another site and the provided solutions weren't working.

    Here's the url that worked for me:

    https://lh3.google.com/u/0/d/<file_id>

    Where file_id is the getId() using the google apps script drive API. Secondly the file must be shared publicly like posted previously

    Secondly I imagine the lh3 are different cdn's though I cannot confirm since lh1/2 don't work and everything higher than 3 redirects to lh3

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

    You can use gdriveurl.com, it got updated and now allows users to log in with their google drive account and share the list of files instantly, getting for each file "View" & "Download" short permalink.

    There's also the old solution (login to Google Drive, set everything to "Public on web", copy share link, convert it into the gdriveurl.com textarea in the homepage), but it's just a waste of time, you should try "MyDrive" api.

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

    Not sure if the link generated here is guaranteed to be permanent, but Google Drive Direct Link Generator does the job of generating a direct download link.

    Just make sure your file's sharing setting is set to Anyone with the link

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