# Hacker News Search Scraper (`fetch_cat/hacker-news-search-scraper`) Actor

Search Hacker News stories, comments, Ask HN, Show HN, polls, and author activity using public HN search data.

- **URL**: https://apify.com/fetch\_cat/hacker-news-search-scraper.md
- **Developed by:** [Hanna Nosova](https://apify.com/fetch_cat) (community)
- **Categories:** News, Developer tools, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.03 / 1,000 hn result saveds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Hacker News Search Scraper

Search and export public Hacker News stories, comments, Ask HN, Show HN, polls, and author activity.

Use this Actor to collect Hacker News search results for product research, founder and developer signals, technical trend monitoring, market analysis, content research, and AI datasets. Results can be downloaded as CSV, JSON, Excel, XML, RSS, or used through the Apify Dataset API.

### At a glance

- **HN search export**: Search Hacker News by keyword, tag/type, author, date range, and sort mode.
- **Stories and comments**: Export public stories, comments, Ask HN, Show HN, polls, and related search result types.
- **Research fields**: Collect titles, text, URLs, authors, points, comment counts, timestamps, tags, and HN item links when available.
- **Trend monitoring**: Track mentions of products, competitors, technologies, companies, and topics over time.
- **API export**: Send HN rows to spreadsheets, BI tools, research workflows, alerting systems, or AI agents.

### Ready-to-run examples

Use these saved Store examples as starting points. Open any example to prefill the Actor input, then adjust URLs, keywords, limits, or filters for your own run.

- **[Research HN alternatives to Google Analytics](https://apify.com/fetch_cat/hacker-news-search-scraper/examples/hn-google-analytics-alternatives)**
- **[Analyze Hacker News comments by a public author](https://apify.com/fetch_cat/hacker-news-search-scraper/examples/analyze-hacker-news-comments-by-a-public-author)**
- **[Export Hacker News results for product launch tracking](https://apify.com/fetch_cat/hacker-news-search-scraper/examples/export-hacker-news-results-for-product-launch-tracking)**
- **[Research Hacker News posts about RSS and newsletters](https://apify.com/fetch_cat/hacker-news-search-scraper/examples/research-hacker-news-posts-about-rss-and-newsletters)**
- **[Collect Hacker News stories about robotics startups](https://apify.com/fetch_cat/hacker-news-search-scraper/examples/collect-hacker-news-stories-about-robotics-startups)**
- **[Export Hacker News discussions about cloudflare blocks](https://apify.com/fetch_cat/hacker-news-search-scraper/examples/export-hacker-news-discussions-about-cloudflare-blocks)**
- **[View all ready-to-run examples](https://apify.com/fetch_cat/hacker-news-search-scraper/examples)** (50 examples)

### What can it do?

Hacker News Search Scraper uses public HN search data and saves one dataset row per matching item.

- **Search stories or comments**: Use keywords and result tags to narrow the output.
- **Filter by author**: Track public HN activity for a username.
- **Filter by date range**: Limit results to a specific research window.
- **Sort results**: Choose relevance or date ordering.
- **Export clean rows**: Use Apify downloads, API calls, schedules, webhooks, and integrations.

### Common workflows

- **Product research**: Track public discussion around a product, API, startup, or category.
- **Developer relations**: Find where developers mention SDKs, libraries, tools, and integrations.
- **Market intelligence**: Monitor technical trends, competitor launches, and pain points.
- **Content research**: Build source lists for newsletters, essays, reports, or research briefs.
- **Founder and investor signals**: Watch product feedback, hiring trends, launch comments, and emerging markets.
- **AI datasets**: Export HN stories and comments for classification, summarization, or alerting workflows.

### What data can you extract?

The Actor returns one dataset row per public Hacker News search result.

| Field | Description |
| --- | --- |
| `objectID` | Hacker News or Algolia item identifier |
| `title` | Story, Ask HN, Show HN, or poll title |
| `commentText` | Public comment text when the result is a comment |
| `url` | External story URL when available |
| `hnUrl` | Hacker News item URL |
| `author` | HN username |
| `points` | Story points when available |
| `numComments` | Comment count when available |
| `createdAt` | Item creation timestamp |
| `tags` | HN search tags or result type labels |
| `storyTitle` | Parent story title for comment results |
| `storyUrl` | Parent story URL for comment results |
| `query` | Search query used for the row |
| `scrapedAt` | Timestamp when the row was saved |

### Pricing

This Actor uses Apify pay-per-event pricing. The prices below come from the current Actor pricing configuration. Apify public plans map to Store discount tiers, so the table shows both the user-facing plan context and the pricing tier name. The final price shown in Apify depends on the user account plan and any custom agreement.

| Event | What is charged | Price |
| --- | --- | ---: |
| `start` | One-time fee per run | $0.005 |
| `result` | Per Hacker News story, comment, poll, or job saved to the dataset | $0.000028 |

Apify may also charge platform usage for compute, storage, proxies, or data transfer outside this Actor pricing. Check the Actor run and the Apify Pricing tab for the exact cost shown to your account.

### Input configuration

| Setting | JSON key | Use it for | Example |
| --- | --- | --- | --- |
| Search query | `query` | Keyword, product, company, technology, or phrase to search. | `ai agents` |
| HN result types / tags | `tags` | Limit to stories, comments, Ask HN, Show HN, polls, or other HN tags. | `["story"]` |
| Include comments | `includeComments` | Include comment search results when supported by the selected tags. | `true` |
| Author username | `author` | Filter by public HN username. | `pg` |
| Date from | `dateFrom` | Start date for result filtering. | `2026-01-01` |
| Date to | `dateTo` | End date for result filtering. | `2026-07-01` |
| Sort by | `sortBy` | Sort by relevance or date. | `date` |
| Maximum HN items | `maxItems` | Cap saved rows and spend. | `50` |

### Example input

```json
{
  "query": "ai agents",
  "tags": ["story"],
  "includeComments": true,
  "sortBy": "date",
  "maxItems": 50
}
```

### Example output

```json
{
  "objectID": "12345678",
  "title": "Show HN: Example developer tool",
  "url": "https://example.com",
  "hnUrl": "https://news.ycombinator.com/item?id=12345678",
  "author": "example_user",
  "points": 124,
  "numComments": 38,
  "createdAt": "2026-06-20T12:00:00.000Z",
  "tags": ["story", "show_hn"],
  "query": "ai agents",
  "scrapedAt": "2026-07-03T12:00:00.000Z"
}
```

### How to run it

1. Open the Actor on Apify.
2. Enter a query, author, tags, or a combination of filters.
3. Choose sort mode and optional date range.
4. Set `maxItems`.
5. Start the run and export the dataset.

### Search tips

- **Start with exact names**: Product names, package names, and company names often produce cleaner results.
- **Use tags for intent**: Search `ask_hn` for questions, `show_hn` for launches, and comments for discussion.
- **Sort by date for monitoring**: Use date sorting and schedules for recurring alerts.
- **Add an author only when needed**: Author filters are best for public user activity tracking.
- **Control spend**: Start with `maxItems: 25` before broad searches.

### Limits and caveats

- The Actor extracts public Hacker News search data only.
- It does not require or use a Hacker News account.
- Some fields are empty depending on result type; comments do not have story points, and stories may not have comment text.
- Search result ordering and availability follow public HN search behavior.

### API usage

```bash
curl -X POST 'https://api.apify.com/v2/acts/fetch_cat~hacker-news-search-scraper/runs?token=YOUR_APIFY_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"query":"ai agents","tags":["story"],"maxItems":50}'
```

### MCP and AI agents

This Actor can be used through the official Apify MCP server at `https://mcp.apify.com`.

For a focused single-Actor tool setup, use:

```text
https://mcp.apify.com?tools=fetch_cat/hacker-news-search-scraper
```

Use the same JSON keys shown in the input configuration table, such as `query`, `tags`, `author`, `sortBy`, and `maxItems`.

### FAQ

#### Can I search Hacker News comments?

Yes. Use comment-related tags or enable comment results where appropriate.

#### Can I export results to CSV or Excel?

Yes. Apify datasets can be downloaded as CSV, JSON, Excel, XML, RSS, HTML, or accessed through the API.

#### Does this require my Hacker News account?

No. It uses public Hacker News search data.

#### Can I schedule monitoring?

Yes. Use Apify schedules with a fixed query and date-oriented sort.

### Related scrapers

- [Reddit Scraper](https://apify.com/fetch_cat/reddit-scraper)
- [Product Hunt Scraper](https://apify.com/fetch_cat/product-hunt-scraper)
- [GitHub Repositories Search Scraper](https://apify.com/fetch_cat/github-repositories-search-scraper)
- [Stack Exchange Questions Scraper](https://apify.com/fetch_cat/stack-exchange-questions-scraper)
- [Substack Posts Scraper](https://apify.com/fetch_cat/substack-posts-scraper)

### Changelog

#### 0.1

- Initial public release with query, tag, comment, author, date, sort, and maximum-result controls for public Hacker News search data.

### Support

If a run fails, returns no data, or a field looks wrong, open an issue from the Actor page.

Please include the Apify run ID or run URL, input JSON, one example public URL, query, or input item, what you expected, and what the dataset returned. Small reproducible inputs make parsing or site-layout issues much faster to fix.

### Privacy and data handling

This Actor runs with Apify limited permissions and only processes data needed for the documented run. It uses content lookup inputs and public posts, profiles, videos, comments, or channel metadata needed for the requested output to produce the output dataset and sends requests to public Hacker News Search pages/endpoints; results are stored in Apify run storage for your account. FetchCat does not use your inputs or outputs for advertising, does not use them for model training, and does not retain them outside the Apify run except for transient support debugging when you explicitly share run details. You are responsible for using the Actor lawfully, respecting the target site's terms, and avoiding unnecessary personal or sensitive data in inputs.

# Actor input Schema

## `query` (type: `string`):

Keyword, product, company, domain, person, or topic to find on Hacker News. Leave empty for tag/date/author-only searches.

## `tags` (type: `array`):

Filter by Hacker News / Algolia tags. Use built-in values or custom tags such as `author_pg`.

## `includeComments` (type: `boolean`):

Also include matching comments. Useful for sentiment, pain-point, and lead research.

## `author` (type: `string`):

Optional Hacker News username. This is converted to an author tag automatically.

## `dateFrom` (type: `string`):

Only include items created on or after this date. Format: YYYY-MM-DD.

## `dateTo` (type: `string`):

Only include items created on or before this date. Format: YYYY-MM-DD.

## `sortBy` (type: `string`):

Choose relevance, newest first, or client-side ordering by points.

## `maxItems` (type: `integer`):

Maximum number of stories/comments to save. Keep the prefill low for a quick first run.

## Actor input object example

```json
{
  "query": "apify",
  "tags": [
    "story"
  ],
  "includeComments": false,
  "sortBy": "relevance",
  "maxItems": 20
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "apify",
    "tags": [
        "story"
    ],
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("fetch_cat/hacker-news-search-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "query": "apify",
    "tags": ["story"],
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("fetch_cat/hacker-news-search-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "apify",
  "tags": [
    "story"
  ],
  "maxItems": 20
}' |
apify call fetch_cat/hacker-news-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=fetch_cat/hacker-news-search-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/0KPGvxjTbuBdNOyoc/builds/CbZkmIqyif7C2pjDJ/openapi.json
