idstringobrigatório
Hacker News story id, e.g. "47340079".
https://api.sandbase.ai/v1/api/hacker-news/story-commentsList the comments on a Hacker News story by id - text, author, and timestamp as clean JSON.
Sua saída aparecerá aqui
Preencha as entradas e clique em Executar.
Returns the comments on a Hacker News story as a flat list. Each comment has its author, text, timestamp, and the id of the item it replies to. You send the story id as input.
id and parentId of each comment.author.curl -X POST "https://api.sandbase.ai/v1/api/hacker-news/story-comments" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id": "47340079"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Hacker News story id, e.g. "47340079". |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"data": {
"comments": [
{
"author": "fcpguru",
"createdUtc": 1773257417,
"id": "47340089",
"parentId": "47340079",
"permalink": "https://news.ycombinator.com/item?id=47340089",
"postId": "47340079",
"text": "i agree but how is this ever going to be enforced verified? https://proofofhuman…"
}
]
},
"found": true
}
| Field | Meaning |
|---|---|
data.comments[].id | Id of the comment, as a string. |
data.comments[].author | Hacker News username of the person who wrote the comment. |
data.comments[].text | Text of the comment. |
data.comments[].createdUtc | Time the comment was posted, as a Unix timestamp in seconds. |
data.comments[].parentId | Id of the item this comment replies to. It equals the story id for top-level comments and another comment's id for replies. |
data.comments[].postId | Id of the story the comment belongs to. |
data.comments[].permalink | Link to the comment on news.ycombinator.com. |
found | true when the story was found. A lookup that finds nothing returns found: false. |
id is the number in the story URL, for example item?id=47340079.parentId, so group by parentId to build the thread tree.Billed at the actual cost of each call, about $0.0015 for the request above. Failed calls are not charged.
Comece a construir
Endpoint da API da plataforma com autenticação unificada e rastreamento de uso.
curl -X POST "https://api.sandbase.ai/v1/api/hacker-news/story-comments" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "47340079"
}'Defina sua chave da API SandBase no ambiente do seu servidor. As requisições usam autenticação Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Mantenha sua chave no servidor. Não a exponha em código do navegador.
idstringobrigatórioHacker News story id, e.g. "47340079".
Resposta de exemplo salva para esta API; nenhuma requisição ao vivo é feita ao visualizá-la.
Nenhuma resposta salva foi publicada. Execute a API no Playground para inspecionar a resposta.
Explorar mais
| API | Preço | Resposta |
|---|---|---|
Hacker News Story CommentsEsta API Hacker News | A partir de $0.0015 por chamada | JSON |
Hacker News | A partir de $0.0015 por chamada | JSON |
Hacker News | A partir de $0.0015 por chamada | JSON |
Hacker News | A partir de $0.0015 por chamada | JSON |
Perguntas
Envie uma solicitação POST para https://api.sandbase.ai/v1/api/hacker-news/story-comments com sua chave de API da SandBase no cabeçalho Authorization (Bearer) e os parâmetros no corpo JSON. Você também pode testar no Playground desta página sem escrever código.
A partir de $0.0015 por chamada, cobrado do seu saldo SandBase. Você paga apenas pelas chamadas que fizer; não há assinatura.
Obrigatórios: id (string). A tabela de Parâmetros e o Playground nesta página listam todos os campos.
Uma resposta JSON retornada na mesma solicitação HTTP (síncrona). O README desta página inclui um exemplo de resposta.
Não. Hacker News Story Comments funciona via SandBase, então uma única chave de API da SandBase cobre este endpoint e todas as outras APIs e modelos do catálogo. Você não precisa solicitar acesso à API do Hacker News separadamente.