Skip to content

About

PubMed scraper API: PubMed Article Details, PubMed Article Search as clean JSON. Python examples with requests, Scrapy, asyncio and the DataGuru SDK.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

PubMed Scraper API

Scrape PubMed with a JSON API. This repo has working Python examples for DataGuru's PubMed scraper APIs: PubMed Article Details and PubMed Article Search.

DataGuru runs the scraping, proxies, retries and parsing, and returns clean JSON. You pay only for successful requests, from $0.0012 per request, out of a prepaid balance: no subscription. New accounts get $1.00 of free credit.

PubMed APIs

API What it returns Price Page
PubMed Article Details Get a PubMed article's full record, including abstract sections, authors with affiliations and ORCID iDs, journal details, MeSH terms, keywords, chemicals, grants, references, citing articles, DOI and free full-text links. $0.0022 https://dataguru.cc/apis/pubmed-article-details/
PubMed Article Search Search PubMed by keyword and get matching biomedical articles with titles, authors, journal, publication date, abstract, keywords, publication types, DOI and free full-text links. $0.0012 https://dataguru.cc/apis/pubmed-article-search/

Quick start

  1. Create a free account and an API key at dashboard.dataguru.cc.
  2. Install and run:
git clone https://github.com/dataguru-cc/pubmed-scraper-api.git
cd pubmed-scraper-api
pip install -r requirements.txt
export DATAGURU_API_KEY="your key"
python examples/sdk_example.py pubmed-article-details

Examples

Every example covers all 2 PubMed APIs. Pass an API name to run just one; with no name each script runs them all, and each call is billed at the price above.

File Style Run
examples/sdk_example.py DataGuru Python SDK (pip install dataguru-sdk), one function per API, saves JSON to output/ python examples/sdk_example.py
examples/requests_example.py Plain requests, synchronous python examples/requests_example.py
examples/async_example.py asyncio + httpx, concurrent with a limit python examples/async_example.py
examples/scrapy_spider.py Scrapy spider, items to JSON/CSV scrapy runspider examples/scrapy_spider.py -O pubmed.json

All requests use the header Authorization: Api-Key YOUR_API_KEY. Errors return {"success": false, "error": {"code", "message", "request_id"}}, with HTTP 402 when the balance runs out and 429 (with Retry-After) when rate limited. Failed requests are not charged.

API reference

PubMed Article Details

Get a PubMed article's full record, including abstract sections, authors with affiliations and ORCID iDs, journal details, MeSH terms, keywords, chemicals, grants, references, citing articles, DOI and free full-text links.

