# Pubmed Data Extractor (`kawsar/pubmed-data-extractor`) Actor

PubMed Data Extractor scrapes PubMed search results by keyword, so you get titles, authors, journals, DOIs, and abstracts as clean, exportable data in seconds.

- **URL**: https://apify.com/kawsar/pubmed-data-extractor.md
- **Developed by:** [Kawsar](https://apify.com/kawsar) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.99 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## PubMed Data Extractor

PubMed Data Extractor is a fast scraper that turns PubMed search results into structured, exportable data. Give it one or more keywords and it collects the citation details you would otherwise copy by hand: titles, authors, journals, publication years, DOIs, PMIDs, and abstract snippets. It is built for research, competitive content analysis, and SEO work that needs real data from published medical literature.

PubMed indexes more than 38 million citations from MEDLINE, life science journals, and online books. Reading through that by hand does not scale. This actor does the searching, reading, and paging for you, and hands back a clean dataset you can drop into a spreadsheet, a database, or your own app.

### Why use it

- **Save hours of manual work.** One run replaces dozens of copy-and-paste passes across search pages.
- **Get clean, structured fields.** Journal name, year, and DOI are parsed out of the raw citation for you, so the data is ready to sort and filter.
- **Search many topics at once.** Pass a list of terms and each one is searched separately in the same job.
- **Own your data.** Export to CSV, JSON, or Excel, or pull it through the Apify API into your own pipeline.

### Who it is for

- SEO and content teams building articles around trusted medical sources
- Medical writers and researchers gathering citations for reviews
- Data teams tracking new publications on a condition, drug, gene, or method
- Anyone who needs a repeatable, structured feed of PubMed results

### Features

- Search PubMed by keyword, phrase, author, or query
- Run multiple search terms in a single job, each with its own result limit
- Collect title, authors, journal, year, DOI, PMID, abstract snippet, and article URL
- Automatic pagination across result pages
- Deduplication by PMID within each term
- Reports the total number of matches PubMed found for every term
- Export to CSV, JSON, Excel, or read through the API

### How it works

1. You enter one or more search terms, the same way you would type them on the PubMed website.
2. For each term, the actor runs the search and reads every result on the page.
3. It pages through the listing until it reaches the number of items you asked for.
4. Each article is parsed into a clean row and saved to the dataset.

### Input

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `searchTerms` | array of strings | Yes | One or more keywords, phrases, authors, or queries. Each term is searched separately. |
| `maxItems` | integer | No | Maximum results to collect for each search term. Default 10, maximum 1000. |
| `requestTimeoutSecs` | integer | No | Per-request timeout in seconds. Default 30. |

#### Example input

```json
{
    "searchTerms": ["Rheumatoid arthritis", "CRISPR gene editing"],
    "maxItems": 25
}
````

This searches both terms and returns up to 25 results for each, so up to 50 items total.

### Output

Each result is saved as one dataset item.

```json
{
    "pmid": "38354510",
    "articleTitle": "Rheumatoid arthritis autoantibodies benefit from inflammation temperatures.",
    "authors": "Singh PK, Stan RC.",
    "journalCitation": "Int Immunopharmacol. 2024 Mar 10;129:111690. doi: 10.1016/j.intimp.2024.111690.",
    "journalName": "Int Immunopharmacol",
    "publicationYear": "2024",
    "doi": "10.1016/j.intimp.2024.111690",
    "snippet": "BACKGROUND: Symptoms of rheumatoid arthritis are associated with local inflammation and may include low-grade fever...",
    "url": "https://pubmed.ncbi.nlm.nih.gov/38354510/",
    "searchTerm": "Rheumatoid arthritis",
    "resultPosition": 3,
    "totalResults": 187602,
    "scrapedAt": "2026-07-06T12:00:00+00:00"
}
```

#### Output fields

| Field | Type | Description |
|-------|------|-------------|
| `pmid` | string | PubMed identifier for the article. |
| `articleTitle` | string | Article title. |
| `authors` | string | Author list as shown on the result. |
| `journalCitation` | string | Full citation string, including volume, pages, and DOI. |
| `journalName` | string | Journal name parsed from the citation. |
| `publicationYear` | string | Publication year parsed from the citation. |
| `doi` | string | DOI parsed from the citation, when present. |
| `snippet` | string | Abstract snippet shown under the result, when present. |
| `url` | string | Direct link to the article on PubMed. |
| `searchTerm` | string | The term that produced this result. |
| `resultPosition` | integer | Position of the result on its page. |
| `totalResults` | integer | Total matches PubMed reported for the term. |
| `scrapedAt` | string | UTC timestamp of the run. |

### Use cases

- **Content research.** Pull the latest papers on a topic and cite them in blog posts, guides, or landing pages.
- **Literature tracking.** Run the same terms on a schedule to watch for new publications.
- **Competitive analysis.** See which journals and authors dominate a subject before you write about it.
- **Dataset building.** Collect thousands of citations across many terms to feed a model, an app, or an internal knowledge base.

### Performance and limits

- Page size adapts to your `maxItems`, so small runs use a single request per term.
- Results are deduplicated by PMID within each term.
- Broad terms can match hundreds of thousands of records. The `totalResults` field shows how many exist; use `maxItems` to keep runs focused and fast.
- Results reflect what PubMed returns at run time, in the same order the website shows them.

### Tips

- Use quotation marks for exact phrases, for example `"gene therapy"`.
- PubMed field tags work too, for example `asthma[Title]` or `Smith J[Author]`.
- Combine terms with `AND`, `OR`, and `NOT` for more precise searches.

### FAQ

**Can I search several topics in one run?**
Yes. Add each topic to `searchTerms` and the actor searches them one after another, each with its own limit.

**How many results can I get per term?**
Up to 1000 per term. The default is 10.

**What format is the output?**
A structured dataset you can export as CSV, JSON, or Excel, or read through the Apify API.

**Does it return abstracts?**
It returns the abstract snippet shown on the search result. Full abstracts live on each article page, linked in the `url` field.

### Notes

This actor collects publicly available bibliographic data from PubMed search results. PubMed is a service of the U.S. National Library of Medicine. Use the data in line with PubMed's terms and give proper attribution to the original publications.

# Actor input Schema

## `searchTerms` (type: `array`):

One or more keywords, phrases, authors, or queries to search on PubMed. Each term is searched separately.

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

Maximum number of results to collect for each search term.

## `requestTimeoutSecs` (type: `integer`):

Per-request timeout in seconds.

## Actor input object example

```json
{
  "searchTerms": [
    "breast cancer",
    "COVID-19 vaccine",
    "CRISPR gene editing"
  ],
  "maxItems": 10,
  "requestTimeoutSecs": 30
}
```

# 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 = {
    "searchTerms": [
        "Rheumatoid arthritis"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kawsar/pubmed-data-extractor").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 = { "searchTerms": ["Rheumatoid arthritis"] }

# Run the Actor and wait for it to finish
run = client.actor("kawsar/pubmed-data-extractor").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 '{
  "searchTerms": [
    "Rheumatoid arthritis"
  ]
}' |
apify call kawsar/pubmed-data-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=kawsar/pubmed-data-extractor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Pubmed Data Extractor",
        "description": "PubMed Data Extractor scrapes PubMed search results by keyword, so you get titles, authors, journals, DOIs, and abstracts as clean, exportable data in seconds.",
        "version": "0.0",
        "x-build-id": "7PmwRolRqy2pxDobV"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/kawsar~pubmed-data-extractor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-kawsar-pubmed-data-extractor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/kawsar~pubmed-data-extractor/runs": {
            "post": {
                "operationId": "runs-sync-kawsar-pubmed-data-extractor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/kawsar~pubmed-data-extractor/run-sync": {
            "post": {
                "operationId": "run-sync-kawsar-pubmed-data-extractor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "searchTerms"
                ],
                "properties": {
                    "searchTerms": {
                        "title": "Search terms",
                        "type": "array",
                        "description": "One or more keywords, phrases, authors, or queries to search on PubMed. Each term is searched separately.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxItems": {
                        "title": "Max items per search term",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum number of results to collect for each search term.",
                        "default": 10
                    },
                    "requestTimeoutSecs": {
                        "title": "Request timeout (seconds)",
                        "minimum": 5,
                        "maximum": 120,
                        "type": "integer",
                        "description": "Per-request timeout in seconds.",
                        "default": 30
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
