API Reddit Dettagli
Stato di salute dell'API
- Operatività nelle ultime 24 ore
- Normale
- Buono / normale
- Disponibile
Ultime 24 ore
Ultimi 30 giorni
Ottieni il profilo di un utente Reddit come singolo oggetto. username è obbligatorio: spez, u/spez o un link al profilo, un utente per chiamata. Campi: user_id (inizia con t2_), username, display_name, url, bio, avatar_url, banner_url, karma (il totale), post_karma, comment_karma, post_count, comment_count (Reddit aggiorna entrambi i conteggi circa ogni 24 ore e alcune richieste tornano senza), created_at (la data di iscrizione, precisa solo al giorno), is_premium, is_admin (un account dello staff di Reddit), is_nsfw, content_hidden, trophy_count, achievement_count e moderated_communities. Quando content_hidden è true, user_posts, user_comments e user_subreddits restituiscono risultati vuoti. Non c'è il numero di follower, perché Reddit non lo mostra. Un utente che non esiste o è stato bannato restituisce un risultato vuoto.
Invia POST https://api.everyinfra.com/api/v1/social con platform impostato su reddit e action impostato su profile. Prezzo $0.79 per 1.000 richieste ($0.000792 per chiamata). Le chiamate non riuscite e i risultati vuoti non vengono addebitati. Sincrona. Per i job più lenti, aggiungi "mode": "async" al corpo della richiesta, recupera il job_id ed esegui il polling.
Prompt per l'AI
#Aiutami a scrivere uno script di raccolta dei dati con l'endpoint Reddit Dettagli di EveryInfra (reddit/profile).
Come funziona l'endpoint:
- Richiesta: POST https://api.everyinfra.com/api/v1/social con l'header Authorization: Bearer <chiave API>. Leggi la chiave dalla variabile d'ambiente EVERYINFRA_API_KEY e non scriverla mai direttamente nel codice.
- Nel corpo della richiesta imposta platform su reddit e action su profile, e inserisci i parametri in params.
- Parametri obbligatori:
- username: One Reddit user: spez, u/spez or a profile link. One user per call.
- Restituisce un oggetto. Campi principali: 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 campi in totale, elenco completo su https://api.everyinfra.com/api/v1/social/catalog?platform=reddit.
- Esempio di corpo della richiesta:
{
"platform": "reddit",
"action": "profile",
"params": {
"username": "spez"
}
}
- Prezzo: $0.79 per 1.000 richieste; le richieste non riuscite e i risultati vuoti non vengono addebitati.
- Per decine o centinaia di target, aggiungi "mode": "async" al corpo: ricevi subito un job_id ed esegui il polling su GET https://api.everyinfra.com/api/v1/jobs/{job_id} per ottenere il risultato.
- In caso di 422, correggi la richiesta usando i nomi dei parametri e i valori consentiti suggeriti nell'errore; in caso di 429 o 503, attendi il tempo indicato da Retry-After e riprova.
Prima di scrivere il codice, chiedimi quali target mi servono, quanti, quali campi e quale formato di output voglio; poi conferma con me il piano e il costo indicativo.Parametri della richiesta
#| Nome | Posizione | Tipo | Obbligatorio | Predefinito | Descrizione |
|---|---|---|---|---|---|
Authorization | header | string | Sì | - | Bearer seguito dalla tua chiave API. Creala nella console; non inserirla mai in un URL o in un repository di codice. |
platform | body | string | Sì | reddit | Identificativo della piattaforma, valore fisso. |
action | body | string | Sì | profile | Identificativo della funzionalità, valore fisso. |
username | body.params | string | Sì | - | One Reddit user: spez, u/spez or a profile link. One user per call. |
Esempi di codice
#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"
}
}'Definizione OpenAPI (JSON)Gli esempi leggono la chiave dalla variabile d'ambiente EVERYINFRA_API_KEY; il codice copiato non contiene mai la tua chiave.
Esempio di risposta
#{ "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": { … }}
Campi della risposta
#I dati di business si trovano in results. La tabella elenca i campi che un record può contenere; i valori che la piattaforma non mostra non vengono mai inventati.
| Campo | Significato |
|---|---|
user_id | ID univoco dell'utente sulla piattaforma. |
username | Username (@handle). |
display_name | Nome visualizzato; può essere diverso da username. |
url | Link al record sulla piattaforma. |
bio | Bio del profilo scritta dall'account; può contenere interruzioni di riga ed emoji. |
avatar_url | Link all'immagine dell'avatar. Alcune piattaforme restituiscono URL CDN con dimensioni specifiche, che possono scadere. |
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 | Post totali. null significa non reso noto, non 0. |
comment_count | Commenti. null significa non resi noti, non 0. |
created_at | Data e ora di creazione, nello stesso formato di 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 | Identificativo della piattaforma di origine, uguale a platform nella richiesta (ad esempio xiaohongshu, tiktok). |
Errori e addebiti
#- 401
- Chiave mancante o non valida.
- 402
- Saldo insufficiente. Effettua prima una ricarica.
- 422
- Nome o valore del parametro non valido. Correggilo seguendo i suggerimenti dell'errore. Nessun addebito.
- 429
- Raggiunto il limite di richieste al minuto. Attendi il tempo indicato da Retry-After, poi riprova.
- 503
- Impossibile completare. L'importo trattenuto torna sul tuo saldo. Se l'esito è incerto, verificalo prima di riprovare.
- Risposta 200 vuota
- Nessun dato. Nessun addebito.