# Marham.pk Scraper (`shahidirfan/marham-pk-scraper`) Actor

Extract doctor profiles, fees, and reviews effortlessly with the Marham.pk Scraper. This lightweight actor is optimized for speed and data accuracy on Pakistan's leading healthcare platform. For the most reliable results and to prevent IP blocking, using residential proxies is highly recommended.

- **URL**: https://apify.com/shahidirfan/marham-pk-scraper.md
- **Developed by:** [Shahid Irfan](https://apify.com/shahidirfan) (community)
- **Categories:** Developer tools, Automation, Lead generation
- **Stats:** 16 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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

## Marham.pk Doctors Scraper

Extract comprehensive doctor data from Marham.pk, Pakistan's leading healthcare platform. Collect verified doctor profiles including qualifications, experience, fees, reviews, hospital affiliations, and availability. Perfect for healthcare directories, market research, and medical analytics.

### Features

- **Complete Doctor Profiles** — Extract names, specialties, qualifications, experience, and patient reviews
- **Smart Filtering** — Search by medical specialty and city across Pakistan
- **Fee Information** — Get consultation fees and pricing data
- **Hospital Affiliations** — Collect associated hospitals and clinics
- **Verification Status** — Include PMDC verification and video consultation availability
- **Flexible Collection** — Choose between fast listing extraction or detailed profile scraping
- **Automatic Pagination** — Seamlessly handle multiple pages to reach your desired result count
- **Reliable Extraction** — Built-in error handling and retry mechanisms ensure consistent data quality

### Use Cases

#### Healthcare Directory Development

Build comprehensive doctor finder applications or medical directories with verified, up-to-date information. Provide patients with detailed doctor profiles including qualifications, fees, and availability.

#### Market Research and Analytics

Analyze healthcare service availability across Pakistani cities. Study pricing patterns, specialty distribution, and service gaps. Understand doctor-to-patient ratios and healthcare accessibility in different regions.

#### Competitive Intelligence

Healthcare providers can benchmark consultation fees, track patient satisfaction ratings, and analyze service offerings across specialties and locations to improve their competitive positioning.

#### Appointment and Booking Systems

Integrate verified doctor data into healthcare platforms, booking systems, or telemedicine applications. Access real-time information about doctor availability and services.

#### Medical Database Building

Create comprehensive datasets for business intelligence, trend analysis, and healthcare planning. Support decision-making with structured, reliable medical professional data.

***

### Input Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `specialty` | String | No | `"dermatologist"` | Medical specialty to search for (e.g., "cardiologist", "pediatrician", "gynecologist") |
| `city` | String | No | `"lahore"` | Filter by city (e.g., "karachi", "islamabad", "rawalpindi") |
| `results_wanted` | Integer | No | `50` | Maximum number of doctor profiles to collect (1-1000) |
| `startUrls` | Array | No | `[]` | Custom Marham.pk doctor URLs to scrape (bypasses specialty/city filters) |
| `proxyConfiguration` | Object | No | Residential | Proxy settings for reliable scraping |

***

### Output Data

Each doctor profile contains:

| Field | Type | Description |
|-------|------|-------------|
| `name` | String | Doctor's full name |
| `specialty` | String | Medical specialization |
| `description` | String | Doctor's description (only from profile pages) |
| `qualifications` | String | Academic degrees and certifications (only from profile pages) |
| `experience` | String | Years of medical practice |
| `reviews_count` | String | Number of patient reviews |
| `satisfaction` | String | Patient satisfaction percentage |
| `fee` | String | Consultation fee in Pakistani Rupees |
| `city` | String | Practice location city |
| `address` | String | Complete practice address |
| `hospitals` | Array | List of affiliated hospitals and clinics |
| `services` | Array | Medical services offered |
| `about` | String | Professional biography and expertise |
| `image_url` | String | Doctor's profile image URL |
| `url` | String | Marham.pk profile link |
| `pmdc_verified` | Boolean | Pakistan Medical & Dental Council verification status |
| `video_consultation` | Boolean | Online consultation availability |

***

### Usage Examples

#### Basic Specialty Search

Extract dermatologists in Lahore:

```json
{
    "specialty": "dermatologist",
    "city": "lahore",
    "results_wanted": 50
}
```

#### Multi-Specialty Collection

Search for cardiologists across Pakistan:

```json
{
    "specialty": "cardiologist",
    "results_wanted": 100
}
```

#### Large-Scale Data Collection

Collect pediatricians from Karachi:

```json
{
    "specialty": "pediatrician",
    "city": "karachi",
    "results_wanted": 200
}
```

#### Custom URL Scraping

Scrape specific doctor profiles:

```json
{
    "startUrls": [
        "https://www.marham.pk/doctors/lahore/dermatologist/dr-example-1",
        "https://www.marham.pk/doctors/karachi/cardiologist/dr-example-2"
    ],
    "results_wanted": 50
}
```

***

### Sample Output

```json
{
    "name": "Dr. Sarah Ahmed",
    "specialty": "Dermatologist",
    "experience": "12 years",
    "reviews_count": "156",
    "satisfaction": "96%",
    "fee": "Rs. 2,500",
    "city": "Lahore",
    "address": "Johar Town, Lahore",
    "hospitals": ["Shaukat Khanum Hospital", "Doctors Hospital"],
    "services": ["Acne Treatment", "Laser Therapy", "Skin Consultation"],
    "about": "Experienced dermatologist specializing in cosmetic and medical dermatology...",
    "image_url": "https://staticconnect.marham.pk/assets/doctors/12345/dr-sarah-ahmed.jpg",
    "url": "https://www.marham.pk/doctors/lahore/dermatologist/dr-sarah-ahmed",
    "pmdc_verified": true,
    "video_consultation": true,
    "_source": "marham.pk"
}
```

***

### Tips for Best Results

#### Choose the Right Specialty

- Use exact specialty names as they appear on Marham.pk
- Common specialties: dermatologist, cardiologist, pediatrician, gynecologist, neurologist, orthopedic, ENT specialist
- Check Marham.pk's website if unsure about specialty naming

#### Optimize Collection Size

- Start with 20-50 results for testing and validation
- Increase to 100-200 for production data collection
- Balance between data quantity and runtime cost
- Consider running multiple smaller batches instead of one large collection

#### City Selection

- Major cities: lahore, karachi, islamabad, rawalpindi, faisalabad, multan
- Use lowercase city names for accurate matching
- Leave city empty to collect doctors across all locations
- Combine specialty + city filters for targeted results

#### Proxy Configuration

For reliable results, residential proxies are recommended:

```json
{
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": ["RESIDENTIAL"]
    }
}
```

***

### Integrations

Connect your doctor data with:

- **Google Sheets** — Export for analysis and sharing
- **Airtable** — Build searchable healthcare databases
- **Make (Integromat)** — Create automated healthcare workflows
- **Zapier** — Trigger actions based on new doctor data
- **Webhooks** — Send data to custom endpoints and applications
- **API** — Access data programmatically via Apify API

#### Export Formats

Download data in multiple formats:

- **JSON** — For developers and API integrations
- **CSV** — For spreadsheet analysis and Excel
- **Excel** — For business reporting and presentations
- **XML** — For system integrations and data exchange

***

### Frequently Asked Questions

#### What medical specialties can I search?

All specialties available on Marham.pk including dermatology, cardiology, gynecology, pediatrics, orthopedics, neurology, psychiatry, ENT, urology, gastroenterology, dentistry, and many more specialized fields.

#### Which Pakistani cities are supported?

All cities available on Marham.pk including major metropolitan areas (Lahore, Karachi, Islamabad, Rawalpindi) and smaller cities (Faisalabad, Multan, Peshawar, Quetta, Gujranwala, Sialkot, Hyderabad, and others).

#### How accurate is the extracted data?

Data is extracted directly from Marham.pk and reflects current information at the time of scraping. PMDC verification status indicates doctor authenticity. Some fields may be empty if not provided on the source profile.

#### Can I scrape multiple specialties at once?

Yes, use the `startUrls` parameter to provide multiple specialty listing pages, or run the actor multiple times with different specialty values and combine the results.

#### What is the difference between listing and profile extraction?

Listing extraction is faster and collects data from specialty pages (12-15 doctors per page). Profile extraction visits individual doctor pages for additional details but takes longer.

#### How long does it take to scrape 100 doctors?

Typically 2-5 minutes for listing extraction, 5-15 minutes for detailed profile scraping. Actual time depends on proxy speed and website response times.

#### What if I get blocked or rate limited?

The actor uses residential proxies and implements human-like delays to avoid blocking. If issues persist, reduce concurrency or increase delays between requests.

#### Can I schedule regular data updates?

Yes, use Apify's scheduler feature to run the actor daily, weekly, or at custom intervals to keep your doctor database up-to-date.

#### Is there a limit on results?

You can extract up to 1,000 doctors per run. For larger datasets, run the actor multiple times with different city or specialty filters.

#### How do I handle duplicate doctors?

The actor automatically deduplicates doctors within a single run. For multiple runs, use the `url` field as a unique identifier to filter duplicates in post-processing.

***

### Support

For issues or feature requests, contact support through the Apify Console.

#### Resources

- [Apify Documentation](https://docs.apify.com/)
- [API Reference](https://docs.apify.com/api/v2)
- [Scheduling Runs](https://docs.apify.com/schedules)
- [Proxy Configuration](https://docs.apify.com/proxy)

***

### Legal Notice

This actor is designed for legitimate data collection purposes. Users are responsible for ensuring compliance with Marham.pk's terms of service and applicable laws including data protection regulations. Use data responsibly, respect rate limits, and ensure your use case aligns with ethical data collection practices.

# Actor input Schema

## `startUrls` (type: `array`):

Array of Marham.pk doctor profile URLs to scrape. If provided, specialty and city filters will be ignored.

## `specialty` (type: `string`):

Medical specialty to search for (e.g., 'dermatologist', 'cardiologist', 'pediatrician', 'gynecologist', 'orthopedic', 'neurologist').

## `city` (type: `string`):

City to search in (e.g., 'lahore', 'karachi', 'islamabad', 'rawalpindi', 'faisalabad'). Leave empty for all cities.

## `results_wanted` (type: `integer`):

Maximum number of doctor profiles to collect from the sitemap.

## `scrapeDetailPages` (type: `boolean`):

Enable this to visit individual doctor profile pages for detailed information (description, qualifications, ratings, reviews, experience). Note: This is slower but provides more complete data.

## `proxyConfiguration` (type: `object`):

Proxy settings for scraping. Residential proxies recommended for better reliability.

## Actor input object example

```json
{
  "specialty": "dermatologist",
  "city": "lahore",
  "results_wanted": 50,
  "scrapeDetailPages": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

No description

# 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 = {
    "specialty": "dermatologist",
    "city": "lahore"
};

// Run the Actor and wait for it to finish
const run = await client.actor("shahidirfan/marham-pk-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 = {
    "specialty": "dermatologist",
    "city": "lahore",
}

# Run the Actor and wait for it to finish
run = client.actor("shahidirfan/marham-pk-scraper").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 '{
  "specialty": "dermatologist",
  "city": "lahore"
}' |
apify call shahidirfan/marham-pk-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=shahidirfan/marham-pk-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/pwzlFEMDryfcSxePC/builds/bpYsyB4fuHXAaEvlN/openapi.json
