Dataset Merge & Dedupe: Remove Duplicates, Only New Items avatar

Dataset Merge & Dedupe: Remove Duplicates, Only New Items

Pricing

from $0.02 / 1,000 unique item writtens

Go to Apify Store
Dataset Merge & Dedupe: Remove Duplicates, Only New Items

Dataset Merge & Dedupe: Remove Duplicates, Only New Items

Merge Apify datasets and remove duplicates by any fields, with trim, case-insensitive and URL-normalized matching. Keep first, last or most complete. Output only items not seen in earlier runs. Works with limited permissions. Duplicates are free.

Pricing

from $0.02 / 1,000 unique item writtens

Rating

0.0

(0)

Developer

Vikas Maur

Vikas Maur

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

0

Monthly active users

a day ago

Last modified

Features

Limited permissions

Share

Dataset Merge & Dedupe: remove duplicates, output only new items

Merge one or more Apify datasets into a single dataset of unique items. You choose the fields that define a duplicate (url, id, name + address, nested author.id). Matching can ignore extra whitespace, letter case and URL noise such as utm_* parameters, www. and trailing slashes. You also choose which copy to keep: first, last or most complete.

Running a scraper on a schedule? Give the actor a seen-items memory name and each run returns only items that earlier runs have not output yet.

  • Works with limited permissions. You pick the datasets, and the actor can read those datasets and nothing else in your account. No full-access approval and no "Insufficient permissions" errors.
  • Duplicates are free. You pay per unique item written: $0.015 per 1,000.
  • Failed runs don't charge our events. Inputs are checked before anything is charged.
  • Streams any size. One million items use about 100 MB of memory.

What you can do with it

Use caseInput
Merge the results of several scraper runs into one clean tabledatasetIds: all runs, dedupeFields: ["url"]
Run it automatically after every scraper run (integration)datasetIds: ["{{resource.defaultDatasetId}}"]
Daily/hourly monitoring: only new listings, jobs, posts or productsadd seenItemsStoreName: "my-monitor"
Compare today's scrape with yesterday'sexcludeDatasetIds: yesterday's dataset
Keep the freshest price when a product appears in many runskeep: "last" and list the newest dataset last
Keep the record with the most filled-in fields (leads, places)keep: "most-complete"
Slim the output down to the columns you needoutputFields + renameFields

Quick start

  1. Click Datasets to merge and dedupe and pick one or more datasets (or paste IDs or names).
  2. Enter the Dedupe key fields, e.g. url. Leave the list empty to remove only exact duplicate items.
  3. Click Start. The unique items appear in the run's dataset. You can export them as CSV, Excel, JSON or XML, or use them through the API.

Example input

{
"datasetIds": ["aBcD1234EfGh5678i", "my-named-dataset"],
"dedupeFields": ["url"],
"normalizeUrls": true,
"keep": "most-complete",
"seenItemsStoreName": "shop-monitor",
"outputFields": ["url", "title", "price", "seller.name"],
"renameFields": {"seller.name": "seller"}
}

Run it after every scraper run

In your scraper's Integrations tab, choose Connect Actor or Task, pick this actor and use this input:

{ "datasetIds": ["{{resource.defaultDatasetId}}"], "dedupeFields": ["url"], "seenItemsStoreName": "my-scraper-new-items" }

Each scraper run then produces a second dataset that holds only the new items. Hook your notifications or exports to that dataset.

Input

FieldWhat it does
datasetIds (required)Datasets to merge, read in this order. Accepts IDs or names.
dedupeFieldsFields that identify a duplicate. All listed fields must match. Dots reach nested values (author.id, images.0.url). Empty means whole-item comparison.
keepfirst (default, one pass), last, or most-complete (most non-empty values, ties go to the earliest). last and most-complete read the data twice.
trimWhitespaceDefault on. " Acme Inc " matches "Acme Inc".
ignoreCase"ACME" matches "acme".
normalizeUrlsTreats http/https, www., domain case, trailing /, #fragment, default ports, query order and tracking parameters (utm_*, fbclid, gclid, msclkid, ...) as equal. Path case still matters.
itemsWithoutKeyItems with no value in any key field: keep (default, output each one) or drop.
seenItemsStoreNameTurns on the cross-run memory (see below).
resetSeenItemsClears that memory and starts over.
excludeDatasetIdsLeaves out items whose key appears in these datasets.
outputFields, renameFields, addSourceDatasetShape the output. Matching always uses the original values; output values are never modified.
batchSizeItems per download request (default 5,000). Lower it only for very large items.

