idstringerforderlich
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.
Ihre Ausgabe wird hier angezeigt
Vervollständigen Sie die Eingaben und klicken Sie dann auf Ausführen.
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.
Jetzt loslegen
Plattform-API-Endpunkt mit einheitlicher Authentifizierung und Nutzungsnachverfolgung.
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"
}'Legen Sie Ihren SandBase API-Schlüssel in Ihrer Serverumgebung fest. Anfragen verwenden Bearer-Authentifizierung.
export SANDBASE_API_KEY="YOUR_API_KEY"Bewahren Sie Ihren Schlüssel auf dem Server auf. Geben Sie ihn nicht in Browser-Code preis.
idstringerforderlichHacker News story id, e.g. "47340079".
Gespeicherte Beispielantwort für diese API; beim Anzeigen wird keine Live-Anfrage gesendet.
Es wurde keine gespeicherte Antwort veröffentlicht. Führen Sie die API in Playground aus, um die Antwort zu prüfen.
Mehr entdecken
| API | Preis | Antwort |
|---|---|---|
Hacker News Story CommentsDiese API Hacker News | Ab $0.0015 pro Aufruf | JSON |
Hacker News | Ab $0.0015 pro Aufruf | JSON |
Hacker News | Ab $0.0015 pro Aufruf | JSON |
Hacker News | Ab $0.0015 pro Aufruf | JSON |
Fragen
Senden Sie eine POST-Anfrage an https://api.sandbase.ai/v1/api/hacker-news/story-comments mit Ihrem SandBase API-Schlüssel im Authorization-Header (Bearer) und den Parametern als JSON-Body. Sie können das auch ohne Code direkt auf dieser Seite im Playground testen.
Ab $0.0015 pro Aufruf, abgerechnet von Ihrem SandBase-Guthaben. Es werden nur die von Ihnen getätigten Aufrufe berechnet; es gibt kein Abo.
Erforderlich: id (string). Die Parametertabelle und der Playground auf dieser Seite listen jedes Feld auf.
Eine JSON-Antwort, die in derselben HTTP-Anfrage zurückgegeben wird (synchron). Die README auf dieser Seite enthält eine Beispielantwort.
Nein. Hacker News Story Comments läuft über SandBase, daher deckt ein SandBase API-Schlüssel diesen Endpunkt und jede andere API sowie jedes Modell im Katalog ab. Sie müssen keinen separaten Zugang für Hacker News API beantragen.