Official Template

Hacker News Thread

Extract thread data from Hacker News — title, score, author, comment count, and top-level comments.

forumhackernewstechdiscussion

Target URL Pattern

news.ycombinator.com/item*

This template is optimised for URLs matching this pattern, but works with any URL.

Template Configuration

Request Config (merged with your URL)
{
  "mode": "markdown",
  "render_js": false,
  "extraction_schema": {
    "type": "object",
    "properties": {
      "url": {
        "type": "string"
      },
      "score": {
        "type": "integer"
      },
      "title": {
        "type": "string"
      },
      "author": {
        "type": "string"
      },
      "comments": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "text": {
              "type": "string"
            },
            "time": {
              "type": "string"
            },
            "author": {
              "type": "string"
            }
          }
        }
      },
      "posted_time": {
        "type": "string"
      },
      "comment_count": {
        "type": "integer"
      }
    }
  }
}
Try It Live

Test the Hacker News Thread Template

Template: Hacker News Thread

Template config applied: {"mode":"markdown","render_js":false,"extraction_schema":{"type":"object","properties":{"url":{"type":"string"},"score":{"type":"integer"},"title":{"type":"string"},"author":{"type":"string"},"comments":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"time":{"type":"string"},"author":{"type":"string"}}}},"posted_time":{"type":"string"},"comment_count":{"type":"integer"}}}}

Enter a URL and click Run to see the template in action. for a real API key.

Code Examples

cURL
curl -X POST https://api.alterlab.io/v1/scrape \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "YOUR_TARGET_URL",
  "formats": ["markdown", "text"],
  "mode": "markdown",
  "render_js": false,
  "extraction_schema": {"type":"object","properties":{"url":{"type":"string"},"score":{"type":"integer"},"title":{"type":"string"},"author":{"type":"string"},"comments":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"time":{"type":"string"},"author":{"type":"string"}}}},"posted_time":{"type":"string"},"comment_count":{"type":"integer"}}}
}'
Python
import requests

response = requests.post(
    "https://api.alterlab.io/v1/scrape",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={
        "url": "YOUR_TARGET_URL",
        "formats": ["markdown", "text"],
        "mode": "markdown",
        "render_js": false,
        "extraction_schema": {"type":"object","properties":{"url":{"type":"string"},"score":{"type":"integer"},"title":{"type":"string"},"author":{"type":"string"},"comments":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"time":{"type":"string"},"author":{"type":"string"}}}},"posted_time":{"type":"string"},"comment_count":{"type":"integer"}}},
    },
)
data = response.json()
print(data["data"]["markdown"])
Node.js
const response = await fetch("https://api.alterlab.io/v1/scrape", {
  method: "POST",
  headers: {
    "X-API-Key": "YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "YOUR_TARGET_URL",
    formats: ["markdown", "text"],
    mode: "markdown",
    render_js: false,
    extraction_schema: {"type":"object","properties":{"url":{"type":"string"},"score":{"type":"integer"},"title":{"type":"string"},"author":{"type":"string"},"comments":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"time":{"type":"string"},"author":{"type":"string"}}}},"posted_time":{"type":"string"},"comment_count":{"type":"integer"}}},
  }),
});
const data = await response.json();
console.log(data.data.markdown);

Need an API key? — no credit card required.

Responsible Use

AlterLab is designed for extracting publicly available data. Always review the terms of service for any website you access, respect robots.txt directives, and ensure your use case complies with applicable laws in your jurisdiction.

Your first scrape.
Sixty seconds.

$1 free credit — up to 5,000 scrapes. No credit card.Just a POST request.

terminal
curl -X POST https://api.alterlab.io/v1/scrape \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "formats": ["markdown"]}'

No credit card required · $1 free credit, up to 5,000 scrapes · Balance never expires