POST

API health

24h health
Normal
  • Healthy / normal
  • Available
Normal

Last 24 hours

Last 30 days

Get the video and audio stream addresses of one part (P) of a Bilibili video, from its link or BV ID and the part's cid. Up to 480P without logging in. The addresses expire at streams_expire_at; send streams_referer as the Referer when you fetch them.

Send POST https://api.everyinfra.com/api/v1/social with platform set to bilibili and action set to media_links. Price $0.79 per 1,000 requests ($0.000792 per call). Failed calls and empty results are not charged. Synchronous. For slow jobs add "mode": "async" to the body, take the job_id and poll.

AI prompt

#
Please help me write a data collection script with the EveryInfra Bilibili Media download links endpoint (bilibili/media_links).

How the endpoint works:
- Request: POST https://api.everyinfra.com/api/v1/social with the header Authorization: Bearer <API key>. Read the key from the EVERYINFRA_API_KEY environment variable and never hard-code it.
- In the request body, set platform to bilibili and action to media_links, and put the parameters inside params.
- Required parameters:
  - url: The video the part belongs to: a Bilibili video link such as https://www.bilibili.com/video/<BV ID>, or the BV ID itself. Anything else returns 422 and is not charged.
  - cid: The numeric ID of the part, taken from the cid of a video_parts row. A video with a single part still needs its one cid. A value that is not all digits returns 422 and is not charged.
- Returns one object. Main fields: id, video_id (BV number of the video), url, aid (The video's numeric av ID (popular)), cid (Part ID (video_parts): the numeric ID B…), quality_id (Code of the highest quality in this res…), quality (Quality name, such as 480P (media_links…), available_qualities (Every quality the video has (media_link…), duration_seconds, duration_sec (Video length in seconds, the same value…), video_streams (List of video streams (DASH, .m4s, pict…), audio_streams (List of audio streams (DASH, .m4s, mp4a…); 15 fields in total, full list at https://api.everyinfra.com/api/v1/social/catalog?platform=bilibili.
- Example request body:
{
  "platform": "bilibili",
  "action": "media_links",
  "params": {
    "url": "https://www.bilibili.com/video/BV1xx411c7mD",
    "cid": "62131"
  }
}
- Price: $0.79 per 1,000 requests; failed and empty results are not charged.
- For dozens or hundreds of targets, add "mode": "async" to the body: you get a job_id at once and poll GET https://api.everyinfra.com/api/v1/jobs/{job_id} for the result.
- On 422, fix the request using the suggested parameter names and allowed values in the error; on 429 or 503, wait for Retry-After and try again.

Before writing code, ask me which targets I need, how many, which fields, and what output format I want; then confirm the plan and the rough cost with me.

Request parameters

#
NameInTypeRequiredDefaultDescription
AuthorizationheaderstringYes-Bearer followed by your API key. Create it in the console; never put it in a URL or a code repository.
platformbodystringYesbilibiliPlatform identifier, fixed value.
actionbodystringYesmedia_linksCapability identifier, fixed value.
urlbody.paramsstringYes-The video the part belongs to: a Bilibili video link such as https://www.bilibili.com/video/<BV ID>, or the BV ID itself. Anything else returns 422 and is not charged.
cidbody.paramsstringYes-The numeric ID of the part, taken from the cid of a video_parts row. A video with a single part still needs its one cid. A value that is not all digits returns 422 and is not charged.

Code samples

#
bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "bilibili",
  "action": "media_links",
  "params": {
    "url": "https://www.bilibili.com/video/BV1xx411c7mD",
    "cid": "62131"
  }
}'

OpenAPI definition (JSON)Samples read the key from the EVERYINFRA_API_KEY environment variable; copied code never contains your key.

Response example

#
No sample response is available for these parameters yet. This preview shows the response shape and fields from the API definition, with … as placeholders; it is not the result of a live call.
json
{  "id": "req_…",  "platform": "bilibili",  "action": "media_links",  "results": {    "id": …,    "video_id": …,    "url": …,    "aid": …,    "cid": …,    "quality_id": …,    "quality": …,    "available_qualities": …,    "duration_seconds": …,    "duration_sec": …,    "video_streams": …,    "audio_streams": …,    "mp4_segments": …,    "streams_expire_at": …,    "streams_referer": …,    "platform": …  },  "billing": {    "charged": …,    "charged_usd": …,    "balance_after_usd": …,    …  },  "quota": { … }}

Response fields

#

Business data is in results. The table lists the fields a record can contain. Values the platform does not show are never made up.

FieldMeaning
idThe record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms.
video_idBV number of the video.
urlLink to the record on the platform.
aidThe video's numeric av ID (popular); it names the same video as the BV ID in id.
cidPart ID (video_parts): the numeric ID Bilibili assigns to each part of a video.
quality_idCode of the highest quality in this response (media_links), such as 32; up to 480P without logging in.
qualityQuality name, such as 480P (media_links: the highest quality in this response; each entry of video_streams: that stream's quality).
available_qualitiesEvery quality the video has (media_links), as an array: id is the quality code, quality is its name. It does not mean all were returned this time; video_streams shows which were.
duration_secondsDuration in seconds. null for content that is not video or audio.
duration_secVideo length in seconds, the same value as duration_seconds (both names are returned); on video_parts it is the length of that one part, elsewhere a multi-part video gives the total of all parts.
video_streamsList of video streams (DASH, .m4s, picture only with no sound, to be merged with an audio stream): id (quality code), quality (quality name, up to 480P without login), codecs (avc1 / hev1 / av01), width, height, frame_rate, bandwidth, url, backup_urls. The links expire after about 120 minutes, see streams_expire_at; send the Referer request header when downloading, see streams_referer.
audio_streamsList of audio streams (DASH, .m4s, mp4a): id, codecs, bandwidth, url, backup_urls. Expiry time and Referer requirement are the same as for video_streams.
mp4_segmentsAddresses of the whole mp4 (media_links). A few older videos have no DASH streams and come as one mp4 instead; then this field is present and video_streams and audio_streams are not. Each entry has order, duration_seconds, size (bytes), url and backup_urls.
streams_expire_atTime when the stream URLs expire (ISO, the earliest of all the links; about 120 minutes after the call). After that, call video again to get new URLs.
streams_refererValue of the Referer request header that must be sent when downloading the stream URLs (without it the request gets a 403).
platformSource platform identifier, the same as platform in the request (for example xiaohongshu, tiktok).

Errors and billing

#
401
Missing or invalid key.
402
Insufficient balance. Top up first.
422
Invalid parameter name or value. Fix it using the suggestions in the error. No charge.
429
Per-minute request limit reached. Wait for Retry-After, then try again.
503
Could not complete. The held charge is returned to your balance. If the outcome is unknown, verify it before you retry.
200 empty
No data. No charge.

Errors

Google Analytics needs consent. Privacy