# Wikisource API

> Returns Wikisource pages by search, with summaries, sections, page lists, categories and random pages.

Category: Search & Knowledge. Region: global. 6 endpoints at `https://api.hoshime.com/v1/wikisource/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/wikisource
## GET /v1/wikisource/search

Pages of Wikisource whose text matches a search, 10 per page.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `query` | string | yes | Words to search for, such as Hamlet. (e.g. Hamlet) |
| `lang` | string | no | Language code of the edition, such as en or de. (default en) |
| `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: `pageId` (string), `snippet` (string), `title` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/wikisource/search?query=Hamlet" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wikisource/summary

Short description and lead text of one Wikisource page.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `title` | string | yes | Page title, or a <lang>.wikisource.org/wiki/<title> URL. (e.g. Hamlet) |
| `lang` | string | no | Language code of the edition. A URL sets it. (default en) |
| `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: `description` (string), `extract` (string), `lang` (string), `pageId` (string), `title` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/wikisource/summary?title=Hamlet" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wikisource/sections

The sections of one Wikisource page, in reading order, with their level and anchor.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `title` | string | yes | Page title, or a <lang>.wikisource.org/wiki/<title> URL. (e.g. Hamlet) |
| `lang` | string | no | Language code of the edition. A URL sets it. (default en) |
| `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: `anchor` (string), `level` (integer (int64)), `number` (string), `title` (string)

```bash
curl "https://api.hoshime.com/v1/wikisource/sections?title=Hamlet" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wikisource/pages

Page titles of the main namespace in alphabetical order, 50 per page.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `lang` | string | no | Language code of the edition, such as en or de. (default en) |
| `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: `pageId` (string), `snippet` (string), `title` (string), `url` (string)

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

## GET /v1/wikisource/categories

The visible categories of one Wikisource page.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `title` | string | yes | Page title, or a <lang>.wikisource.org/wiki/<title> URL. (e.g. Hamlet) |
| `lang` | string | no | Language code of the edition. A URL sets it. (default en) |
| `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: `items` (Category[]), `items[].title` (string), `items[].url` (string), `title` (string)

```bash
curl "https://api.hoshime.com/v1/wikisource/categories?title=Hamlet" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wikisource/random

Random pages of the main namespace, 1 to 10 at a time. Each call returns new ones, so it is not cached.

Scope: `social:read` · Units: 1 · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `limit` | integer | no | Items per page, 1 to 10. (default 1) |
| `lang` | string | no | Language code of the edition, such as en or de. (default en) |
| `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: `pageId` (string), `snippet` (string), `title` (string), `url` (string)

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