Reddit詳細API
APIの稼働状況
- 24時間の稼働状況
- 正常
- 良好/正常
- 利用可能
過去24時間
過去30日間
1人のRedditユーザーのプロフィールを単一のオブジェクトとして取得します。usernameは必須で、spez、u/spez、またはプロフィールのリンクを、1回の呼び出しにつき1ユーザー指定します。フィールドは、user_id(t2_で始まります)、username、display_name、url、bio、avatar_url、banner_url、karma(合計)、post_karma、comment_karma、post_count、comment_count(どちらの件数もRedditが約24時間ごとに更新し、リクエストによっては返らないことがあります)、created_at(登録日で、精度は日単位です)、is_premium、is_admin(Redditスタッフのアカウント)、is_nsfw、content_hidden、trophy_count、achievement_count、moderated_communitiesです。content_hiddenがtrueの場合、user_posts、user_comments、user_subredditsは空の結果を返します。Redditはフォロワー数を表示しないため、フォロワー数はありません。存在しない、または禁止されたユーザーを指定すると空の結果が返ります。
POST https://api.everyinfra.com/api/v1/socialを送信し、platformにreddit、actionにprofileを指定します。 料金は1,000リクエストあたり$0.79(1回あたり$0.000792)です。失敗した呼び出しと空の結果には課金されません。 同期処理です。時間のかかるジョブでは、ボディに"mode": "async"を追加し、job_idを取得してポーリングしてください。
AIプロンプト
#EveryInfraのReddit 詳細エンドポイント(reddit/profile)を使ったデータ収集スクリプトの作成を手伝ってください。
エンドポイントの仕組み:
- リクエスト:ヘッダーにAuthorization: Bearer <API key>を指定して、https://api.everyinfra.com/api/v1/socialにPOSTします。APIキーは環境変数EVERYINFRA_API_KEYから読み込み、ハードコードしないでください。
- リクエストボディでplatformにreddit、actionにprofileを指定し、パラメータはparamsの中に入れます。
- 必須パラメータ:
- username: One Reddit user: spez, u/spez or a profile link. One user per call.
- 1つのオブジェクトを返します。主なフィールド: user_id、username、display_name、url、bio、avatar_url、banner_url(Image URL of the banner on the communit…)、karma(The user's total karma (profile))、post_karma(Karma the user earned from posts (profi…)、comment_karma(Karma the user earned from comments (pr…)、post_count、comment_count。フィールドは全部で20個です。一覧はhttps://api.everyinfra.com/api/v1/social/catalog?platform=redditを参照してください。.
- リクエストボディの例:
{
"platform": "reddit",
"action": "profile",
"params": {
"username": "spez"
}
}
- 料金:1,000リクエストあたり$0.79。失敗時および結果が空の場合は課金されません。
- 対象が数十〜数百件ある場合は、ボディに"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 | はい | reddit | プラットフォームの識別子です。値は固定です。 |
action | body | string | はい | profile | 機能の識別子です。値は固定です。 |
username | body.params | string | はい | - | One Reddit user: spez, u/spez or a profile link. One user per call. |
コードサンプル
#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": "profile",
"params": {
"username": "spez"
}
}'OpenAPI定義(JSON)サンプルは環境変数EVERYINFRA_API_KEYからAPIキーを読み込みます。コピーしたコードにAPIキーが含まれることはありません。
レスポンス例
#{ "id": "req_…", "platform": "reddit", "action": "profile", "results": { "user_id": …, "username": …, "display_name": …, "url": …, "bio": …, "avatar_url": …, "banner_url": …, "karma": …, "post_karma": …, "comment_karma": …, "post_count": …, "comment_count": …, "created_at": …, "is_premium": …, "is_admin": …, "is_nsfw": …, "content_hidden": …, "trophy_count": …, "achievement_count": …, "moderated_communities": …, "platform": … }, "billing": { "charged": …, "charged_usd": …, "balance_after_usd": …, … }, "quota": { … }}
レスポンスフィールド
#業務データはresultsに含まれます。この表はレコードに含まれうるフィールドの一覧です。プラットフォームに表示されない値を作り出すことはありません。
| フィールド | 意味 |
|---|---|
user_id | プラットフォーム上でのユーザーの一意なIDです。 |
username | ユーザー名(@ハンドル)です。 |
display_name | 表示名です。usernameとは異なる場合があります。 |
url | プラットフォーム上のレコードへのリンクです。 |
bio | アカウント自身が記載したプロフィール文です。改行や絵文字を含む場合があります。 |
avatar_url | アバター画像のリンクです。一部のプラットフォームでは、サイズ指定付きで有効期限が切れる可能性のあるCDNリンクが返されます。 |
banner_url | Image URL of the banner on the community page (subreddit_info, subreddit_rules) or on the user's profile (profile). |
karma | The user's total karma (profile); post_karma and comment_karma give the parts earned from posts and from comments. |
post_karma | Karma the user earned from posts (profile). |
comment_karma | Karma the user earned from comments (profile). |
post_count | 総投稿数です。nullは0ではなく、非公開であることを示します。 |
comment_count | コメント数です。nullは非公開を示し、0ではありません。 |
created_at | 作成日時です。形式はposted_atと同じです。 |
is_premium | Whether the user has Reddit Premium (profile). |
is_admin | Whether the account belongs to Reddit staff (profile). |
is_nsfw | Whether the community (search_suggest) or the user (profile) is marked NSFW. |
content_hidden | Whether the user has hidden their posts and comments (profile). When true, user_posts, user_comments and user_subreddits return empty results. |
trophy_count | How many older trophies the user has in the Trophy Case on their profile (profile). |
achievement_count | How many achievements the user has unlocked (profile). The list is in user_trophies. |
moderated_communities | Names of the communities the user moderates, without the r/ prefix (profile): an array. |
platform | 取得元プラットフォームの識別子で、リクエストのplatformと同じです(例:xiaohongshu、tiktok)。 |
エラーと課金
#- 401
- キーが未指定か無効です。
- 402
- 残高が不足しています。先にチャージしてください。
- 422
- パラメータ名または値が無効です。エラーに含まれる候補を参考に修正してください。課金はされません。
- 429
- 1分あたりのリクエスト上限に達しました。Retry-Afterの指定に従って待ってから再試行してください。
- 503
- 処理を完了できませんでした。保留中の請求額は残高に戻されます。結果が不明な場合は、再試行する前に確認してください。
- 200(空)
- データがありません。課金はされません。