# PubMed & Biomedical Articles Scraper | 2Space (`2space/pubmed-biomedical-scraper`) Actor

Fast PubMed and NCBI biomedical literature scraper. Queries official NCBI E-utilities for 37M+ medical studies, full abstracts, MeSH headings, authors, journals, DOIs, and PMCIDs.

- **URL**: https://apify.com/2space/pubmed-biomedical-scraper.md
- **Developed by:** [2Space Group](https://apify.com/2space) (community)
- **Categories:** AI, MCP servers, Business
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 pubmed articles scraped

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/actors/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

## PubMed & Biomedical Articles Scraper | 2Space

> **Built by 2Space** · Zero-browser **PubMed scraper**, **biomedical literature API**, **scientific paper extractor**, **MeSH term extractor**, and **medical research dataset** generator powered by NCBI E-utilities for AI agents, MCP clients, and clinical researchers.

[![Apify Actor](https://img.shields.io/badge/Apify-pubmed--biomedical--scraper-00C853?style=flat-square)](https://apify.com/2space/pubmed-biomedical-scraper)
[![MCP Ready](https://img.shields.io/badge/MCP-Ready-2563EB?style=flat-square)](https://mcp.apify.com?tools=2space/pubmed-biomedical-scraper)
[![Zero Browser](https://img.shields.io/badge/Runtime-Pure%20HTTP%20%2B%20XML-7C3AED?style=flat-square)](https://apify.com/2space/pubmed-biomedical-scraper)

Whether you need a fast **PubMed scraper** for systematic literature reviews, a clean **biomedical literature API** for downstream LLM synthesis and RAG pipelines, or a structured **scientific paper extractor** that captures full abstracts, DOIs, PMC IDs, authors, and MeSH headings, this Actor delivers validated records directly from NCBI E-utilities in seconds with zero headless browser overhead.

***

### Key Features

- **Pure HTTP + NCBI E-utilities Speed:** Queries NCBI `esearch.fcgi` and `efetch.fcgi` XML directly with `cheerio` XML parsing and polite rate limiting (`<= 3` requests per second)—no Playwright, no Puppeteer, and no proxy overhead.
- **Rich, Flat Biomedical Records:** Extracts `pmid`, `pmcId`, `doi`, `title`, `abstract` (preserving structured section labels such as `BACKGROUND`, `METHODS`, `RESULTS`, `CONCLUSIONS`), `authors`, `journal`, `pubDate`, `meshTerms`, `publicationTypes`, `pubmedUrl`, and `extractedAt`.
- **Dual Mode (Keyword Search or Direct PMIDs):** Search PubMed with full boolean syntax and MeSH qualifiers (`"BRCA1 AND breast cancer[MeSH]"`) or pass a list of exact `pmids` for direct EFetch retrieval.
- **Empty `{}` Input Ready:** Works immediately with zero configuration—running `{}` queries `"CRISPR gene editing"` sorted by `relevance` (`maxItems: 8`, `maxCostUsd: 0.25`) and finishes in seconds.
- **No Data, No Charge (Pay-Per-Event):** Bills the `pubmed-article-scraped` event (`count: 1`) **only after** a validated record is pushed to the dataset, with hard `maxItems` and `maxCostUsd` pre-charge spending guards.

***

### Use Cases

- **Systematic Reviews & Evidence Synthesis:** Collect structured abstracts, publication types (`Clinical Trial`, `Meta-Analysis`, `Review`), and normalized dates for screening workflows.
- **Biotech & Pharma Intelligence:** Track emerging therapeutic targets, gene editing trials, and competitive publications across MEDLINE-indexed journals.
- **Biomedical RAG & AI Research Assistants:** Feed clean plain-text abstracts, MeSH descriptors, and canonical `pubmedUrl` citations into vector databases and MCP tools.
- **Bibliometric & Citation Enrichment:** Resolve PubMed IDs (`pmid`) to `doi`, `pmcId`, full author lists, and journal metadata at scale.

***

### Input Parameters

| Field | Type | Default | Description |
|---|---|---|---|
| `query` | `string` | `"CRISPR gene editing"` | PubMed search query supporting boolean operators and field tags (`[MeSH]`, `[Title/Abstract]`). |
| `pmids` | `string[]` | `[]` | Optional list of specific PubMed IDs to fetch directly via EFetch XML. |
| `sortBy` | `string` | `"relevance"` | Sort order for ESearch results: `"relevance"` or `"pub_date"`. |
| `maxItems` | `integer` | `8` | Hard cap on deduplicated biomedical articles pushed and charged per run (`1`–`1000`). |
| `maxCostUsd` | `number` | `0.25` | Pre-charge spending safety cap in USD for Pay-Per-Event billing. |

***

### Sample JSON Output Item

Each item written to the default dataset contains flat fields ready for JSON, CSV, Excel, or vector ingestion:

```json
{
  "pmid": "38786024",
  "pmcId": "PMC11119143",
  "doi": "10.3390/cells13100800",
  "title": "CRISPR-Based Gene Therapies: From Preclinical to Clinical Treatments.",
  "abstract": "In recent years, clustered regularly interspaced short palindromic repeats (CRISPRs) and CRISPR-associated (Cas) protein have emerged as a revolutionary gene editing tool...",
  "authors": [
    "Marine Laurent",
    "Marine Geoffroy",
    "Giulia Pavani",
    "Simon Guiraud"
  ],
  "journal": "Cells",
  "pubDate": "2024-05-08",
  "meshTerms": [
    "Humans",
    "Genetic Therapy",
    "CRISPR-Cas Systems",
    "Gene Editing"
  ],
  "publicationTypes": [
    "Journal Article",
    "Review"
  ],
  "pubmedUrl": "https://pubmed.ncbi.nlm.nih.gov/38786024/",
  "extractedAt": "2026-12-03T03:45:00.000Z"
}
```

Execution telemetry (ESearch hit counts, EFetch batch statuses, deduplication counts, and spending cap flags) is also written to the default Key-Value Store under `RUN_DIAGNOSTICS`.

***

### 1-Prompt MCP Setup

Connect `2space/pubmed-biomedical-scraper` directly to Claude Desktop, Cursor, ChatGPT, or any MCP-compatible client using the Apify MCP endpoint:

```text
https://mcp.apify.com?tools=2space/pubmed-biomedical-scraper
```

Example `mcpServers` configuration for Cursor or Claude Desktop:

```json
{
  "mcpServers": {
    "pubmed-scraper": {
      "url": "https://mcp.apify.com?tools=2space/pubmed-biomedical-scraper",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_TOKEN"
      }
    }
  }
}
```

Then ask your AI assistant in a single prompt:

> *"Use 2space/pubmed-biomedical-scraper to find the 10 most recent PubMed articles on GLP-1 receptor agonists and summarize their abstracts with PMIDs and DOIs."*

***

### Pricing & Reliability

- **Pay-Per-Event (`pubmed-article-scraped`):** Charged `count: 1` per validated biomedical article pushed to the dataset. If NCBI returns zero matching articles or a batch fails, you are not charged.
- **Spending Protections:** Both `maxItems` and `maxCostUsd` are enforced prior to pushing and charging each item, alongside Apify's `eventChargeLimitReached` limit check.

***

### Support & Issues

Questions, feature requests, or edge cases with specific PubMed XML records? Open an issue on the Actor's **Issues** tab at `https://apify.com/2space/pubmed-biomedical-scraper` and include your `RUN_DIAGNOSTICS` record from the Key-Value Store.

# Actor input Schema

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

PubMed search query using keywords, MeSH terms, or boolean operators (e.g., 'CRISPR gene editing', 'BRCA1 AND breast cancer\[MeSH]'). Ignored when specific PMIDs are supplied alongside the default query.

## `pmids` (type: `array`):

Optional list of PubMed IDs (e.g., '38786024', '31295471') to fetch directly via EFetch XML.

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

Sort order for PubMed ESearch results: 'relevance' (Best Match) or 'pub_date' (Most Recent).

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

Hard cap on the maximum number of deduplicated biomedical articles to push and charge.

## `maxCostUsd` (type: `number`):

Pre-charge spending safety cap in USD for Pay-Per-Event billing.

## Actor input object example

```json
{
  "query": "CRISPR gene editing",
  "pmids": [],
  "sortBy": "relevance",
  "maxItems": 8,
  "maxCostUsd": 0.25
}
```

# Actor output Schema

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

Dataset items containing extracted PubMed articles with flat bibliographic and abstract fields.

# 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": "CRISPR gene editing",
    "pmids": [],
    "sortBy": "relevance",
    "maxItems": 8,
    "maxCostUsd": 0.25
};

// Run the Actor and wait for it to finish
const run = await client.actor("2space/pubmed-biomedical-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": "CRISPR gene editing",
    "pmids": [],
    "sortBy": "relevance",
    "maxItems": 8,
    "maxCostUsd": 0.25,
}

# Run the Actor and wait for it to finish
run = client.actor("2space/pubmed-biomedical-scraper").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 '{
  "query": "CRISPR gene editing",
  "pmids": [],
  "sortBy": "relevance",
  "maxItems": 8,
  "maxCostUsd": 0.25
}' |
apify call 2space/pubmed-biomedical-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,2space/pubmed-biomedical-scraper"
        }
    }
}
```

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/sA35onEyNwdGRB9iz/builds/U3PEAeyYlJcpW0CCr/openapi.json
