Reddit動画投稿の文字起こしAPI

POST

APIの稼働状況

24時間の稼働状況
正常
  • 良好/正常
  • 利用可能
正常

過去24時間

過去30日間

Read the captions Reddit provides for a video post hosted on Reddit, from the post link in url: text for the full text and segments sentence by sentence with start and end seconds. It reads captions only and does not transcribe speech. A post with no captions, or a caption file that could not be read this time, returns 503 and is not charged.

POST https://api.everyinfra.com/api/v1/socialを送信し、platformにreddit、actionにpost_transcriptを指定します。 料金は1,000リクエストあたり$0.79(1回あたり$0.000792)です。失敗した呼び出しと空の結果には課金されません。 同期処理です。時間のかかるジョブでは、ボディに"mode": "async"を追加し、job_idを取得してポーリングしてください。

AIプロンプト

#
EveryInfraのReddit 動画投稿の文字起こしエンドポイント(reddit/post_transcript)を使ったデータ収集スクリプトの作成を手伝ってください。

エンドポイントの仕組み:
- リクエスト:ヘッダーにAuthorization: Bearer <API key>を指定して、https://api.everyinfra.com/api/v1/socialにPOSTします。APIキーは環境変数EVERYINFRA_API_KEYから読み込み、ハードコードしないでください。
- リクエストボディでplatformにreddit、actionにpost_transcriptを指定し、パラメータはparamsの中に入れます。
- 必須パラメータ:
  - url: The link of a video post hosted on Reddit. It returns the captions Reddit provides for the video and does not transcribe speech. A link that is not recognized returns 422 and is not charged.
- 1つのオブジェクトを返します。主なフィールド: post_id(コメントが付けられた投稿のID(user_comments))、url、title、media_type(Type of the post (post_transcript))、has_transcript(Whether the post has captions (post_tra…)、reason(Why there are no captions (post_transcr…)、source(Source of the captions (post_transcript…)、language、text、segment_count(Number of entries in segments (post_tra…)、segments(The captions sentence by sentence (post…)、caption_url(Link to the caption file (post_transcri…)。フィールドは全部で14個です。一覧はhttps://api.everyinfra.com/api/v1/social/catalog?platform=redditを参照してください。.
- リクエストボディの例:
{
  "platform": "reddit",
  "action": "post_transcript",
  "params": {
    "url": "https://www.reddit.com/r/TikTokCringe/comments/1y4o37g/road_rage_between_bmw_and_cyclists/"
  }
}
- 料金:1,000リクエストあたり$0.79。失敗時および結果が空の場合は課金されません。
- 対象が数十〜数百件ある場合は、ボディに"mode": "async"を追加します。すぐにjob_idが返されるので、GET https://api.everyinfra.com/api/v1/jobs/{job_id}をポーリングして結果を取得します。
- 422の場合は、エラーに含まれる推奨パラメータ名と指定可能な値を使ってリクエストを修正します。429または503の場合は、Retry-Afterの指定に従って待ってから再試行します。

コードを書く前に、必要な対象とその件数、必要なフィールド、希望する出力形式を私に質問してください。そのうえで、計画と概算費用を私に確認してください。

リクエストパラメータ

#
名前場所型必須デフォルト説明
Authorizationheaderstringはい-Bearerの後にAPIキーを続けます。APIキーはコンソールで作成してください。URLやコードリポジトリには絶対に含めないでください。
platformbodystringはいredditプラットフォームの識別子です。値は固定です。
actionbodystringはいpost_transcript機能の識別子です。値は固定です。
urlbody.paramsstringはい-The link of a video post hosted on Reddit. It returns the captions Reddit provides for the video and does not transcribe speech. A link that is not recognized returns 422 and is not charged; a post without captions returns 503 and is not charged.

コードサンプル

#
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": "reddit",
  "action": "post_transcript",
  "params": {
    "url": "https://www.reddit.com/r/TikTokCringe/comments/1y4o37g/road_rage_between_bmw_and_cyclists/"
  }
}'

OpenAPI定義(JSON)サンプルは環境変数EVERYINFRA_API_KEYからAPIキーを読み込みます。コピーしたコードにAPIキーが含まれることはありません。

レスポンス例

#
このパラメータのサンプルレスポンスはまだありません。このプレビューはAPI定義に基づくレスポンスの構造とフィールドを示したもので、値は…で表しています。実際の呼び出し結果ではありません。
json
{  "id": "req_…",  "platform": "reddit",  "action": "post_transcript",  "results": {    "post_id": …,    "url": …,    "title": …,    "media_type": …,    "has_transcript": …,    "reason": …,    "source": …,    "language": …,    "text": …,    "segment_count": …,    "segments": …,    "caption_url": …,    "duration_sec": …,    "duration_seconds": …,    "platform": …  },  "billing": {    "charged": …,    "charged_usd": …,    "balance_after_usd": …,    …  },  "quota": { … }}

レスポンスフィールド

#

業務データはresultsに含まれます。この表はレコードに含まれうるフィールドの一覧です。プラットフォームに表示されない値を作り出すことはありません。

フィールド意味
post_idコメントが付けられた投稿のID(user_comments)。
urlプラットフォーム上のレコードへのリンクです。
titleタイトルです。プラットフォームにタイトルがない場合(テキストのみの投稿など)はnullになります。
media_typeType of the post (post_transcript).
has_transcriptWhether the post has captions (post_transcript); when it is false, reason says why.
reasonWhy there are no captions (post_transcript): no_caption (a video without captions), not_video (no video in the post) or external_video (the video is on another site).
sourceSource of the captions (post_transcript).
languageプラットフォームが判定したコンテンツの言語コードです(例:zh、en)。誤っている場合があります。
textHTMLを除去した本文です。省略されることなく全文が返されます(一部のプラットフォームでは一覧結果自体に抜粋しか含まれません。その場合は各プラットフォームのフィールドの注記に記載しています)。
segment_countNumber of entries in segments (post_transcript).
segmentsThe captions sentence by sentence (post_transcript): [{start_sec, end_sec, duration_sec, text}], with start_sec, end_sec and duration_sec in seconds and text the sentence.
caption_urlLink to the caption file (post_transcript); it may stop working.
duration_secLength of the video in seconds (post_transcript).
duration_seconds再生時間(秒)です。動画または音声ではないコンテンツの場合はnullです。
platform取得元プラットフォームの識別子で、リクエストのplatformと同じです(例:xiaohongshu、tiktok)。

エラーと課金

#
401
キーが未指定か無効です。
402
残高が不足しています。先にチャージしてください。
422
パラメータ名または値が無効です。エラーに含まれる候補を参考に修正してください。課金はされません。
429
1分あたりのリクエスト上限に達しました。Retry-Afterの指定に従って待ってから再試行してください。
503
処理を完了できませんでした。保留中の請求額は残高に戻されます。結果が不明な場合は、再試行する前に確認してください。
200(空)
データがありません。課金はされません。

エラー

Google Analyticsは同意が必要 プライバシー