# YouTube

> Search and explore videos, channels, playlists, and comments on YouTube.

App · Video & Audio · 7 actions. Web page: https://docs.lodol.com/docs/integrations/youtube

## Actions

### Get channel details

Look up a channel's name, description, subscriber count, and view count.

**Inputs**

- Channel ID (`channel_id`, text, required): The ID of the channel to look up.

**Outputs**

- `channel_id` (text): YouTube channel ID (24-character string starting with 'UC')
- `description` (text): Channel description/about text
- `related_playlists` (object): Object containing special playlist IDs like 'uploads' (all channel videos). Use uploads playlist ID with youtube_playlist_items action
- `status` (text): Action execution status
- `subscriber_count` (number): Number of subscribers to this channel. Use for popularity metrics or filtering
- `title` (text): Channel name/title as displayed on YouTube
- `video_count` (number): Total number of public videos uploaded by this channel
- `view_count` (number): Total view count across all videos on this channel

**Example output**

```json
{
  "channel_id": {
    "id": "abc123",
    "name": "Sample"
  },
  "description": "Sample text content",
  "related_playlists": "example_value",
  "subscriber_count": 1,
  "title": "Sample Item",
  "video_count": 1,
  "view_count": 1
}
```

### Get video details

Look up a video's title, description, view count, likes, and length.

**Inputs**

- Video ID (`video_id`, text, required): The ID of the YouTube video to look up.

**Outputs**

- `comment_count` (number): Total number of comments on the video
- `description` (text): Full video description text (may contain links and formatting)
- `duration` (text): Video duration in ISO 8601 format
- `like_count` (number): Number of likes on the video. Use for engagement metrics
- `status` (text): Action execution status
- `title` (text): Video title as displayed on YouTube
- `video_id` (text): YouTube video ID (11-character string, e.g., 'dQw4w9WgXcQ')
- `view_count` (number): Total number of views this video has received. Use for popularity metrics or sorting

**Example output**

```json
{
  "comment_count": 1,
  "description": "Sample text content",
  "duration": "PT4M33S",
  "like_count": 1,
  "title": "Sample Item",
  "video_id": {
    "id": "abc123",
    "name": "Sample"
  },
  "view_count": 1
}
```

### List channel playlists

List playlists for a YouTube channel.

**Inputs**

- Channel ID (`channel_id`, text, required): Channel ID to list playlists for
- Max results (`max_results`, number): Maximum number of playlists to return

**Outputs**

- `items` (list): Array of playlists for the specified channel. Each playlist contains playlist_id (use with youtube_playlist_items), title, description, and item_count (video count)
- `next_page_token` (text): Pagination token for fetching the next page of playlists. Null if no more results
- `status` (text): Action execution status

**Example output**

```json
{
  "items": [
    {
      "description": "Sample text content",
      "item_count": 1,
      "playlist_id": "PLabc123xyz456",
      "title": "Sample Item"
    }
  ],
  "next_page_token": "example_value",
  "status": "success"
}
```

### List trending videos

List the trending videos in a country.

**Inputs**

- Country code (`region_code`, text): Two-letter country code for the trending list, for example US or GB.
- Max results (`max_results`, number): Maximum number of trending videos to return

**Outputs**

- `items` (list): Array of trending videos for the specified region. Each video contains video_id (use for details), title, channel info (id/title), view_count, and published_at timestamp. Use for discovering popular content
- `next_page_token` (text): Pagination token for fetching the next page of trending videos. Null if no more results
- `status` (text): Action execution status

**Example output**

```json
{
  "items": [
    {
      "channel_id": "UCaBc123XyZ456",
      "channel_title": "Sample Item",
      "published_at": "2024-01-15T10:30:00Z",
      "title": "Sample Item",
      "video_id": "dQw4w9WgXcQ",
      "view_count": 1
    }
  ],
  "next_page_token": "example_value",
  "status": "success"
}
```

### List video comments

List the main comments on a video, not the replies.

**Inputs**

- Video ID (`video_id`, text, required): The ID of the video to read comments from.
- Max results (`max_results`, number): Maximum number of comments to return

**Outputs**

- `items` (list): Array of top-level comment threads for the video. Each thread contains comment_id, author name, text content, like_count, published_at timestamp, and reply_count. Use for sentiment analysis or displaying user feedback
- `next_page_token` (text): Pagination token for fetching the next page of comments. Null if no more results
- `status` (text): Action execution status

**Example output**

```json
{
  "items": [
    {
      "author": "John Doe",
      "comment_id": "Ugxabc123xyz",
      "like_count": 1,
      "published_at": "2024-01-15T10:30:00Z",
      "reply_count": 0,
      "text": "Sample text content"
    }
  ],
  "next_page_token": "example_value",
  "status": "success"
}
```

### List videos in a playlist

List the videos in a YouTube playlist.

**Inputs**

- Playlist ID (`playlist_id`, text, required): The ID of the playlist to list videos from.
- Max results (`max_results`, number): Maximum number of videos to return

**Outputs**

- `items` (list): Array of videos in the playlist. Each item contains video_id (use for details/comments), title, description, channel_title, and position (order in playlist)
- `next_page_token` (text): Pagination token for fetching the next page of playlist items. Null if no more results
- `status` (text): Action execution status

**Example output**

```json
{
  "items": [
    {
      "channel_title": "Sample Item",
      "description": "Sample text content",
      "position": 0,
      "title": "Sample Item",
      "video_id": "dQw4w9WgXcQ"
    }
  ],
  "next_page_token": "example_value",
  "status": "success"
}
```

### Search for videos

Search YouTube for videos that match your keywords.

**Inputs**

- Search terms (`query`, text, required): Keywords to search for on YouTube.
- Max results (`max_results`, number): Maximum number of videos to return
- Sort order (`order`, text): How to sort the results, for example by relevance or date.

**Outputs**

- `items` (list): Array of video search results. Each item contains video_id (use for details/comments), title, description snippet, channel info (id/title), and published_at timestamp. Use video_id with youtube_video_details for full metadata
- `next_page_token` (text): Pagination token for fetching the next page of results. Pass this as pageToken parameter to continue listing. Null if no more results
- `status` (text): Action execution status

**Example output**

```json
{
  "items": [
    {
      "channel_id": "UCaBc123XyZ456",
      "channel_title": "Sample Item",
      "description": "Sample text content",
      "published_at": "2024-01-15T10:30:00Z",
      "title": "Sample Item",
      "video_id": "dQw4w9WgXcQ"
    }
  ],
  "next_page_token": "example_value",
  "status": "success"
}
```
