# Get Videos — Twitch

> Gets video information by video ID, user ID, or game ID. See the documentation

- Key: `twitch-get-videos`
- Type: Action (Read-only)
- Version: 0.2.1
- App: Twitch (`twitch`) — https://pipedream.com/apps/twitch.md
- This page (HTML): https://pipedream.com/apps/twitch/actions/get-videos
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/twitch/actions/get-videos/get-videos.mjs

## Description

Gets video information by video ID, user ID, or game ID. [See the documentation](https://dev.twitch.tv/docs/api/reference/#get-videos)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | No | ID of the video being queried. If this is specified, you cannot use any of the optional query parameters below. Each request must specify one video id, one user_id, or one game_id. |
| `userId` | `string` | No | The Twitch user whose videos to retrieve. Accepts a numeric user ID (e.g. 141981764) or login name (e.g. twitchdev). Each request must specify one video ID, user ID, or game ID. Options are loaded from the connected account. |
| `gameId` | `string` | No | ID of the game the video is of. Each request must specify one video id, one user_id, or one game_id. |
| `language` | `string` | No | Language of the video being queried. A language value must be either the ISO 639-1 two-letter code for a supported stream language or “other”. |
| `period` | `string` | No | Period during which the video was created. Defaults to “all” if left blank |
| `sort` | `string` | No | Sort order of the videos. Defaults to “time” if left blank |
| `type` | `string` | No | Type of video. Defaults to “all” if left blank |
| `max` | `integer` | Yes | Maximum number of videos to return |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "twitch",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "twitch-get-videos",
  arguments: {
    id: "Video ID",
    userId: "User",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "twitch-get-videos",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    twitch: { authProvisionId: "apn_xxxxxxx" },
    id: "Video ID",
    userId: "User",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "twitch-get-videos",
    "configured_props": {
      "twitch": { "authProvisionId": "apn_xxxxxxx" },
      "id": "Video ID",
      "userId": "User"
    }
  }'
```

---

- App: https://pipedream.com/apps/twitch.md · All apps: https://pipedream.com/apps
