# Drugs.com Scraper (`dadhalfdev/drugs-com-scraper`) Actor

Scrape Drugs.com by search, medical condition, or drug class — or paste an input\_url. Returns drug names, ratings, Rx/OTC, pregnancy/CSA flags, and optional full monograph details.

- **URL**: https://apify.com/dadhalfdev/drugs-com-scraper.md
- **Developed by:** [Marco Rodrigues](https://apify.com/dadhalfdev) (community)
- **Categories:** Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 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 web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## 💊 Drugs.com Scraper

Want drug listings and monographs from [Drugs.com](https://www.drugs.com/) without paging through search results by hand? This scraper makes it easy.

Use the **search bar**, pick a **medical condition** or **drug class** from the full site catalogues — better for AI agents — **or** paste an **`input_url`**. You get clean CSV/JSON with ratings, Rx/OTC flags, pregnancy/CSA info, and **full monograph details** (description, warnings, side effects, related links).

### 💡 Perfect for...

- **Researchers & students:** Compare treatments for a condition or drug class.
- **Health-tech builders:** Structure Drugs.com pages for apps and datasets.
- **🤖 AI Agents:** Structured filters (`search_input`, `condition`, `drug_class`) beat brittle URL crafting.
- **📚 RAG Systems:** Feed descriptions, warnings, and side-effect blurbs into retrieval pipelines.
- **🔗 AI Workflows:** Plug into LangChain, AutoGPT, CrewAI, and similar stacks.

### ✨ Why you'll love this scraper

- 🔗 **Input URL or Filters:** Paste a search, condition, class, or drug page (`input_url`), or use structured filters.
- 🎯 **Full catalogues:** Dropdowns for ~2,100 medical conditions and ~490 drug classes — same coverage as the site A–Z / class indexes.
- 🔍 **Search bar parity:** `search_input` maps to the Drugs.com search box.
- ↕️ **Sort:** Popularity, drug name, rating, or reviews (condition & class listings).
- 🧾 **Full details by default:** Every result is enriched from the drug page — generic/brand names, availability, description, warnings, side effects, and related links.

### 📦 What's inside the data?

For every drug / result, you will get:

- **Core:** `name`, `url`, `generic_name`, `brand_names`, `drug_class`, `result_type`, `source`
- **Listing signals:** `rating`, `reviews_count`, `activity_pct`, `rx_otc`, `pregnancy`, `csa`, `alcohol`
- **Monograph:** `pronunciation`, `dosage_forms`, `availability`, `pregnancy_lactation`, `csa_schedule`, `description`, `warnings`, `side_effects`
- **Extras:** `ratings`, `related_links`, `snippet` (search), `condition` / `drug_class_slug` / `sort` when applicable

### 🚀 Quick start

**Option A — Search**

1. Set `search_input` (e.g. `ibuprofen`).
2. Set `max_items` and click **Start**.

**Option B — Condition or drug class**

1. Pick a `condition` (e.g. Sinusitis) or `drug_class` (e.g. NSAIDs).
2. Optionally set `sort` (popularity / rating / reviews / drug name).
3. Start the run.

**Option C — Input URL**

1. Open a Drugs.com search, condition, class, or drug page.
2. Paste the URL into `input_url`.
3. Start.

Export CSV, Excel, or JSON when done.

***

#### Tech details for developers 🧑‍💻

**Inputs**

| Field | Description |
|--------|-------------|
| `input_url` | Optional Drugs.com search / condition / class / drug URL |
| `search_input` | Free-text search (site search bar) |
| `condition` | Medical condition slug (full dropdown) |
| `drug_class` | Pharmacological class slug (full dropdown) |
| `sort` | `popularity` | `drug` | `rating` | `reviews` |
| `max_items` | Cap results (1–2000, default 50) |

Priority: `input_url` → `search_input` → `condition` → `drug_class`.

**Input Example (search):**

```json
{
  "search_input": "ibuprofen",
  "max_items": 50
}
```

**Input Example (condition + sort):**

```json
{
  "condition": "sinusitis",
  "sort": "rating",
  "max_items": 100
}
```

**Input Example (drug class):**

```json
{
  "drug_class": "nonsteroidal-anti-inflammatory-agents",
  "sort": "reviews",
  "max_items": 50
}
```

**Input Example (drug URL):**

```json
{
  "input_url": "https://www.drugs.com/ibuprofen.html"
}
```

**Output Example:**

```json
{
  "name": "Ibuprofen",
  "url": "https://www.drugs.com/ibuprofen.html",
  "rating": 7.3,
  "reviews_count": 246,
  "rx_otc": "Rx/OTC",
  "pregnancy": "C",
  "csa": "N",
  "generic_name": "ibuprofen",
  "brand_names": "Advil, Genpril, IBU, Midol IB, Motrin IB",
  "drug_class": "Nonsteroidal anti-inflammatories (NSAIDs)",
  "availability": "Rx and/or OTC",
  "description": "Ibuprofen is a nonsteroidal anti-inflammatory drug (NSAID). It works by reducing hormones that cause inflammation and pain in the body.",
  "warnings": "Ibuprofen can increase your risk of fatal heart attack or stroke...",
  "side_effects": "Get emergency medical help if you have signs of an allergic reaction...",
  "related_links": [
    { "label": "Side Effects", "url": "https://www.drugs.com/sfx/ibuprofen-side-effects.html" },
    { "label": "Pregnancy", "url": "https://www.drugs.com/pregnancy/ibuprofen.html" }
  ],
  "result_type": "condition_drug",
  "condition": "pain",
  "source": "drugs.com"
}
```

# Actor input Schema

## `input_url` (type: `string`):

Optional. Paste a Drugs.com search, condition, drug-class, or drug page URL. Leave empty to use the filters below (better for AI agents).

## `search_input` (type: `string`):

Text for the Drugs.com search bar (e.g. ibuprofen, metformin).

## `condition` (type: `string`):

Scrape drugs listed for this condition (full site catalogue).

## `drug_class` (type: `string`):

Scrape drugs in this pharmacological class.

## `sort` (type: `string`):

Sort order for condition and drug-class listings (ignored for free-text search).

## `max_items` (type: `integer`):

Maximum number of results to return (capped at 2000).

## Actor input object example

```json
{
  "search_input": "ibuprofen",
  "condition": "",
  "drug_class": "",
  "sort": "popularity",
  "max_items": 50
}
```

# Actor output Schema

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

Table view of scraped items using the dataset 'overview' view.

## `results` (type: `string`):

All scraped items from the default dataset without view transformation.

# 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 = {
    "search_input": "ibuprofen",
    "max_items": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("dadhalfdev/drugs-com-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 = {
    "search_input": "ibuprofen",
    "max_items": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("dadhalfdev/drugs-com-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 '{
  "search_input": "ibuprofen",
  "max_items": 50
}' |
apify call dadhalfdev/drugs-com-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dadhalfdev/drugs-com-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/uR1nPEEIhTcuYTgKC/builds/PESX2cVGvTDEpa1zq/openapi.json
