Hacker News Data Scraper

  • epctex/hackernews-scraper
  • Modified
  • Users 46
  • Runs 2.7k
  • Created by Author's avatarepctex

Extract Y Combinator's Hacker News based on any search criteria. Crawl the front page, Show HN, Ask HN, news, job listings, and historical data. Get links, titles, comments, ratings, and more!

Free trial for 3 days

Then $10.00/month

No credit card required now

Hacker News Data Scraper

Free trial for 3 days

Then $10.00/month

To run the code examples, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token. For a more detailed explanation, please read about running Actors via the API in Apify Docs.

# Set API token
API_TOKEN=<YOUR_API_TOKEN>

# Prepare Actor input
cat > input.json <<'EOF'
{
  "startUrls": [
    {
      "url": "https://news.ycombinator.com/front"
    },
    {
      "url": "https://news.ycombinator.com/show"
    },
    {
      "url": "https://news.ycombinator.com/jobs"
    },
    {
      "url": "https://news.ycombinator.com"
    },
    {
      "url": "https://news.ycombinator.com/item?id=26566373"
    }
  ],
  "maxItems": 50,
  "endPage": 1,
  "extendOutputFunction": "($) => { return {} }",
  "proxy": {
    "useApifyProxy": true
  }
}
EOF

# Run the Actor
curl "https://api.apify.com/v2/acts/epctex~hackernews-scraper/runs?token=$API_TOKEN" \
  -X POST \
  -d @input.json \
  -H 'Content-Type: application/json'