# Niconico API

> Videos, keyword and tag search and user profiles from Niconico's public pages.

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

One nicovideo.jp video: title, description, owner, counts, thumbnail and tags.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Video id such as sm9, or a nicovideo.jp watch URL. (e.g. sm9) |
| `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), `commentCount` (integer (int64)), `description` (string), `durationSeconds` (integer (int64)), `id` (string), `likeCount` (integer (int64)), `mylistCount` (integer (int64)), `publishedAt` (string), `tags` (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/niconico/video?id=sm9" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/niconico/search

Search nicovideo.jp videos by keyword; 32 per page.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `query` | string | yes | Keyword, such as 初音ミク. (e.g. 初音ミク) |
| `sort` | string | no | Order of the results, best first (newest first for newest). (one of popular, newest, views, comments, mylists; default popular) |
| `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), `commentCount` (integer (int64)), `description` (string), `durationSeconds` (integer (int64)), `id` (string), `likeCount` (integer (int64)), `mylistCount` (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/niconico/search?query=%E5%88%9D%E9%9F%B3%E3%83%9F%E3%82%AF" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/niconico/tagged

Videos of nicovideo.jp that carry a tag, 32 per page.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `tag` | string | yes | Tag as viewers see it, such as VOCALOID. (e.g. VOCALOID) |
| `sort` | string | no | Order of the results, best first (newest first for newest). (one of popular, newest, views, comments, mylists; default popular) |
| `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), `commentCount` (integer (int64)), `description` (string), `durationSeconds` (integer (int64)), `id` (string), `likeCount` (integer (int64)), `mylistCount` (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/niconico/tagged?tag=VOCALOID" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/niconico/user

A nicovideo.jp user's public profile: name, description and avatar.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Numeric user id such as 4, or a nicovideo.jp/user URL. (e.g. 4) |
| `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: `avatarUrl` (string), `bio` (string), `createdAt` (string), `followerCount` (integer (int64)), `followingCount` (integer (int64)), `id` (string), `name` (string), `postCount` (integer (int64)), `url` (string), `username` (string), `verified` (boolean)

```bash
curl "https://api.hoshime.com/v1/niconico/user?id=4" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
