# Bilibili API

> Returns bilibili popular videos, search suggestions, video details, parts, streams and related videos.

Category: Social & Video. Region: CN. 13 endpoints at `https://api.hoshime.com/v1/bilibili/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/bilibili
## GET /v1/bilibili/popular

The videos bilibili.com ranks as popular now.

Scope: `social:read` · Units: 1 · Cached: 10 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `limit` | integer | no | Items per page, 1 to 50. (default 20) |
| `cursor` | string | no | meta.pagination.nextCursor of the previous page. Omit it for the first page. |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `bvid` (string), `commentCount` (integer (int64)), `description` (string), `durationSeconds` (integer (int64)), `id` (string), `likeCount` (integer (int64)), `publishedAt` (string), `thumbnails` (Image[]), `thumbnails[].height` (any), `thumbnails[].url` (string), `thumbnails[].width` (any), `title` (string), `url` (string), `viewCount` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/bilibili/popular" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bilibili/suggest

Search suggestions bilibili.com offers for a term.

Scope: `social:read` · Units: 1 · Cached: 30 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `query` | string | yes | Partial search text, such as lin. (e.g. linux) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `term` (string)

```bash
curl "https://api.hoshime.com/v1/bilibili/suggest?query=linux" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bilibili/pages

The parts of a bilibili.com video: each part's page number, cid, title and duration.

Scope: `social:read` · Units: 1 · Cached: 10 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `video` | string | yes | BV id or bilibili.com/video/BV… URL. (e.g. BV1GJ411x7h7) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `bvid` (string), `items` (Part[]), `items[].cid` (string), `items[].duration` (integer (int64)), `items[].page` (integer (int64)), `items[].title` (string)

```bash
curl "https://api.hoshime.com/v1/bilibili/pages?video=BV1GJ411x7h7" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bilibili/streams

The MP4 streams of one part of a bilibili.com video, with the qualities the player offers without a login.

Scope: `social:read` · Units: 1 · Cached: 5 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `video` | string | yes | BV id or bilibili.com/video/BV… URL. (e.g. BV1GJ411x7h7) |
| `part` | integer | no | Part number, from 1 for a video with one part. (default 1) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `bvid` (string), `cid` (string), `page` (integer (int64)), `qualities` (Rendition[]), `qualities[].description` (string), `qualities[].quality` (integer (int64)), `quality` (string), `segments` (Segment[]), `segments[].length` (integer (int64)), `segments[].order` (integer (int64)), `segments[].size` (integer (int64)), `segments[].url` (string), `title` (string)

```bash
curl "https://api.hoshime.com/v1/bilibili/streams?video=BV1GJ411x7h7" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bilibili/video

One bilibili.com video by its BV id: title, description, uploader, duration, counters and cover.

Scope: `social:read` · Units: 1 · Cached: 10 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `video` | string | yes | BV id or bilibili.com/video/BV… URL. (e.g. BV1NZ4y1j7nw) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `bvid` (string), `commentCount` (integer (int64)), `description` (string), `durationSeconds` (integer (int64)), `id` (string), `likeCount` (integer (int64)), `publishedAt` (string), `thumbnails` (Image[]), `thumbnails[].height` (any), `thumbnails[].url` (string), `thumbnails[].width` (any), `title` (string), `url` (string), `viewCount` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/bilibili/video?video=BV1NZ4y1j7nw" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bilibili/related

Videos bilibili.com suggests next to one video.

Scope: `social:read` · Units: 1 · Cached: 10 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `video` | string | yes | BV id or bilibili.com/video/BV… URL. (e.g. BV1GJ411x7h7) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `bvid` (string), `commentCount` (integer (int64)), `description` (string), `durationSeconds` (integer (int64)), `id` (string), `likeCount` (integer (int64)), `publishedAt` (string), `thumbnails` (Image[]), `thumbnails[].height` (any), `thumbnails[].url` (string), `thumbnails[].width` (any), `title` (string), `url` (string), `viewCount` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/bilibili/related?video=BV1GJ411x7h7" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bilibili/tags

The tags a video carries, as bilibili.com shows them under it.

