
Hacker News Data Scraper
- epctex/hackernews-scraper
- Modified
- Users 46
- Runs 2.7k
- Created by
epctex
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!
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'