Sand AISand AI MAGI-2MAGI-2 现已上线 SandBase:支持原生音频的 1080p 视频立即试用

Bilibili Room Stream Data

API 文档
https://api.sandbase.ai/v1/api/bilibili/web/live-videos

Returns stream URLs and playback connection details for a specific Bilibili broadcast room. Filter using the unique room identifier.

价格
$0.001美元 / 次调用
方法
POST
响应
JSON
参数
1 个必填 · 0 个可选

Playground

输入
Live room ID
输出示例
响应outputs · 1.8 KB · 38 行
[
  {
    "data": {
      "code": 0,
      "data": {
        "accept_quality": [
          "4"
        ],
        "current_qn": 10000,
        "current_quality": 4,
        "durl": [
          {
            "length": 0,
            "order": 1,
            "p2p_type": -1,
            "stream_type": 0,
            "url": "https://d1--ov-gotcha07.bilivideo.com/live-bvc/451596/live_1777360364_82518558.flv?expires=1787221949&len=0&oi=2886142013&pt=android&qn=10000&trid=100067cbee5073cdf00f61032720556a86c9&bmt=1&sigparams=cdn,expires,len,oi,pt,qn,trid,bmt&cdn=ov-gotcha07&sign=f25581d628277c9b07e784ca6c24d5cf&site=4d5b259e7440cb62fbaeda813faecd46&free_type=0&mid=0&sche=ban&trace=0&isp=other&rg=other&pv=other&info_source=origin&sk=a418dfe3b5d2a85dc2243b92a1dda63d&pp=&origin_bitrate=0&hdr_type=0&sl=1&suffix=origin&deploy_env=prod&hot_cdn=0&p2p_type=-1&score=1&source=puv3_onetier&media_type=0&vd=bc&src=puv3&order=1"
          },
          {
            "length": 0,
            "order": 2,
            "p2p_type": -1,
            "stream_type": 0,
            "url": "https://d1--ov-gotcha07b.bilivideo.com/live-bvc/451596/live_1777360364_82518558.flv?expires=1787221949&len=0&oi=2886142013&pt=android&qn=10000&trid=100067cbee5073cdf00f61032720556a86c9&bmt=1&sigparams=cdn,expires,len,oi,pt,qn,trid,bmt&cdn=ov-gotcha07&sign=f25581d628277c9b07e784ca6c24d5cf&site=4d5b259e7440cb62fbaeda813faecd46&free_type=0&mid=0&sche=ban&trace=0&isp=other&rg=other&pv=other&info_source=origin&sk=a418dfe3b5d2a85dc2243b92a1dda63d&pp=&origin_bitrate=0&hdr_type=0&sl=1&suffix=origin&deploy_env=prod&hot_cdn=0&p2p_type=-1&score=1&source=puv3_onetier&media_type=0&vd=bc&src=puv3&order=2"
          }
        ],
        "quality_description": [
          {
            "desc": "原画",
            "qn": 10000
          }
        ]
      },
      "message": "OK",
      "ttl": 1
    }
  }
]

示例

选择一个示例,将其输入和结果加载到 playground 中。

API README

Bilibili Room Stream Data API

Returns stream URLs and quality settings for one Bilibili live room. The only input is room_id, the live room ID, sent as a string.

Use cases

  • Pull the FLV stream URLs for a live room to feed an external video player.
  • Check which quality level a room is currently streaming at.
  • Compare the backup stream endpoints listed for a room.
  • List the quality labels a room offers before choosing a stream.

Request

curl -X POST "https://api.sandbase.ai/v1/api/bilibili/web/live-videos" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"room_id": "1815229528"}'

The result is returned in outputs[0].data.

Parameters

NameTypeRequiredDescription
room_idstringYesLive room ID

Example response

Real response for the request above, trimmed: lists keep their first item and long strings are cut.

{
  "code": 0,
  "data": {
    "accept_quality": [
      "4"
    ],
    "current_qn": 10000,
    "current_quality": 4,
    "durl": [
      {
        "length": 0,
        "order": 1,
        "p2p_type": -1,
        "stream_type": 0,
        "url": "https://d1--ov-gotcha07.bilivideo.com/live-bvc/251381/live_1777360364_82518558.f…"
      }
    ],
    "quality_description": [
      {
        "desc": "原画",
        "qn": 10000
      }
    ]
  },
  "message": "OK",
  "ttl": 1
}

Response fields

FieldMeaning
data.durl[].urlFull stream URL for the room. The query string carries values such as expires and qn.
data.durl[].orderPosition of the stream URL in the list, starting at 1. Each entry points to a different host.
data.durl[].stream_type / data.durl[].p2p_type / data.durl[].lengthStream type code, P2P type code and length value for each URL. In the sample, stream_type is 0, p2p_type is -1 and length is 0.
data.current_qnQuality number of the stream now being served. The sample returns 10000.
data.current_qualityCurrent quality level as a small integer. The sample returns 4.
data.accept_quality[]Quality levels the room accepts, returned as strings. The sample lists "4".
data.quality_description[].qnQuality number that matches a quality label.
data.quality_description[].descText label for the quality number. In the sample, 10000 is labeled 原画.
code / messageStatus of the call. code is 0 and message is OK on success.

Notes

  • Send room_id as a string, for example "1815229528".
  • The stream URLs contain an expires value in the query string, so fetch a fresh response before you play a stream.
  • To get room details such as title or host info, call Bilibili Live Room Details.
  • To browse live categories, call Bilibili Streaming Areas.

Pricing

$0.001 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.

探索更多

相关 APIs

全部 APIs
API价格响应
Bilibili$0.001 每次调用JSON
Bilibili$0.001 每次调用JSON
Bilibili$0.001 每次调用JSON
Bilibili$0.001 每次调用JSON
Bilibili$0.001 每次调用JSON
Bilibili$0.001 每次调用JSON

指南:Best Bilibili API in 2026: Pricing Compared

问题

常见问题

如何使用 Bilibili Room Stream Data API?

向 https://api.sandbase.ai/v1/api/bilibili/web/live-videos 发送 POST 请求,在 Authorization 请求头中使用您的 SandBase API key(Bearer),并将参数作为 JSON 请求体传入。您也可以直接在本页的 Playground 中试用,无需编写代码。

Bilibili Room Stream Data API 的价格是多少?

每次调用 $0.001,从您的 SandBase 余额中扣费。您只需为实际调用付费;无需订阅。

Bilibili Room Stream Data API 接受哪些参数?

必填:room_id (string)。 Parameters 表和本页的 Playground 列出了每个字段。

Bilibili Room Stream Data API 返回什么?

在同一个 HTTP 请求中返回的 JSON 响应(同步)。 本页的 README 包含一个示例响应。

我需要 Bilibili 开发者账户或 API key 吗?

不需要。Bilibili Room Stream Data 通过 SandBase 运行,因此一个 SandBase API key 即可覆盖此端点以及目录中的其他所有 API 和模型。您无需单独申请 Bilibili API 访问权限。