问题
A friend sent me the URL of a dropbox folder he shared with me. This folder has files whose total size is about 8GB.
I have a basic account with 2GB limit, so I cannot add the shared folder contents to my dropbox folder.
How do I programmatically download all the files from the shared folder to my PC?
I checked the documentation (both v1 and v2) and didn't find any APIs that would do this. Am I missing something?
回答1:
The current version of the Dropbox API, has endpoints for getting the metadata of shared links, as well as downloading files from shared links:
- to get the metadata for a shared link: /2/sharing/get_shared_link_metadata
- to download files from a shared link: /2/sharing/get_shared_link_file
The /2/sharing/get_shared_link_metadata endpoint unfortunately doesn't return the file listing though, so if you need to programmatically get the file listing for use with /2/sharing/get_shared_link_file, as a workaround you can use the API v1 endpoint /1/metadata/link.
Edit:
Dropbox API v2 now supports listing the contents of a shared link for a folder. This can be accomplished using the same interface as listing a folder in a connected user's account, via the list_folder functionality. To list the contents of a shared link for a folder, you instead provide the shared link URL in the shared_link parameter to /2/files/list_folder.
If you're using an official SDK, there will also be a corresponding method for this endpoint.
来源:https://stackoverflow.com/questions/39749266/download-files-from-dropbox-shared-folder-using-dropbox-api