GET /v1/crawl/hackernews/story/comments
Hacker News comments API: the full comment tree of a story
Send a numeric Hacker News item id in id and get its whole nested comment tree, with each comment's author, text, time and parent, as the Algolia items API serves it.
- Price
- $0.0005 per call
- Batch
- Yes, through /v1/batch
- Failed calls
- Not charged
Example request
curl
curl 'https://api.virev.ai/v1/crawl/hackernews/story/comments?id=8863' \
-H "Authorization: Bearer $VIREV_API_KEY"python
import os
import requests
response = requests.request(
"GET",
"https://api.virev.ai/v1/crawl/hackernews/story/comments",
params={
"id": "8863",
},
headers={"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"},
timeout=60,
)
response.raise_for_status()
print(response.json())Parameters
| Name | In | Type | Description |
|---|---|---|---|
id required | query | string | The Hacker News item id (numeric). |
Example response
The example response of the API reference, with lists cut to their first 3 items and long text shortened.
json
{
"data": {
"final_url": "https://hn.algolia.com/api/v1/items/8863",
"status": 200,
"content_type": "application/json",
"payload_kind": "json",
"response_headers": {
"content-type": "application/json"
},
"body": {
"author": "dhouston",
"children": [
{
"author": "dhouston",
"children": [
{
"author": "vlad",
"children": [],
"created_at": "2007-04-05T01:48:11.000Z",
"created_at_i": 1175737691,
"id": 9007,
"options": [],
"parent_id": 8865,
"points": null,
"story_id": 8863,
"text": "Drew, this is awesome! All of the features you mentioned are exactly what people need.",
"title": null,
"type": "comment",
"url": null
}
],
"created_at": "2007-04-04T19:22:55.000Z",
"created_at_i": 1175714575,
"id": 8865,
"options": [],
"parent_id": 8863,
"points": null,
"story_id": 8863,
"text": "oh, and a mac port is coming :)",
"title": null,
"type": "comment",
"url": null
},
{
"author": "zaidf",
"children": [
{
"author": "rwalker",
"children": [
{
"author": "zach",
"children": [],
"created_at": "2007-04-04T23:17:47.000Z",
"created_at_i": 1175728667,
"id": 8960,
"options": [],
"parent_id": 8949,
"points": null,
"story_id": 8863,
"text": "I love that approach (my weblog is called \"Story-Driven\" after all) because it automatically breaks technical people out of a taxonomic, procedural mindset. So many descriptions of things are on the order of \"well, it's a set of pliers wit…",
"title": null,
"type": "comment",
"url": null
}
],
"created_at": "2007-04-04T22:50:38.000Z",
"created_at_i": 1175727038,
"id": 8949,
"options": [],
"parent_id": 8869,
"points": null,
"story_id": 8863,
"text": "Looks like a great product, and I will second the parent comment.<p>One thing they teach at YC, and in one of pg's essays (<a href=\"http://www.paulgraham.com/investors.html),\">http://www.paulgraham.com/investors.html),</a> is to present a s…",
"title": null,
"type": "comment",
"url": null
}
],
"created_at": "2007-04-04T19:36:20.000Z",
"created_at_i": 1175715380,
"id": 8869,
"options": [],
"parent_id": 8863,
"points": null,
"story_id": 8863,
"text": "This has great potential!<p>Only suggestion I would have is go slower on the demo. I know you lost me very early into it switching between windows.<p>If you are looking for a wider audience than those who already know the context of dropbox…",
"title": null,
"type": "comment",
"url": null
}
],
"created_at": "2007-04-04T19:16:40.000Z",
"created_at_i": 1175714200,
"id": 8863,
"options": [],
"parent_id": null,
"points": 104,
"story_id": 8863,
"text": null,
"title": "My YC app: Dropbox - Throw away your USB drive",
"type": "story",
"url": "http://www.getdropbox.com/u/2/screencast.html"
}
},
"meta": {
"cost": "$0.0005",
"balance": "$3.0780",
"request_id": "req_a8495d1e73735aadfba9886c43e79883"
}
}How it works
An item's full nested comment tree, as served by the Algolia items API.
Errors
| Status | When |
|---|---|
400 | The request parameters are invalid. |
401 | Missing, malformed, or revoked API key. |
402 | Balance is too low for this request. |
404 | The page does not exist: its site answered 404 or 410 for this input. You are not charged. |
429 | Over the per-minute limit. The limit belongs to your organization and all its API keys share it: 100 requests per minute unless an increase was granted. Wait for the Retry-After seconds, then retry. On a live read, code rate_limited means the platform itself rate-limited this read; retry after the Retry-After seconds. You are not charged. |
502 | The upstream fetch failed. You are not charged. |
503 | Billing could not be confirmed, so no upstream data was returned. |
504 | The upstream request timed out. You are not charged. |