Output

  • Dataset: the unique items, in the order they appear in your datasets.
  • Key-value store record SUMMARY: counts for this run, for example:
{"status": "ok", "inputItems": 5000, "duplicatesRemoved": 3136, "alreadySeenInPreviousRuns": 0,
"excludedByReference": 0, "outputItems": 1864, "passes": 1, "itemsDownloaded": 5000,
"seenItemsStore": null, "chargedEvents": {"item-output": 1864, "items-scanned-1k": 5}}

The run's status message gives the same numbers in one line: "1,864 items output from 5,000 read; 3,136 duplicates removed".

Only new items across runs (seen-items memory)

Set seenItemsStoreName to a name such as jobs-monitor. The actor keeps a key-value store with that name in your account. It holds only 8-byte fingerprints of the keys it has output, never your data. Each later run with the same name skips every item whose key was output before.

  • Only items that were actually written are remembered. If a run stops at your max charge, the rest come out next time.
  • If you change the key fields or matching options, the run stops at no charge and tells you to pick a new name or reset. Without this check the old fingerprints would never match, and every item would be output and charged again.
  • Items with no key value can't be remembered. Use itemsWithoutKey: drop for monitors.
  • Use a name that this actor created. A store you created by hand isn't readable by an actor with limited permissions.

Pricing (pay per event)

EventPrice
Unique item written to your dataset$0.015 per 1,000 ($0.000015 each, charged per item, not per started block)
Items scanned$0.50 per 1,000,000 ($0.0005 per started 1,000; last/most-complete scan twice)
Actor start (Apify's standard start event)$0.00005 per run

Duplicates, excluded items and already-seen items are free. A run that fails on input or access errors is charged nothing by this actor; only Apify's $0.00005 start event applies. Your max charge per run is always respected: the actor stops writing at the limit and finishes successfully.

Examples: merging 10,000 items into 6,000 unique costs $0.095. An hourly monitor that scans 2,000 items and finds about 20 new ones costs about $0.0014 per run (about $1 a month).

Limited permissions: why this matters

Apify runs Store actors with a token scoped to what the actor needs. An actor that asks for dataset IDs in a plain text field has no access to those datasets when your account uses the default Restricted resource access, and its runs fail with Insufficient permissions for the dataset (403). This actor declares its dataset fields as dataset inputs with read-only access. Apify grants exactly that access, and the actor needs no other access to your account.

FAQ

Does it change my source datasets? No. It only reads them. How large can the datasets be? It streams in batches. 1,000,000 items with 600,000 unique keys peak at about 100 MB of memory (default memory is 512 MB). Very large runs simply take longer. What counts as "most complete"? The number of non-empty values, counting nested fields. Empty strings, null, [] and {} don't count. Is the URL normalization safe? It drops only parameters that track visitors or campaigns, and it keeps meaningful ones like id= or page=. If you are unsure, leave it off. Do numbers and strings match (1 vs "1")? No. Types must match.

More tools from the same developer

Found a bug or need a feature? Open an issue in the Issues tab. We aim to reply within one business day.


Development (for maintainers)

cd actors/dataset-dedupe
python3 -m venv .venv && .venv/bin/pip install -r requirements-dev.txt
.venv/bin/python -m pytest -q # unit tests
.venv/bin/python scripts/local_e2e.py # runs the real actor locally on synthetic datasets -> samples/local/
.venv/bin/python scripts/bench_scale.py 1000000 first # memory/throughput benchmark (use the heavy lock on shared machines)
npx -y apify-cli@latest push # deploy as a private actor (needs `apify login`)

scripts/platform_run.py runs the pushed actor on Apify and checks its output item by item against the local engine (token read from APIFY_TOKEN_FILE).