# Medium Email Scraper (`leads-scraper/medium-email-scraper`) Actor

Medium Email Scraper SD - Medium Email Scraper is a lead generation tool that extracts leads with public contact emails, account names and profile URLs from Medium results by keyword, location and email domain - Medium email extractor.

- **URL**: https://apify.com/leads-scraper/medium-email-scraper.md
- **Developed by:** [Leads Scraper](https://apify.com/leads-scraper) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.49 / 1,000 results

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

Learn more: https://docs.apify.com/actors/running/actors-in-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

### Medium Email Scraper

The **Medium Email Scraper** extracts publicly indexed contact emails from Medium writer profiles, publications and stories, and delivers them as a structured dataset ready for JSON or CSV export.

Medium is where a very specific kind of person publishes: indie hackers and SaaS founders, ML and data-engineering practitioners, UX writers, crypto and fintech analysts, freelance journalists and technical ghostwriters. A large share close a post with a "want to work together?" line and an address.

The Medium Email Scraper collects those addresses at scale. It builds keyword-driven Google searches against `medium.com`, parses each result block structurally, and keeps only the emails matching the domains you list.

This is contact discovery through public search results. The Medium Email Scraper does not log in to Medium, does not use a Medium API, and does not open the Medium website — no browser, no JavaScript rendering, no authentication, no cookies.

#### Who needs a Medium writer contact scraper

Content agencies hiring freelancers, PR teams pitching bylines, developer-relations leads, recruiters sourcing technical writers, and B2B marketers looking for guest-post partners.

Medium profiles are self-selected proof of subject-matter expertise. That makes the Medium Email Scraper a sharper lead generation instrument than any follower-count directory.

***

### Key Features of the Medium Email Scraper

Everything below is genuinely implemented in the Medium Email Scraper. No roadmap items.

| Feature | What it does |
|---|---|
| Google SERP data collection | Builds `site:medium.com` queries and fetches result pages through the Apify GOOGLE\_SERP proxy |
| Query expansion | Base, quoted and `intitle:` variants plus one variant per modifier, to get past Google's per-query result ceiling |
| Domain filtering | Only emails ending in your listed domains survive (`@gmail.com`, `@yahoo.com` by default) |
| Global deduplication | One row per unique email across every query, page and keyword in the run |
| Email normalisation | Understands `name [at] domain [dot] com`, `name (at) domain`, `name @ domain.com`, `domain .com`, zero-width characters and the full-width `＠` |
| Junk filter | Rejects placeholders such as `email@`, `yourname@`, `test@`, `xxx@` and single-character locals |
| Boundary-correct matching | `@gmail.com` never matches inside `@gmail.company` or `@gmail.com.br` |
| Soft-wrap repair | Discards a hit that is only the tail of another email in the same result block |
| Concurrency control | An `asyncio` worker pool runs queries in parallel with a shared stop signal on `maxEmails` |
| Retry logic | Up to 3 attempts per page with exponential backoff and a fresh proxy session per request |
| Block detection | CAPTCHA, "unusual traffic" and consent pages are detected and retried, never counted as empty |
| Resumable state | Progress persists in the key-value store, saved on `PERSIST_STATE`, `MIGRATING` and `ABORTING` |
| Structural parser | Locates the `<h3>` title then the smallest surrounding block, rather than trusting Google's CSS class names |
| Whole-page fallback | A markup change degrades the crawler to "emails without account details", never to "no emails" |
| Streaming dataset writes | Every lead is pushed to the Apify dataset the moment it is found |

***

### How the Medium Email Scraper Works

The Medium Email Scraper pipeline has six stages and no hidden state.

1. **Read input.** Keywords, optional location, email domains, limits and concurrency.
2. **Build queries.** Each keyword pairs with each domain into a `site:medium.com` search, e.g. `site:medium.com technical writer "@gmail.com" "Berlin"`.
3. **Expand queries.** With `expandQueries` on, quoted and `intitle:` phrasings also run, plus one variant per modifier. Base queries always go first.
4. **Fetch result pages.** Asynchronous `aiohttp` requests through the Apify GOOGLE\_SERP proxy, with pagination up to `maxPagesPerQuery`.
5. **Parse blocks.** The parser reads the result title, the Medium site label and the story snippet as metadata for each candidate lead.
6. **Extract, deduplicate, store.** A domain-filtered regex pulls addresses from the block text; new ones stream into the dataset, duplicates are dropped.

Everything the Medium Email Scraper returns was already visible to anyone running the same search manually.

***

### What Data Does the Medium Email Scraper Extract

Each item carries the same 14 fields, so the output schema of the Medium Email Scraper never shifts between runs.

| Field | Meaning |
|---|---|
| `network` | Platform name |
| `keyword` | The keyword that produced the lead |
| `query` | The exact Google query used |
| `title` | Raw result title |
| `accountName` | Account label Google prints |
| `fullName` | Display name parsed from a profile-style title; empty for story snippets |
| `username` | URL-safe Medium handle when one is exposed; otherwise `null` |
| `profileUrl` | Canonical Medium profile URL when a handle is known; otherwise empty |
| `url` | Direct Medium link when exposed, else the profile URL |
| `description` | Bio or story snippet, cleaned of labels and engagement counters |
| `email` | Lower-cased email address |
| `emailDomain` | The matched domain, e.g. `@gmail.com` |
| `possiblyTruncated` | `true` when Google's snippet ellipsis touched the email |
| `foundAt` | ISO 8601 UTC timestamp |

Medium handles are `@`-prefixed, so a populated `username` yields a `profileUrl` of the form `https://medium.com/@handle`.

***

### Input Fields

Nine fields drive the Medium Email Scraper. Only `keywords` is required.

| Field | Type | Default | Description |
|---|---|---|---|
| `keywords` | array (required) | `["writer", "founder"]` | Search terms: niche, job title, industry |
| `location` | string | `""` | Optional location phrase added to every query |
| `customDomains` | array | `["@gmail.com", "@yahoo.com"]` | Only emails on these domains are kept; the `@` is optional |
| `maxEmails` | integer 1–10000 | `20` | Stop after this many unique emails |
| `countryCode` | string | `""` | Two-letter country for the search proxy (US, GB, DE…) |
| `expandQueries` | boolean | `true` | Search each keyword × domain pair in several phrasings |
| `queryModifiers` | array | `["email", "contact", "write for", "freelance", "consulting"]` | Extra words combined with each keyword when expansion is on |
| `maxPagesPerQuery` | integer 1–50 | `30` | Pagination cap per query |
| `maxConcurrency` | integer 1–20 | `5` | Parallel queries |

#### JSON input example

```json
{
  "keywords": ["technical writer", "machine learning engineer", "indie hacker"],
  "location": "Berlin",
  "customDomains": ["@gmail.com", "@protonmail.com"],
  "maxEmails": 350,
  "countryCode": "DE",
  "expandQueries": true,
  "queryModifiers": ["email", "contact", "write for", "freelance", "consulting"],
  "maxPagesPerQuery": 30,
  "maxConcurrency": 5
}
```

***

### Output Schema and Dataset Export

The Medium Email Scraper writes leads to the Apify dataset as they are discovered, so results accumulate visibly during the run.

#### JSON output example

```json
{
  "network": "Medium",
  "keyword": "technical writer",
  "query": "site:medium.com technical writer \"@gmail.com\" \"Berlin\"",
  "title": "Lena Hoffmann (@lenahoffmann) - Medium",
  "accountName": "lenahoffmann",
  "fullName": "Lena Hoffmann",
  "username": "lenahoffmann",
  "profileUrl": "https://medium.com/@lenahoffmann",
  "url": "https://medium.com/@lenahoffmann",
  "description": "Technical writer in Berlin. I write about developer docs, API design and DX. Freelance enquiries: lena.hoffmann.docs@gmail.com",
  "email": "lena.hoffmann.docs@gmail.com",
  "emailDomain": "@gmail.com",
  "possiblyTruncated": false,
  "foundAt": "2026-08-31T12:33:19.605Z"
}
```

Export the Medium Email Scraper dataset as JSON, CSV, XLSX or XML from the Apify console, or read it over the API into your CRM.

***

### How to Run It

1. Open the Medium Email Scraper on Apify and click **Try for free**.
2. Replace the default keywords with the writing niche you are targeting — `UX researcher`, `devrel engineer`, `crypto analyst`, `SaaS growth writer`.
3. Set the email domains you want. A narrow list produces a cleaner dataset than a broad one.
4. Optionally add a `location` and a `countryCode` if you need writers in a specific market.
5. Choose `maxEmails` and start the run.
6. Follow the live log: it reports pages fetched, blocked pages, retries and emails per page.
7. Export the dataset, or chain the Medium Email Scraper into a workflow through the Apify API.

#### Tips for a better yield

Feed the Medium Email Scraper a role plus a topic. `writer` is broad; `fintech content writer` is a query that converts.

Leave query expansion on. The `write for`, `freelance` and `consulting` modifiers are tuned for how Medium bios are actually phrased.

If a niche runs dry, change `customDomains` before you change the keyword — writers often list a work address on a different provider than their personal one.

***

### Use Cases for the Medium Email Scraper

| Use case | How the Medium Email Scraper helps |
|---|---|
| Freelance writer sourcing | Build a shortlist of writers with demonstrated output in your topic |
| Guest post and backlink outreach | Find authors who already publish adjacent content and pitch collaborations |
| Developer relations | Reach practitioners writing about your stack, SDK or API |
| Recruiting | Source technical writers, analysts and engineers who publish publicly |
| PR and media relations | Pitch stories to independent journalists and analysts on Medium |
| Content and competitor research | Map who writes in a category and how they position their expertise |
| CRM enrichment | Append profile URLs and bio snippets to existing contact records |
| Newsletter and podcast recruitment | Invite proven writers to contribute or appear as guests |

***

### Why Choose This Actor

Medium has no exportable author directory, and its own search surfaces stories rather than contact details.

The Medium Email Scraper automates the tedious half of Medium lead generation — searching, paginating, copying, deduplicating — and leaves the editorial judgement to you.

Because the Medium Email Scraper parses structurally instead of by CSS class name, and because a whole-page fallback exists, a Google layout change degrades result quality rather than breaking the run.

It also complements its siblings. Writers migrate: pair the Medium Email Scraper with the [Substack Email Scraper](https://apify.com/leads-scraper/substack-email-scraper) for the ones who moved to newsletters, and with the [Quora Email Scraper](https://apify.com/leads-scraper/quora-email-scraper) for the consultants answering questions in the same niche.

For the professional and social layer around an author, the [LinkedIn Email Scraper](https://apify.com/leads-scraper/linkedin-email-scraper) covers their B2B footprint, the [X Email Scraper](https://apify.com/leads-scraper/x-email-scraper) catches their short-form posting, and the [Reddit Email Scraper](https://apify.com/leads-scraper/reddit-email-scraper) reaches the communities where their work circulates.

***

### Limitations

These constraints on the Medium Email Scraper are real. Read them before your first run.

- **Only publicly indexed emails.** The Medium Email Scraper finds addresses Google has already crawled. A writer who never published an email will not appear.
- **Google's result cap.** A single query returns roughly 300 results at most. That is precisely why query expansion exists — leave it enabled.
- **`possiblyTruncated`.** When Google's snippet ellipsis touches an address, the row is flagged `true`. Verify those before outreach.
- **Apify GOOGLE\_SERP proxy required.** The Medium Email Scraper cannot run without Apify proxy credentials.
- **Free-plan cap.** Free Apify plans are limited to 100 emails per run; paid plans are uncapped.
- **`username` and `profileUrl` availability.** These are populated only when Medium exposes a handle in Google's result. Story and publication pages sometimes print only a display name, so those rows keep `accountName` and `fullName` but have an empty `username` and `profileUrl`. That is a Google limitation, not a bug.
- **Variable yield.** Output depends on keywords, domains and location. No volume is guaranteed.

***

### Example: a full run

A typical Medium Email Scraper run with three keywords, two domains, expansion on and `maxEmails: 350`.

The Medium Email Scraper issues base queries first (`site:medium.com indie hacker "@gmail.com"`), then quoted and `intitle:` variants, then one variant per modifier — `email`, `contact`, `write for`, `freelance`, `consulting`.

Five queries run concurrently, each paginating until it runs dry or reaches `maxPagesPerQuery`. Addresses are normalised, domain-filtered, deduplicated globally and streamed to the dataset until the 350th unique email trips the shared stop signal.

Blocked or failed queries are re-queued once at the end of the run, so a transient CAPTCHA does not quietly cost you a whole keyword.

***

### Related Actors

The Medium Email Scraper belongs to a family of contact-discovery Actors that share this engine and output schema.

| Actor | What it collects |
|---|---|
| [Medium Email and Phone Number Scraper](https://apify.com/leads-scraper/medium-email-and-phone-number-scraper) | Emails and phone numbers from Medium |
| [Medium Phone Number Scraper](https://apify.com/leads-scraper/medium-phone-number-scraper) | Public phone numbers from Medium |
| [Behance Email Scraper](https://apify.com/leads-scraper/behance-email-scraper) | Public contact emails from Behance |
| [Bigo Live Email Scraper](https://apify.com/leads-scraper/bigo-live-email-scraper) | Public contact emails from Bigo Live |
| [Bluesky Email Scraper](https://apify.com/leads-scraper/bluesky-email-scraper) | Public contact emails from Bluesky |
| [Bumble Email Scraper](https://apify.com/leads-scraper/bumble-email-scraper) | Public contact emails from Bumble |
| [Clubhouse Email Scraper](https://apify.com/leads-scraper/clubhouse-email-scraper) | Public contact emails from Clubhouse |
| [Dailymotion Email Scraper](https://apify.com/leads-scraper/dailymotion-email-scraper) | Public contact emails from Dailymotion |
| [DeviantArt Email Scraper](https://apify.com/leads-scraper/deviantart-email-scraper) | Public contact emails from DeviantArt |
| [Discord Email Scraper](https://apify.com/leads-scraper/discord-email-scraper) | Public contact emails from Discord |
| [Dribbble Email Scraper](https://apify.com/leads-scraper/dribbble-email-scraper) | Public contact emails from Dribbble |
| [Facebook Email Scraper](https://apify.com/leads-scraper/facebook-email-scraper) | Public contact emails from Facebook |
| [Goodreads Email Scraper](https://apify.com/leads-scraper/goodreads-email-scraper) | Public contact emails from Goodreads |
| [Hinge Email Scraper](https://apify.com/leads-scraper/hinge-email-scraper) | Public contact emails from Hinge |
| [Instagram Email Scraper](https://apify.com/leads-scraper/instagram-email-scraper) | Public contact emails from Instagram |
| [KakaoTalk Email Scraper](https://apify.com/leads-scraper/kakaotalk-email-scraper) | Public contact emails from KakaoTalk |
| [Kick Email Scraper](https://apify.com/leads-scraper/kick-email-scraper) | Public contact emails from Kick |
| [Lemon8 Email Scraper](https://apify.com/leads-scraper/lemon8-email-scraper) | Public contact emails from Lemon8 |
| [Likee Email Scraper](https://apify.com/leads-scraper/likee-email-scraper) | Public contact emails from Likee |
| [LINE Email Scraper](https://apify.com/leads-scraper/line-email-scraper) | Public contact emails from LINE |
| [LinkedIn Email Scraper](https://apify.com/leads-scraper/linkedin-email-scraper) | Public contact emails from LinkedIn |
| [Mastodon Email Scraper](https://apify.com/leads-scraper/mastodon-email-scraper) | Public contact emails from Mastodon |
| [Mixcloud Email Scraper](https://apify.com/leads-scraper/mixcloud-email-scraper) | Public contact emails from Mixcloud |
| [Patreon Email Scraper](https://apify.com/leads-scraper/patreon-email-scraper) | Public contact emails from Patreon |
| [Pinterest Email Scraper](https://apify.com/leads-scraper/pinterest-email-scraper) | Public contact emails from Pinterest |
| [Quora Email Scraper](https://apify.com/leads-scraper/quora-email-scraper) | Public contact emails from Quora |
| [Reddit Email Scraper](https://apify.com/leads-scraper/reddit-email-scraper) | Public contact emails from Reddit |
| [Rumble Email Scraper](https://apify.com/leads-scraper/rumble-email-scraper) | Public contact emails from Rumble |
| [Snapchat Email Scraper](https://apify.com/leads-scraper/snapchat-email-scraper) | Public contact emails from Snapchat |
| [SoundCloud Email Scraper](https://apify.com/leads-scraper/soundcloud-email-scraper) | Public contact emails from SoundCloud |
| [Substack Email Scraper](https://apify.com/leads-scraper/substack-email-scraper) | Public contact emails from Substack |
| [Telegram Email Scraper](https://apify.com/leads-scraper/telegram-email-scraper) | Public contact emails from Telegram |
| [Threads Email Scraper](https://apify.com/leads-scraper/threads-email-scraper) | Public contact emails from Threads |
| [TikTok Email Scraper](https://apify.com/leads-scraper/tiktok-email-scraper) | Public contact emails from TikTok |
| [Tinder Email Scraper](https://apify.com/leads-scraper/tinder-email-scraper) | Public contact emails from Tinder |
| [Tumblr Email Scraper](https://apify.com/leads-scraper/tumblr-email-scraper) | Public contact emails from Tumblr |
| [Twitch Email Scraper](https://apify.com/leads-scraper/twitch-email-scraper) | Public contact emails from Twitch |
| [Vimeo Email Scraper](https://apify.com/leads-scraper/vimeo-email-scraper) | Public contact emails from Vimeo |
| [VK Email Scraper](https://apify.com/leads-scraper/vk-email-scraper) | Public contact emails from VK |
| [WeChat Email Scraper](https://apify.com/leads-scraper/wechat-email-scraper) | Public contact emails from WeChat |
| [Weibo Email Scraper](https://apify.com/leads-scraper/weibo-email-scraper) | Public contact emails from Weibo |
| [X Email Scraper](https://apify.com/leads-scraper/x-email-scraper) | Public contact emails from X |

### FAQ

#### What is the Medium Email Scraper?

An Apify Actor that extracts publicly indexed contact emails from Medium writer profiles, publications and stories via Google search results and writes them to a structured dataset.

#### Does the Medium Email Scraper log in to Medium?

No. The Medium Email Scraper does not log in, does not call a Medium API, and does not open medium.com. It reads Google search results only.

#### Where do the emails come from?

Titles, snippets and site labels in Google's public index — usually an address a writer put in their bio or at the end of a story. The Medium Email Scraper reads nothing else.

#### Can I choose which email providers are returned?

Yes. `customDomains` filters the Medium Email Scraper's extraction step. Defaults are `@gmail.com` and `@yahoo.com`, and the leading `@` is optional.

#### Why is `username` empty on some rows?

Google sometimes prints only a display name for a story or publication result. Where no handle is exposed, `username` is `null` and `profileUrl` is empty, while `accountName` and `fullName` remain populated.

#### What does `possiblyTruncated: true` mean?

Google's snippet ellipsis touched the address, so it may be cut off. Treat those rows as unverified before sending anything.

#### How many Medium writer emails will one run return?

It depends on keywords, domains and location — no volume is guaranteed. Free Apify plans stop at 100 emails per run; paid plans are uncapped.

#### Do I need a proxy?

Yes. The Medium Email Scraper requires the Apify GOOGLE\_SERP proxy and will not run without Apify proxy credentials.

#### Should I leave query expansion on?

Almost always. Google caps a single query near 300 results, and expansion is how the Medium Email Scraper works around that ceiling.

#### Does the output schema ever change?

No. Every item the Medium Email Scraper writes carries the same 14 fields, which keeps downstream mapping stable.

#### Is this affiliated with Medium?

No. It is an independent Apify Actor, not endorsed by or connected to Medium.

#### Can I export to CSV or schedule recurring runs?

Yes. Export as JSON, CSV, XLSX or XML, and use Apify Schedules to run the Medium Email Scraper on a recurring basis into the same dataset.

***

### Leave a review

If the Medium Email Scraper saved you time, please leave a star rating and a short review on
the Actor page.

Reviews are how other buyers judge whether a tool works, and they tell us which features to
build next.

If something did not work, email <neurodata.apify@gmail.com>
instead - bugs get fixed faster than they get complained about.

### Support

Questions about the Medium Email Scraper, feature requests, or need a custom build? Email **neurodata.apify@gmail.com**.

Not affiliated with, endorsed by, or officially connected to Medium. Use collected data in line with applicable privacy and anti-spam law.

# Actor input Schema

## `keywords` (type: `array`):

Search terms describing the Medium accounts you want (niche, job title, industry).

## `location` (type: `string`):

Optional location phrase added to every query (e.g. "New York").

## `customDomains` (type: `array`):

Only emails ending with one of these domains are collected. With or without the leading @. Each domain is searched separately, so more domains means more results but a longer run - remove some for a faster, narrower search, or add your own (e.g. @company.com).

## `maxEmails` (type: `integer`):

Stop once this many unique emails have been collected.

## `countryCode` (type: `string`):

Two-letter country code for the search proxy (e.g. US, GB, DE). Empty for any.

## `expandQueries` (type: `boolean`):

Search each keyword x domain pair with several phrasings. Recommended - Google caps a single query at ~300 results.

## `queryModifiers` (type: `array`):

Extra words combined with each keyword when Expand queries is on. Tuned for Medium.

## `maxPagesPerQuery` (type: `integer`):

Google rarely returns more than ~30 pages for one query.

## `maxConcurrency` (type: `integer`):

How many queries run in parallel.

## Actor input object example

```json
{
  "keywords": [
    "writer",
    "founder"
  ],
  "location": "",
  "customDomains": [
    "@gmail.com",
    "@yahoo.com"
  ],
  "maxEmails": 20,
  "countryCode": "",
  "expandQueries": true,
  "queryModifiers": [
    "email",
    "contact",
    "write for",
    "freelance",
    "consulting"
  ],
  "maxPagesPerQuery": 30,
  "maxConcurrency": 5
}
```

# Actor output Schema

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

Records produced by Medium Email Scraper, stored in the run's default dataset.

# 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 = {
    "keywords": [
        "writer",
        "founder"
    ],
    "location": "",
    "customDomains": [
        "@gmail.com",
        "@yahoo.com"
    ],
    "countryCode": "",
    "queryModifiers": [
        "email",
        "contact",
        "write for",
        "freelance",
        "consulting"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("leads-scraper/medium-email-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 = {
    "keywords": [
        "writer",
        "founder",
    ],
    "location": "",
    "customDomains": [
        "@gmail.com",
        "@yahoo.com",
    ],
    "countryCode": "",
    "queryModifiers": [
        "email",
        "contact",
        "write for",
        "freelance",
        "consulting",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("leads-scraper/medium-email-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 '{
  "keywords": [
    "writer",
    "founder"
  ],
  "location": "",
  "customDomains": [
    "@gmail.com",
    "@yahoo.com"
  ],
  "countryCode": "",
  "queryModifiers": [
    "email",
    "contact",
    "write for",
    "freelance",
    "consulting"
  ]
}' |
apify call leads-scraper/medium-email-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,leads-scraper/medium-email-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/HhcSLESJLGtwJ43aZ/builds/PyOH0iFvLpzie5aco/openapi.json
