BaiduWp icon

BaiduWp

调用百度网盘接口

Overview

This node integrates with Baidu Netdisk (Baidu Cloud Storage) API to retrieve file information, manage files, share files, and get user info. Specifically, for the Resource: 获取文件信息 (File Information) and Operation: 获取文件列表 (Get File List), it fetches a list of files or folders from a specified directory in the user's Baidu Netdisk storage.

Common scenarios where this node is useful include:

  • Listing files and folders within a specific directory on Baidu Netdisk.
  • Filtering results to only show folders.
  • Sorting files by date or other criteria.
  • Limiting the number of returned results for pagination or performance reasons.

Practical example:

  • A user wants to display all files in their root directory / but only needs the first 50 entries sorted ascendingly.
  • Another use case is to list only folders inside a given directory to build a folder tree UI.

Properties

Name Meaning
查询目录 (dir) The directory path to query. Default is /.
查询数目 (limit) Maximum number of results to return. Must be at least 1. Default is 50.
文件排序 (desc) Boolean flag to determine sorting order. true means descending order; false ascending. Default is false.
是否只返回文件夹 (folder) Boolean flag to indicate if only folders should be returned (true) or both files and folders (false). Default is false.

Output

The output is an array of JSON objects representing files and/or folders retrieved from the specified directory. Each item contains metadata about a file or folder such as name, path, size, modification date, and type.

  • The output is structured as an array under the json field.
  • Each element corresponds to one file or folder entry.
  • If the "是否只返回文件夹" property is set, all items will be folders.
  • No binary data output is indicated for this operation.

Example output snippet (conceptual):

[
  {
    "name": "Documents",
    "path": "/Documents",
    "isdir": 1,
    "size": 0,
    "server_mtime": 1610000000
  },
  {
    "name": "photo.jpg",
    "path": "/photo.jpg",
    "isdir": 0,
    "size": 204800,
    "server_mtime": 1610001000
  }
]

Dependencies

  • Requires an API key credential for Baidu Netdisk API authentication.
  • Uses internal helper functions to make HTTP GET requests to Baidu's API endpoints.
  • The node depends on n8n's environment to provide credentials and handle execution metadata.
  • No additional external services beyond Baidu Netdisk API are required.

Troubleshooting

  • Empty result sets: Ensure the 查询目录 (dir) path exists and is accessible by the authenticated user.
  • Invalid parameter errors: Check that 查询数目 (limit) is a positive integer and other parameters are correctly set.
  • API rate limits or authentication failures: Verify that the API key credential is valid and has sufficient permissions.
  • Unexpected error messages from Baidu API: These are surfaced via error handling in the node; check the error message details for guidance.
  • Timeouts or slow responses: Network issues or large directories may cause delays; consider reducing limit or querying smaller directories.

Links and References

Discussion