Thumbnail 404 error

纵然是瞬间 提交于 2020-06-12 05:24:12

问题


I'm trying to get the thumbnail of a file but am getting an error 404, the url that return drive is like this in some files

https://docs.google.com/feeds/vt?gd=true&id=1DnoJzxnZXVERyqC5jfTwfpd8uEn&v=39&s=AMedNnoAAAAAUL0gv5da9U81UzT-L4N59b1BwNuZmzgU&sz=s220

but in others is

https://lh6.googleusercontent.com/ACwqFdvBX0NUJO6SR9fyemnCnSel-TpCZTaddu9CEkZqxtQpJY84cP_cFj64CA6=s220

the last one is from picasa and works, so apparently the url's that works are from picasa, how can i get the url's of all files like the last one?


回答1:


I ran into the same issue.

You should append access token to the thumbnailLink URL, which will authorize your GET request for it.

So something like:

var thumbLink = driveEntry["thumbnailLink"] + "&access_token=" + YOURTOKEN;

Cheers.




回答2:


To get the thumbnail of a file stored on Google Drive you have to send a GET request to the file endpoint and then check its thumbnailLink property:

https://developers.google.com/drive/v2/reference/files/get

Regardless of the format of the thumbnail URL, as long as you use the value returned in the file metadata you should be fine.

Please take into account that thumbnail URLs expire after a certain time.



来源:https://stackoverflow.com/questions/13691216/thumbnail-404-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!