Parameter Type Required Description
article_url string yes PubMed article URL (e.g. https://pubmed.ncbi.nlm.nih.gov/31452104/) or the numeric PMID.

Response fields: pmid, title, abstract, abstract_sections, copyright, authors, journal, volume, issue, pages, pub_date, pub_date_iso, year, electronic_pub_date, doi, pmcid, pii, publication_types, language, keywords, mesh_terms, chemicals, grants, publication_status, history, references, references_count, cited_by_count, cited_by, url, doi_url, pmc_url, error, plus _metadata

curl -X POST "https://api.dataguru.cc/api/v1/pubmed/articles/details" \
  -H "Authorization: Api-Key $DATAGURU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"article_url": "https://pubmed.ncbi.nlm.nih.gov/31452104/"}'
Response schema

Values are type placeholders from the API's published schema, not real data.

{
  "pmid": "1234567890",
  "title": "string",
  "abstract": "string",
  "abstract_sections": [
    {
      "label": "string",
      "text": "string"
    }
  ],
  "copyright": "string",
  "authors": [
    {
      "name": "string",
      "last_name": "string",
      "fore_name": "string",
      "initials": "string",
      "suffix": "string",
      "is_collective": false,
      "affiliations": [
        "string"
      ],
      "orcid": "1234567890"
    }
  ],
  "journal": {
    "title": "string",
    "iso_abbreviation": "string",
    "medline_abbreviation": "string",
    "issn_print": "string",
    "issn_electronic": "string",
    "country": "string",
    "nlm_id": "1234567890"
  },
  "volume": "string",
  "issue": "string",
  "pages": "string",
  "pub_date": "2026-01-01T12:00:00Z",
  "pub_date_iso": "string",
  "year": 0,
  "electronic_pub_date": "2026-01-01T12:00:00Z",
  "doi": "string",
  "pmcid": "1234567890",
  "pii": "string",
  "publication_types": [
    "string"
  ],
  "language": [
    "string"
  ],
  "keywords": [
    "string"
  ],
  "mesh_terms": [
    {
      "descriptor": "string",
      "ui": "string",
      "major_topic": false,
      "qualifiers": [
        "string"
      ]
    }
  ],
  "chemicals": [
    "string"
  ],
  "grants": [
    {
      "grant_id": "1234567890",
      "agency": "string",
      "country": "string"
    }
  ],
  "publication_status": "string",
  "history": {},
  "references": [
    {
      "citation": "string",
      "pmid": "1234567890",
      "doi": "string",
      "pmcid": "1234567890"
    }
  ],
  "references_count": 0,
  "cited_by_count": 0,
  "cited_by": [
    "string"
  ],
  "url": "https://example.com/...",
  "doi_url": "https://example.com/...",
  "pmc_url": "https://example.com/...",
  "error": "string",
  "_metadata": {
    "request_id": "3f6c1a2e-8b4d-4c1e-9a7f-2d5e6b7c8d9e",
    "execution_time_ms": 842,
    "endpoint": "PubMed Article Details",
    "mode": "live",
    "format": "json",
    "timestamp": "2026-01-01T12:00:00+00:00"
  }
}

PubMed Article Search

Search PubMed by keyword and get matching biomedical articles with titles, authors, journal, publication date, abstract, keywords, publication types, DOI and free full-text links.

Parameter Type Required Description
limit integer no Maximum number of results to return (1-100). Default: 20.
page integer no Results page (each page holds up to limit results). Default: 1.
query string yes Search keywords or a PubMed query, e.g. "crispr gene therapy" or "covid-19[ti] AND vaccine".
sort string no Result order - relevance (best match first) or date (newest first). Default: relevance. Allowed: relevance, date.
year_from integer no Only return articles published in or after this year, e.g. 2020.
year_to integer no Only return articles published in or before this year, e.g. 2024.

Response fields: query, query_translation, sort, page, total_results, returned_results, results, error, plus _metadata

curl -X POST "https://api.dataguru.cc/api/v1/pubmed/articles/search" \
  -H "Authorization: Api-Key $DATAGURU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "crispr gene therapy"}'
Response schema

Values are type placeholders from the API's published schema, not real data.

{
  "query": "string",
  "query_translation": "string",
  "sort": "relevance",
  "page": 0,
  "total_results": 0,
  "returned_results": 0,
  "results": [
    {
      "pmid": "1234567890",
      "title": "string",
      "abstract": "string",
      "authors": [
        "string"
      ],
      "journal": "string",
      "journal_abbreviation": "string",
      "volume": "string",
      "issue": "string",
      "pages": "string",
      "pub_date": "2026-01-01T12:00:00Z",
      "pub_date_iso": "string",
      "year": 0,
      "doi": "string",
      "pmcid": "1234567890",
      "publication_types": [
        "string"
      ],
      "language": [
        "string"
      ],
      "keywords": [
        "string"
      ],
      "url": "https://example.com/...",
      "doi_url": "https://example.com/...",
      "pmc_url": "https://example.com/..."
    }
  ],
  "error": "string",
  "_metadata": {
    "request_id": "3f6c1a2e-8b4d-4c1e-9a7f-2d5e6b7c8d9e",
    "execution_time_ms": 842,
    "endpoint": "PubMed Article Search",
    "mode": "live",
    "format": "json",
    "timestamp": "2026-01-01T12:00:00+00:00"
  }
}

More

License

The example code is MIT licensed. Use of the DataGuru API is subject to the terms of service.

About

PubMed scraper API: PubMed Article Details, PubMed Article Search as clean JSON. Python examples with requests, Scrapy, asyncio and the DataGuru SDK.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors