Baidu APIpan.baidu.com ↗
Access Baidu Pan (Baidu Netdisk) share link metadata and file listings via 2 endpoints. Retrieve share status, owner info, and file arrays without authentication.
What is the Baidu API?
The Baidu Pan API exposes 2 endpoints for querying publicly visible share links on pan.baidu.com without any authentication. The get_share_info endpoint returns share status, owner identifiers, and VIP metadata for any share code regardless of whether the link is active, cancelled, or expired. The list_share_files endpoint retrieves the full file array embedded in an active share, including per-file metadata and share-level details across 10 response fields.
curl -X GET 'https://api.parse.bot/scraper/befc851f-d7d4-4065-ac00-2ddae655e491/get_share_info?surl=1eQlSMtk' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace pan-baidu-com-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: Baidu Pan SDK — bounded, re-runnable; every call capped."""
from parse_apis.pan_baidu_com_api import BaiduPan, ParseError
client = BaiduPan()
# Look up a share link by its short URL code
share = client.shares.get(surl="1eQlSMtk")
print(share.status, share.share_username, share.shareid)
# Navigate to the file listing for this share
try:
detail = share.files()
print(detail.status, detail.ctime, detail.description)
for f in detail.files[:3]:
print(f.filename, f.size)
except ParseError as e:
print("error:", e.code)
print("exercised: shares.get, share.files")
Retrieve metadata about a Baidu Pan share link using its short URL code. Returns share status (active, cancelled, expired, not_found), owner info, and identifiers. Works for any share link state without requiring authentication.
| Param | Type | Description |
|---|---|---|
| surlrequired | string | The short URL code from a pan.baidu.com/s/<code> share link (e.g. '1eQlSMtk'). |
{
"type": "object",
"fields": {
"uk": "numeric user key of the share owner",
"surl": "the queried short URL code",
"errno": "upstream API error code (0=active, -21=cancelled, 105=not_found, etc.)",
"status": "human-readable share status string",
"longurl": "long-form share URL parameters",
"shareid": "numeric share identifier",
"show_msg": "status message from Baidu (in Chinese)",
"vip_type": "VIP type of the share owner",
"prod_type": "product type",
"vip_level": "VIP level of the share owner",
"share_type": "share type code",
"share_photo": "avatar URL of the share owner",
"share_username": "masked username of the share owner"
},
"sample": {
"data": {
"uk": 372520831,
"surl": "1eQlSMtk",
"errno": -21,
"status": "cancelled",
"longurl": "shareid=3145052969&uk=372520831",
"shareid": 3145052969,
"show_msg": "来晚啦,该分享已被取消",
"vip_type": 0,
"prod_type": "share",
"vip_level": 1,
"share_type": 0,
"share_photo": "https://himg.bdimg.com/sys/portrait/item/public.1.edb9e8d4.IBCBEEflArqH8UqVjmZ9ag.jpg",
"share_username": "寒雨***ng"
},
"status": "success"
}
}About the Baidu API
Share Link Metadata
The get_share_info endpoint accepts a single surl parameter — the short code appearing after /s/ in any pan.baidu.com share URL (e.g. 1eQlSMtk). It returns the numeric uk (user key) and shareid that uniquely identify the share owner and the share itself, along with an errno code that distinguishes active shares (0), cancelled shares (-21), and not-found links (105). The status field provides a human-readable label, and vip_type plus vip_level describe the owner's Baidu account tier.
File Listing
Once you have the uk and shareid from get_share_info, pass both to list_share_files to retrieve the files array for the share. Each share record also includes ctime (Unix timestamp of share creation), description, share_photo (owner avatar URL), public flag, and expired_type. For cancelled or expired shares, errno will be non-zero and the files array will be empty. The public field (1 or 0) indicates whether the share requires a password to access.
Error Handling and Share States
Both endpoints surface the upstream errno value directly so your application can handle all share states programmatically. The show_msg field returned by get_share_info carries Baidu's own status message in Chinese, useful for display or logging. There is no authentication requirement from your side for either endpoint — the API covers only shares that are already publicly visible.
The Baidu API is a managed, monitored endpoint for pan.baidu.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when pan.baidu.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official pan.baidu.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Check whether a pan.baidu.com share link is still active before presenting it to users, using the
errnoandstatusfields fromget_share_info. - Build a share-link validator that classifies links as active, cancelled, or expired in bulk by iterating
surlcodes. - Enumerate all files in a public Baidu Pan share using
list_share_filesto index or catalog shared content. - Identify VIP account holders among share owners by reading
vip_typeandvip_levelfromget_share_info. - Track share creation timestamps via the
ctimefield to monitor when content was originally shared. - Detect password-protected shares by checking the
publicfield inlist_share_filesresponses. - Aggregate share metadata — shareid, uk, description — for research into public file distribution patterns on Baidu Netdisk.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does Baidu Pan have an official developer API?+
What does `list_share_files` return when a share has been cancelled?+
list_share_files returns an errno of -21 and an empty files array. The status field will reflect the cancelled state. Share-level fields like shareid and uk are still present in the response, but no file objects are included.Does the API return individual file sizes, download URLs, or folder structures within a share?+
list_share_files endpoint returns the files array embedded in the share page, but detailed per-file fields such as size, direct download URL, or nested folder hierarchy are not guaranteed response fields in the current spec. You can fork this API on Parse and revise it to add an endpoint that retrieves deeper per-file metadata.Can I look up a share owner's profile or other shares they have published?+
uk, vip_type, vip_level, and share_photo for a share owner, but does not expose an endpoint for querying all shares by a given user or fetching their public profile. You can fork this API on Parse and revise it to add a user-shares listing endpoint.Is there a limitation on which share links this API can query?+
public returns 0) will show share metadata in get_share_info, but list_share_files will return an empty files array since the file listing is not accessible without the share password.