YouTubeコミュニティ投稿API
POST
APIの稼働状況
- 24時間の稼働状況
- 正常
- 良好/正常
- 利用可能
正常
過去24時間
過去30日間
Page through the posts in a YouTube channel's Posts tab, newest first, from the channel link or @handle. Each post has text, likes, comment count, the time YouTube shows, and its attachment: images, a video, or poll options and total votes. 10 per page; pass next_page_token back as page_token for more.
POST https://api.everyinfra.com/api/v1/socialを送信し、platformにyoutube、actionにcommunity_postsを指定します。 料金は1,000リクエストあたり$0.56(1回あたり$0.000556)です。失敗した呼び出しと空の結果には課金されません。 同期処理です。時間のかかるジョブでは、ボディに"mode": "async"を追加し、job_idを取得してポーリングしてください。
AIプロンプト
#EveryInfraのYouTube コミュニティ投稿エンドポイント(youtube/community_posts)を使ったデータ収集スクリプトの作成を手伝ってください。
エンドポイントの仕組み:
- リクエスト:ヘッダーにAuthorization: Bearer <API key>を指定して、https://api.everyinfra.com/api/v1/socialにPOSTします。APIキーは環境変数EVERYINFRA_API_KEYから読み込み、ハードコードしないでください。
- リクエストボディでplatformにyoutube、actionにcommunity_postsを指定し、パラメータはparamsの中に入れます。
- 必須パラメータ:
- url: 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. Returns the posts in the channel's Posts tab, newest first.
- 任意パラメータ:
- page_token: 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. 10 posts per page.
- レコードのリストを返します。各レコードの主なフィールド: id、url、text、author_name、author_username、author_id、author_url、author_avatar_url、like_count、comment_count、published_text(Publish time as written on the YouTube…)、attachment_type(What the post carries: image (one image…)。フィールドは全部で18個です。一覧はhttps://api.everyinfra.com/api/v1/social/catalog?platform=youtubeを参照してください。.
- リクエストボディの例:
{
"platform": "youtube",
"action": "community_posts",
"params": {
"url": "https://www.youtube.com/@MrBeast"
}
}
- 料金:1,000リクエストあたり$0.56。失敗時および結果が空の場合は課金されません。
- 対象が数十〜数百件ある場合は、ボディに"mode": "async"を追加します。すぐにjob_idが返されるので、GET https://api.everyinfra.com/api/v1/jobs/{job_id}をポーリングして結果を取得します。
- 422の場合は、エラーに含まれる推奨パラメータ名と指定可能な値を使ってリクエストを修正します。429または503の場合は、Retry-Afterの指定に従って待ってから再試行します。
コードを書く前に、必要な対象とその件数、必要なフィールド、希望する出力形式を私に質問してください。そのうえで、計画と概算費用を私に確認してください。リクエストパラメータ
#| 名前 | 場所 | 型 | 必須 | デフォルト | 説明 |
|---|---|---|---|---|---|
Authorization | header | string | はい | - | Bearerの後にAPIキーを続けます。APIキーはコンソールで作成してください。URLやコードリポジトリには絶対に含めないでください。 |
platform | body | string | はい | youtube | プラットフォームの識別子です。値は固定です。 |
action | body | string | はい | community_posts | 機能の識別子です。値は固定です。 |
url | body.params | string | はい | - | 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. Returns the posts in the channel's Posts tab, newest first. |
page_token | body.params | string | いいえ | - | 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. 10 posts per page; each page is one call and limit has no effect. Tokens last 24 hours, and the last page has no next_page_token. |
コードサンプル
#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": "community_posts",
"params": {
"url": "https://www.youtube.com/@MrBeast"
}
}'OpenAPI定義(JSON)サンプルは環境変数EVERYINFRA_API_KEYからAPIキーを読み込みます。コピーしたコードにAPIキーが含まれることはありません。
レスポンス例
#November 21, 2026 at 07:24(UTC)に、上のコードサンプルのパラメータでこのAPIを呼び出して取得しました。resultsとcountはその呼び出しの実際のレスポンスから個人情報(名前、ハンドル、アバター、プロフィールリンク、連絡先)を削除したものです。リストは先頭の2件のみ掲載しています。id、billing、quotaは呼び出しごとに異なるため、構造のみを示しています。
json
{ "id": "req_…", "platform": "youtube", "action": "community_posts", "results": [ { "id": "UgkxIkDHJ9iW7XmjtMbke3Ud7rEiV5jSHDnR", "url": "https://www.youtube.com/post/UgkxIkDHJ9iW7XmjtMbke3Ud7rEiV5jSHDnR", "text": "Hunger Games In Real Life drops on Saturday!\nWe designed custom suits that detect when they’re hit by magnetic foam weapons 👀", "author_name": "MrBeast", "author_username": "MrBeast", "author_id": "•••", "author_url": "https://www.youtube.com/@MrBeast", "author_avatar_url": "https://yt3.googleusercontent.com/•••", "like_count": 307000, "comment_count": 6200, "published_text": "10 days ago", "attachment_type": "multi_image", "image_urls": [ "https://yt3.ggpht.com/-nihmRU8RGnrkkYNC73Y_eRRp03ReHeIdKSE8oqRy-HOu0dfZ-7Y5ND61lI9CS3Thlec0shis6WGXQ=s1400-c-fcrop64=1,00001000ffffefff-rw-nd-v1", "https://yt3.ggpht.com/g2LFXicy-wjSH-5pvMPnOnp0YHZXO0VaOzf8Y9yws0OFoH2yQjx_1abszLqWNv6f7BoJ3VnXmB6S=s1400-c-fcrop64=1,00001000ffffefff-rw-nd-v1" ], "platform": "youtube" }, { "id": "Ugkx2lkCYp85jak0n5z7-bq_4ug2Rntk9iWT", "url": "https://www.youtube.com/post/Ugkx2lkCYp85jak0n5z7-bq_4ug2Rntk9iWT", "text": "These last two videos are the best content we’ve ever made and somehow our next 3 uploads are even better. (The team is cooking) I’m feeling more excited and energized about our videos than ever before, new era of Beast coming up 🥰", "author_name": "MrBeast", "author_username": "MrBeast", "author_id": "•••", "author_url": "https://www.youtube.com/@MrBeast", "author_avatar_url": "https://yt3.googleusercontent.com/•••", "like_count": 175000, "comment_count": 5000, "published_text": "1 month ago", "attachment_type": "image", "image_urls": [ "https://yt3.ggpht.com/9davaq2roo2vRpZ80IIGBiCAy6CmeYfm17AkJbLofKYVreyWRk9Y3SF2tcHwTpdGSzRXym9Y_6096A=s988-c-fcrop64=1,00c60000ff39ffff-rw-nd-v1" ], "platform": "youtube" } ], "next_page_token": …, "pagination": { … }, "count": 10, "billing": { "charged": …, "charged_usd": …, "balance_after_usd": …, … }, "quota": { … }}
レスポンスフィールド
#業務データはresultsに含まれます。この表はレコードに含まれうるフィールドの一覧です。プラットフォームに表示されない値を作り出すことはありません。
| フィールド | 意味 |
|---|---|
id | プラットフォーム上でのレコードの一意なIDです。一意性は1つのプラットフォーム内に限られ、プラットフォームが異なるとIDが重複する場合があります。 |
url | プラットフォーム上のレコードへのリンクです。 |
text | HTMLを除去した本文です。省略されることなく全文が返されます(一部のプラットフォームでは一覧結果自体に抜粋しか含まれません。その場合は各プラットフォームのフィールドの注記に記載しています)。 |
author_name | 投稿者の表示名です。 |
author_username | 投稿者のユーザー名(@ハンドル)で、通常はURLに使用できます。 |
author_id | プラットフォーム上での投稿者の一意なIDです。 |
author_url | プラットフォーム上の投稿者プロフィールへのリンクです。 |
author_avatar_url | プラットフォーム上の意味のまま |
like_count | いいね数です。nullはプラットフォームまたはこの機能が公開していないことを示し、0ではありません。 |
comment_count | コメント数です。nullは非公開を示し、0ではありません。 |
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. |
attachment_type | What the post carries: image (one image), multi_image (several images), video or poll; null for text-only posts. |
image_urls | 画像リンクの配列で、プラットフォームでの表示順に並びます。画像がない場合は含まれません。 |
video_id | ID of the video it belongs to; null for replies to a channel post comment. On channel posts, the ID of the video attached to the post, or null if none is attached. |
video_title | Title of the video attached to the post; null if no video is attached. |
poll_options | Poll options, as an array of strings; an empty array if the post is not a poll. |
poll_total_votes | Total votes on the poll, as an integer. YouTube shows an approximate count, so 1.8M is returned as 1800000; null if the post is not a poll. |
links | Links in the post text, as an array. |
platform | 取得元プラットフォームの識別子で、リクエストのplatformと同じです(例:xiaohongshu、tiktok)。 |
エラーと課金
#- 401
- キーが未指定か無効です。
- 402
- 残高が不足しています。先にチャージしてください。
- 422
- パラメータ名または値が無効です。エラーに含まれる候補を参考に修正してください。課金はされません。
- 429
- 1分あたりのリクエスト上限に達しました。Retry-Afterの指定に従って待ってから再試行してください。
- 503
- 処理を完了できませんでした。保留中の請求額は残高に戻されます。結果が不明な場合は、再試行する前に確認してください。
- 200(空)
- データがありません。課金はされません。