API YouTube Post della community
Stato di salute dell'API
- Operatività nelle ultime 24 ore
- Normale
- Buono / normale
- Disponibile
Ultime 24 ore
Ultimi 30 giorni
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.
Invia POST https://api.everyinfra.com/api/v1/social con platform impostato su youtube e action impostato su community_posts. Prezzo $0.56 per 1.000 richieste ($0.000556 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 YouTube Post della community di EveryInfra (youtube/community_posts).
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 youtube e action su community_posts, e inserisci i parametri in params.
- Parametri obbligatori:
- 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.
- Parametri facoltativi:
- 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.
- Restituisce un elenco di record. Campi principali di ogni record: 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 campi in totale, elenco completo su https://api.everyinfra.com/api/v1/social/catalog?platform=youtube.
- Esempio di corpo della richiesta:
{
"platform": "youtube",
"action": "community_posts",
"params": {
"url": "https://www.youtube.com/@MrBeast"
}
}
- Prezzo: $0.56 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ì | youtube | Identificativo della piattaforma, valore fisso. |
action | body | string | Sì | community_posts | Identificativo della funzionalità, valore fisso. |
url | body.params | string | Sì | - | 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 | No | - | 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. |
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": "youtube",
"action": "community_posts",
"params": {
"url": "https://www.youtube.com/@MrBeast"
}
}'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": "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": { … }}
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 |
|---|---|
id | ID univoco del record sulla piattaforma. È univoco solo all'interno di una piattaforma; gli ID possono ripetersi tra piattaforme diverse. |
url | Link al record sulla piattaforma. |
text | Testo del contenuto senza HTML, restituito per intero e mai troncato (su alcune piattaforme i risultati degli elenchi contengono solo un estratto; lo indicano le note sui campi della piattaforma). |
author_name | Nome visualizzato dell'autore. |
author_username | Username dell'autore (@handle), di solito utilizzabile negli URL. |
author_id | ID univoco dell'autore sulla piattaforma. |
author_url | Link al profilo dell'autore sulla piattaforma. |
author_avatar_url | Mantiene il significato attribuito dalla piattaforma |
like_count | Like. null significa che la piattaforma o questa funzionalità non li rende noti; non equivale a 0. |
comment_count | Commenti. null significa non resi noti, non 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 | Array di link alle immagini nell'ordine di visualizzazione della piattaforma; assente se non ci sono immagini. |
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 | 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.