Weibo

Weibo content aggregation: fetch content by channel (category) — text, images, direct video links, the reposted original post, author and interaction counts, with long posts auto-expanded to full text; the channel list (my channels / recommended channels) comes from its own endpoint.

/api/weibo/

Service Description

The Weibo content aggregation API: first call /api/weibo/channels to get the channel list, then /api/weibo/feed to fetch content by channel — each post comes with its text, images, direct video links, the reposted original post, author and repost / comment / like counts.

Channels (categories): in the Weibo hot page https://weibo.com/hot/weibo/102803, 102803 is the channel ID (= Hot). The channel endpoint returns two groups — "My channels" (the signed-in account's channels) and "Recommended channels" — each giving the channel name, ID and containerid; both IDs must be passed when fetching content (Weibo requires them separately, and their values differ).

Long posts are auto-expanded: when a long post's text is truncated, the service fetches the full text upstream, so content is already the complete text and the caller does not need to expand it again.

Two ways to supply the login credential: pass cookie in the request (your own Weibo login cookie — used for this call only, never stored by us); omit it and the endpoint falls back to the platform-hosted account — the platform keeps Weibo accounts and login cookies under "Accounts" in the console and automatically picks an available credential. Paste it into the "Local credentials" card in the right sidebar of the docs page and click "Save to this browser" so the debugger sends it automatically. If the platform-hosted credential expires, the endpoint explicitly reports that a fresh login is required and marks that account as "Expired".

/api/weibo/check verifies whether a Weibo credential is still valid: pass cookie to check your own (the platform account is never touched), or omit it to check the platform-hosted account and write the result back to its status.

Response Format

Every endpoint returns the same JSON envelope; the payload is always inside data:

{
  "code": 10000,
  "msg": "成功",
  "data": { ... }
}
  • code: business status code. 10000 means success; anything else is an error — see the Error Codes page for the full list.
  • msg: a human-readable message you can show to end users, but never use it for program logic.
  • data: the payload; usually null on error. Each endpoint's Response section lists its data fields.

Judge success by code, not by the HTTP status code. View all error codes

Weibo

Weibo (weibo.com) Signature Required

Data comes from Weibo's official web endpoints; callers may supply their own login cookie, otherwise the platform-hosted account is used.

POST /api/weibo/channels Total calls: 1

Channel list