Scope: `social:read` · Units: 1 · Cached: 10 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `video` | string | yes | BV id or bilibili.com/video/BV… URL. (e.g. BV1GJ411x7h7) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `id` (string), `likes` (integer (int64)), `name` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/bilibili/tags?video=BV1GJ411x7h7" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bilibili/comments

Top comments of one video by its aid, with replies counted, 20 per page.

Scope: `social:read` · Units: 1 · Cached: 10 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `aid` | integer | yes | Video aid, the number bilibili.com shows as av<aid>. (e.g. 2) |
| `cursor` | string | no | meta.pagination.nextCursor of the previous page. Omit it for the first page. |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `createdAt` (string), `id` (string), `likeCount` (integer (int64)), `replyCount` (integer (int64)), `text` (string)

```bash
curl "https://api.hoshime.com/v1/bilibili/comments?aid=2" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bilibili/commentReplies

Replies to one top comment of a bilibili.com video, by its aid and comment id, 20 per page.

Scope: `social:read` · Units: 1 · Cached: 10 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `aid` | integer | yes | Video aid, the number bilibili.com shows as av<aid>. (e.g. 2) |
| `root` | integer | yes | Id of the top comment, from bilibili/comments. (e.g. 495059) |
| `cursor` | string | no | meta.pagination.nextCursor of the previous page. Omit it for the first page. |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `createdAt` (string), `id` (string), `likeCount` (integer (int64)), `replyCount` (integer (int64)), `text` (string)

```bash
curl "https://api.hoshime.com/v1/bilibili/commentReplies?aid=2&root=495059" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bilibili/danmaku

Bullet comments (danmaku) of one bilibili.com video part by its cid, with the second each one shows at. Get the cid from bilibili/pages.

Scope: `social:read` · Units: 1 · Cached: 10 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `cid` | integer | yes | Part cid, from bilibili/pages. (e.g. 137649199) |
| `limit` | integer | no | Items per page, 1 to 1000. (default 100) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `sentAt` (string), `text` (string), `timeSeconds` (number (double))

```bash
curl "https://api.hoshime.com/v1/bilibili/danmaku?cid=137649199" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bilibili/ranking

The videos bilibili.com ranks highest in one category over the last 1, 3 or 7 days.

Scope: `social:read` · Units: 1 · Cached: 10 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `rid` | integer | no | Category id, such as 1 for animation or 3 for music. (default 1; e.g. 1) |
| `day` | integer | no | Days the ranking covers: 1, 3 or 7. (default 3; e.g. 3) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `bvid` (string), `coins` (integer (int64)), `commentCount` (integer (int64)), `description` (string), `durationSeconds` (integer (int64)), `favorites` (integer (int64)), `id` (string), `likeCount` (integer (int64)), `publishedAt` (string), `rank` (integer (int64)), `thumbnails` (Image[]), `thumbnails[].height` (any), `thumbnails[].url` (string), `thumbnails[].width` (any), `title` (string), `url` (string), `viewCount` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/bilibili/ranking?rid=1&day=3" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bilibili/liveRoom

Title, status, viewers and category of one bilibili.com live room.

Scope: `social:read` · Units: 1 · Cached: 2 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | integer | yes | Live room id, the number in live.bilibili.com/<id>. (e.g. 23058) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `area` (string), `cover` (string), `description` (string), `id` (string), `keyframe` (string), `online` (integer (int64)), `startedAt` (string), `status` (string), `tags` (Tag[]), `tags[].id` (string), `tags[].likes` (integer (int64)), `tags[].name` (string), `tags[].url` (string), `title` (string), `uid` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/bilibili/liveRoom?id=23058" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bilibili/user

Profile of one bilibili.com account: name, sign, level, follower and following counts, and its video count.

Scope: `social:read` · Units: 1 · Cached: 10 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `mid` | integer | yes | Account id (mid), the number in space.bilibili.com/<mid>. (e.g. 2) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `articleCount` (integer (int64)), `avatar` (string), `followers` (integer (int64)), `following` (integer (int64)), `id` (string), `level` (integer (int64)), `likes` (integer (int64)), `name` (string), `official` (string), `registeredAt` (string), `sign` (string), `url` (string), `videoCount` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/bilibili/user?mid=2" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
