# Hacker News Trends Exporter (`danielmichalek/hacker-news-trend-exporter`) Actor

Export public Hacker News stories, scores and discussion links. Filter the current feed and download CSV. Ready to check today's stories?

- **URL**: https://apify.com/danielmichalek/hacker-news-trend-exporter.md
- **Developed by:** [Daniel Michałek](https://apify.com/danielmichalek) (community)
- **Categories:** News
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.30 / 1,000 saved public stories

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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Hacker News Trends Exporter

Export current public Hacker News stories, scores and discussion links into a tidy JSON dataset and UTF-8 CSV. The Actor uses the official Hacker News Firebase API, with no account, AI model or secret token. It is designed for transparent topic research, not for predicting popularity or sales.

### What it does

Choose one of six official feeds: top, new, best, ask, show or jobs. The exporter fetches only the first bounded set of public story IDs and their corresponding public metadata. It keeps story titles, original links, Hacker News discussion links, points, comment counts and publication times.

Filter by literal words in the story title, minimum points, minimum comments and a maximum age in days. You can scan up to 60 IDs and save up to 50 matching stories, never more than you scanned. The original feed order is preserved; the source may change between runs.

### Input

The default input uses the top feed, scans 25 story IDs and saves up to 20 results. The number of scanned IDs controls API requests and run time. An age window of zero means no age filter. Job postings often have no point or comment count, so the defaults do not exclude them.

The Actor accepts only these fixed feed names and numeric limits. It does not accept a URL or hostname to fetch, and it does not search private comments, user accounts or personal information.

### Output

Dataset rows contain ID, title, item type, public score, comment count, publication timestamp, age in hours, source domain, original URL when it is a safe HTTP(S) address, and the Hacker News discussion URL. It never visits links included in stories.

The default key-value store contains STORIES_CSV, REPORT and EXPORT_SUMMARY. The CSV is spreadsheet-safe: quoted values and escaped formula prefixes. The summary records the number scanned, the number matched and saved, and whether the public feed scan was partial. It also includes a small breakdown by linked domains.

### Pricing and cost control

Proposed Pay-per-event price: $0.0003 per saved story. Only saved output rows are intended to be charged to a paying user; excluded records and unsuccessful source reads do not produce an item event. This is a pricing candidate, not proof of an active Apify Store price or profitability.

The runtime caps requests at 61 logical reads, output at 50 stories, and uses a fixed public API. No paid proxy, API subscription or model inference is required by the code. Actual platform charges and net payout must be measured in a verified cloud run before publication.

### Limitations and fair use

Hacker News rankings, scores and comment counts change frequently. The tool checks only the current public IDs in the selected official feed; it does not search historical posts beyond that feed or perform AI classification. An empty filtered dataset is a valid result, not a demand forecast. Never present test runs as paying users or revenue.

Source: https://github.com/HackerNews/API . Respect provider availability and rate limits; a provider error aborts the run rather than returning a partial paid dataset.

### Example

Use examples/input.json to request a small top-stories batch. The dataset and CSV contain actual public story metadata returned at run time, while examples/output.json contains three public source examples mapped directly from the official API. This is an illustration of the output shape, not evidence that the Actor handler or Apify SDK has executed successfully.

# Actor input Schema

## `feed` (type: `string`):

Official public feed; no account, token or private data.

## `scanLimit` (type: `integer`):

At most 60 requests to a fixed official API, controlling runtime.

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

From one to 50 stories and no more than scanLimit. Saved items are billable only in Pay per event.

## `minScore` (type: `integer`):

Only current public Hacker News score; no predictions.

## `minComments` (type: `integer`):

Minimum current number of public comments.

## `ageDays` (type: `integer`):

Zero disables the age filter. Only the chosen public feed is read.

## `keywords` (type: `array`):

Up to eight literal keywords matched against public story titles.

## Actor input object example

```json
{
  "feed": "top",
  "scanLimit": 25,
  "maxItems": 20,
  "minScore": 0,
  "minComments": 0,
  "ageDays": 0,
  "keywords": []
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `csv` (type: `string`):

No description

## `report` (type: `string`):

No description

## `summary` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("danielmichalek/hacker-news-trend-exporter").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 = {}

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

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

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

```

## CLI example

```bash
echo '{}' |
apify call danielmichalek/hacker-news-trend-exporter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,danielmichalek/hacker-news-trend-exporter"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/diljaNfei9MpmPHEF/builds/REgUWdPT5umUnV0Gl/openapi.json