Weibo channels: the "My channels" and "Recommended channels" groups, with name / ID / containerid.

  • The channel ID is the number in the page URL: 102803 in https://weibo.com/hot/weibo/102803 is the channel ID (Hot); switching channels means switching this number.
  • Both groups are returned, distinguished by section: "My channels" varies per signed-in account, while "Recommended channels" are Weibo's generic suggestions.
  • Pass containerid along: when fetching content, Weibo requires group_id to be the channel ID and containerid to be its own value, and the two differ for most channels (e.g. Celebrity 1028034288 / 102803_ctg1_4288_-_ctg1_4288).
  • This endpoint does not require a login (without a cookie it still returns a guest's default channels), but "My channels" varies per account.
  • GET is also accepted (parameters go in the query string); because a Weibo cookie is long, POST with the cookie in the form body is recommended.
Response Common envelope
Field Type Description
count int Total channels across both groups
groups[].section string Group name: My channels / Recommended channels
groups[].count int Number of channels in this group
groups[].channels[].id string Channel ID (= the number in /hot/weibo/{id})
groups[].channels[].name string Channel name
groups[].channels[].containerid string Channel containerid (pass together with id when fetching content)
groups[].channels[].url string Channel page URL
POST /api/weibo/feed Total calls: 0

Fetch content by channel

Fetch content by channel: text, images, direct video links, the reposted original post, author and interaction counts.

Optional, default 102803 (Hot). Value = the channel ID returned by /api/weibo/channels.

Optional. Value = the containerid returned by /api/weibo/channels; when empty the server resolves it from channel (one extra request).

Optional, 1–50, default 20.

Optional, default 0. To page through results, pass the next_since_id returned by the previous call.

  • Long posts are auto-expanded: for long posts where is_long_text is true, the server fetches the full text and replaces the body when it is longer, so content is the complete text (not an excerpt, no need to expand).
  • Images: content_html is the raw HTML (ready to render) and images is a pre-extracted array of image URLs (large size preferred, de-duplicated).
  • Video: video.url is a direct mp4 link (HD preferred, normalized to https), plus cover / title / duration / video page URL; video is null when there is no video.
  • The video direct link is referer-protected: video.url points to Weibo's mp4 CDN and can only be fetched with a Referer: https://weibo.com/ header (no referer, or any third-party domain, returns 403). The URL is signed with Expires and is time-limited. To play it directly in a web page, use video.stream_url (our proxy — see the "Video proxy playback" endpoint); video.url is better suited to server-side downloading.
  • Repost: the reposted original post is in retweeted (a trimmed version — its own repost and long text are not expanded); it is null when there is no repost.
  • Paging: pass the returned next_since_id as the next call's since_id; a null next_since_id (has_more is false) means the upstream provided no cursor for the next page.
  • When containerid is empty the server first queries the channel list to resolve it; to save that request, pass the containerid returned by /api/weibo/channels.
  • GET is also accepted (parameters go in the query string); because a Weibo cookie is long, POST with the cookie in the form body is recommended.
Response Common envelope
Field Type Description
channel string Channel ID (echoed back)
containerid string Channel containerid (echoed back)
count int Number of items returned
total int Total items for this channel as reported upstream (for paging reference)
since_id string Page cursor used for this request
next_since_id string Cursor for the next page (null means no next page)
has_more bool Whether there is a next page
list[].id string Post ID
list[].mid string Post mid
list[].mblogid string Post short ID (used to build the page URL)
list[].url string Post page URL (openable directly)
list[].content string Post text as plain text (long posts expanded to full text)
list[].content_html string Raw post HTML (with @ / topic / link tags)
list[].is_long_text bool Whether this is a long post
list[].images array Image URLs (large size preferred)
list[].video object Video info (null when there is no video)
list[].video.url string Weibo CDN mp4 direct link (https, HD preferred; referer-protected)
list[].video.stream_url string Our proxy playback URL (ready for a <video> tag, long-lived)
list[].video.cover string Video cover URL
list[].video.title string Video title
list[].video.duration int Video duration (seconds)
list[].video.page_url string Video page URL
list[].retweeted object The reposted original post (null when there is none)
list[].retweeted.content string Original post text
list[].retweeted.author.name string Original author name
list[].retweeted.url string Original post page URL
list[].author.id string Author ID
list[].author.name string Author nickname
list[].author.url string Author profile URL
list[].author.avatar string Author avatar URL
list[].author.verified bool Whether the author is verified
list[].reposts_count int Reposts
list[].comments_count int Comment count
list[].attitudes_count int Like count
list[].created_at int Published time (Unix seconds)
list[].source string Source (e.g. iPhone client)
list[].region string Region (may be empty)
list[].is_ad bool Whether this is an ad
GET /api/weibo/video Total calls: 3

Video proxy playback

Weibo video proxy playback: the stream is fetched upstream and relayed, so a plain <video> tag can play it.

Required: the time-limited token issued by /api/weibo/feed; no project signature needed (browsers cannot sign).

  • Why a proxy is needed: Weibo's video CDN enforces a referer check and only accepts Weibo domains — a third-party page's &lt;video&gt; sends its own domain and always gets 403; the direct link is also http://, which an https page blocks as mixed content. This endpoint fetches the stream with a Referer header and relays it as-is.
  • The URL comes from video.stream_url of /api/weibo/feed and is long-lived: the token only carries the Weibo id, and the fresh direct link is resolved by id at playback time (Weibo's direct links carry Expires and do expire).
  • This endpoint does not use the project signature: browsers cannot sign, and the multiple Range requests produced by seeking would hit the one-time-nonce replay block, so authentication is carried by the time-limited token in the URL.
  • HTTP Range is supported (200 for the whole file / 206 for a chunk): seeking and resuming both work.
  • An invalid or expired token returns 403 (just call feed again for a fresh URL); upstream fetch failures use the standard codes (40001 / 50002).
Response Common envelope

On success it returns a video binary stream (video/mp4, Range supported) — **not** the standard JSON envelope; an invalid or expired token returns 403.

POST /api/weibo/check Total calls: 0

Verify login credentials

Verify whether a Weibo login credential is valid (pass `cookie` to check your own, otherwise the platform-hosted account is checked).

  • An invalid credential does not count as an API failure: the endpoint still returns a success code, with valid=false and the reason in data, letting the caller decide whether to prompt the user to sign in again.
  • Weibo endpoints still return HTTP 200 when not signed in (the body is an ok: -100 login redirect); this endpoint judges validity from that, which is more reliable than the status code alone.
  • Checking the platform-hosted account updates its "credential status" and "last check result", visible directly on the console's "Accounts" page; checking your own cookie does not touch the platform account.
  • GET is also accepted (parameters go in the query string); because a Weibo cookie is long, POST with the cookie in the form body is recommended.
Response Common envelope
Field Type Description
valid bool Whether the credential is valid
account string The account identifier that was checked (empty when checking your own cookie)
message string Check message
XiaoYingAPI · Unified API Aggregation Service