# YouTube Search in channel API (youtube.search_in_channel)

- Canonical page: [https://everyinfra.com/en/youtube-api/search_in_channel](https://everyinfra.com/en/youtube-api/search_in_channel?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "youtube", "action": "search_in_channel", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, one page of up to 30 per call; the number of rows varies from page to page and a short page is not the end (limit is ignored; pass the top-level next_page_token from the response as page_token for the next page; no next_page_token means the end)
- Pagination: pass next_page_token back as page_token for the next page, other params unchanged; one call per page, tokens last 24 hours
- Mode: sync; add "mode": "async" for slow tasks

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=youtube&action=search_in_channel

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | A YouTube channel link (`https://www.youtube.com/@NASA` or `https://www.youtube.com/channel/UC…`), an @handle, or a channel ID that starts with UC. Only this channel is searched. |
| keyword | not declared | yes | not declared | Search words, up to 200 characters. Results mix videos, Shorts and playlists; check each row's `type`. |
| page_token | not declared | no | not declared | Page token. Leave it out for the first page, then pass back the previous response's `next_page_token` exactly as received, with the other parameters unchanged. About 30 rows per page, as YouTube sends them; each page is one call and `limit` has no effect. Tokens last 24 hours, and the last page has no `next_page_token`. |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| type | Record type; values depend on the capability (for example video / image / text). |
| id | The record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms. |
| url | Link to the record on the platform. |
| title | Title. null when the platform has no titles (for example text-only posts). |
| text | Body text with HTML removed, returned in full and never cut short (on a few platforms the list results themselves carry only an excerpt; the platform's field notes say so). |
| author_name | Author's display name. |
| author_username | Author's username (@handle), usually usable in URLs. |
| author_id | Author's unique ID on the platform. |
| author_url | Link to the author's profile on the platform. |
| author_avatar_url | platform-native meaning |
| author_is_verified | Whether the channel has a verified badge. |
| view_count | Views or plays. null means not disclosed, not 0. |
| duration | platform-native meaning |
| published_text | Publish time as written on the YouTube page, in relative form (e.g. `2 years ago`), returned as is; null when the page shows none. |
| thumbnail_url | Thumbnail link, lower resolution than image_url. |
| badges | Badges shown on the video, as an array of strings (e.g. `4K`, `CC`, `New`); an empty array when there are none. |
| is_live | Whether the video is live now. |
| is_upcoming | Whether it is a premiere or scheduled live stream that has not started yet. |
| playlist_id | ID of the playlist or mix when the row is one; otherwise null. |
| video_count | platform-native meaning |
| platform | Source platform identifier, the same as platform in the request (for example xiaohongshu, tiktok). |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "youtube",
  "action": "search_in_channel",
  "params": {
    "url": "https://www.youtube.com/@NASA",
    "keyword": "moon"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "youtube",
        "action": "search_in_channel",
        "params": {
            "url": "https://www.youtube.com/@NASA",
            "keyword": "moon",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-11-21T07:24:23Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed; the list keeps the first 2 of 30. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "youtube",
  "action": "search_in_channel",
  "results": [
    {
      "type": "video",
      "id": "IfRqrrBbT-Y",
      "url": "https://www.youtube.com/watch?v=IfRqrrBbT-Y",
      "title": "Artemis II Moon Mission Complete!",
      "text": "Our Artemis II Moon mission is complete!\nSpace Launch System rocket launched crew into space\nOrion spacecraft  provided a safe “home away from home” for astronauts\nFlew around the Moon,...",
      "author_name": "NASA",
      "author_username": "NASA",
      "author_id": "•••",
      "author_url": "https://www.youtube.com/@NASA",
      "author_avatar_url": "https://yt3.googleusercontent.com/•••",
      "author_is_verified": true,
      "view_count": 987902,
      "duration": "00:03:33",
      "published_text": "7 months ago",
      "thumbnail_url": "https://i.ytimg.com/vi/IfRqrrBbT-Y/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLB1B1sNNE_AOGy5LPLeaDP38ZN80A",
      "badges": [
        "CC"
      ],
      "platform": "youtube"
    },
    {
      "type": "video",
      "id": "Vg-EQ7MOu6I",
      "url": "https://www.youtube.com/watch?v=Vg-EQ7MOu6I",
      "title": "Around the Moon for All Humanity: Artemis II (Official Launch Trailer)",
      "text": "Action. Wonder. Adventure. Artemis II has got it all. Don't miss the moment. Our crewed Moon mission will launch as early as April 1.\n\nUnder Artemis, NASA will send astronauts on increasingly...",
      "author_name": "NASA",
      "author_username": "NASA",
      "author_id": "•••",
      "author_url": "https://www.youtube.com/@NASA",
      "author_avatar_url": "https://yt3.googleusercontent.com/•••",
      "author_is_verified": true,
      "view_count": 1650126,
      "duration": "00:01:16",
      "published_text": "7 months ago",
      "thumbnail_url": "https://i.ytimg.com/vi/Vg-EQ7MOu6I/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAwlAQUzbi1WhsHnEROLKj3nvYryA",
      "badges": [
        "CC"
      ],
      "platform": "youtube"
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": 30,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=youtube
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
