# Merge Hacker News runs into one list of unique stories

**Use case:** 

Two runs of the Hacker News Scraper, for example the Top and the New list, merged into one dataset with every story once, keeping the copy from the later run (the fresher score and comment count). Replace the two dataset IDs with those of your own runs; the same works for any scraper that gives each row a stable ID.

## Input

```json
{
  "datasetIds": [
    "gEKpNK3WDGSntjXfB",
    "c6rW1xQZEPdc0FEi4"
  ],
  "keyFields": [
    "id"
  ],
  "normalize": [
    "lowercase",
    "trim",
    "collapseWhitespace"
  ],
  "keep": "last",
  "mergeFields": false,
  "addSourceColumns": true,
  "fieldsToKeep": [],
  "fieldsToDrop": [],
  "maxItems": 0,
  "dryRun": false,
  "onlyNew": false,
  "stateName": "default",
  "notifyWhenEmpty": false,
  "requestIntervalMs": 0
}
```

## Output

```json
{
  "_sourceDatasetId": {
    "label": "ID of the dataset the kept row comes from",
    "format": "string"
  },
  "_sourceIndex": {
    "label": "Position of the row in its source dataset, counting from 0",
    "format": "integer"
  },
  "_duplicateCount": {
    "label": "Number of copies of this row that were removed",
    "format": "integer"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Dataset Dedup and Merge API: Remove Duplicate Rows Actor is ready to run with the inputs already set for "Merge Hacker News runs into one list of unique stories". [Sign up or log in](https://console.apify.com/create-task-from-example/PkHDKXBuFfOOmAx1F) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Merge Hacker News runs into one list of unique stories" task

The Dataset Dedup and Merge API: Remove Duplicate Rows Actor will start running based on the input automatically. You can also change all the input fields, like datasets to merge, key fields (what makes a row a duplicate), and more, to match your specific use case.

### 3. Receive the "Merge Hacker News runs into one list of unique stories" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as ID of the dataset the kept row comes from, position of the row in its source dataset, counting from 0, and number of copies of this row that were removed.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Merge Hacker News runs into one list of unique stories" task via API](https://apify.com/rowcraft/dataset-dedup-merge.md).

## About this Actor

This example demonstrates how to use [Dataset Dedup and Merge API: Remove Duplicate Rows](https://apify.com/rowcraft/dataset-dedup-merge.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/rowcraft/dataset-dedup-merge.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

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 full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/rowcraft/dataset-dedup-merge.md

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`).
