# Stack Overflow Scraper (`ensorcelling_melilot/stackoverflow-scraper`) Actor

- **URL**: https://apify.com/ensorcelling_melilot/stackoverflow-scraper.md
- **Developed by:** [ensorcelling \_melilot](https://apify.com/ensorcelling_melilot) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 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.

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

## Stack Overflow Scraper

Export **Stack Overflow questions, answers, tags and users** to JSON, CSV, Excel or straight into your app. It works on **every Stack Exchange site** (Server Fault, Super User, Ask Ubuntu, Mathematics, Data Science and 170+ more).

It uses the **official Stack Exchange API**, so you don't need a login, proxies or a browser, and nothing breaks when the site's layout changes.

### What can you do with it?

- **Market and product research:** find the questions developers ask most about your tool, library or competitor.
- **Content ideas and SEO:** pull the highest-voted unanswered questions in a tag and write the answers people are searching for.
- **Build AI / RAG datasets:** export questions and accepted answers with full bodies for a topic. Content is CC BY-SA, and attribution links are included.
- **Developer relations:** track new questions about your product every day with a scheduled run.
- **Hiring and community research:** list top users by reputation for a tag or location.

### What data do you get?

| Mode | Fields |
|---|---|
| Questions / Search | title, link, tags, score, views, answer count, answered?, accepted answer ID, author, author reputation, created / last activity dates, optional HTML body |
| Answers | answer ID, question ID, link, score, accepted?, author, dates, optional HTML body |
| Tags | tag name, number of questions, link |
| Users | name, reputation, location, website, profile link, badge counts, dates |

#### Example output

```json
{
  "type": "question",
  "site": "stackoverflow",
  "questionId": 79012345,
  "title": "How do I merge two DataFrames on multiple columns?",
  "url": "https://stackoverflow.com/questions/79012345/...",
  "tags": ["python", "pandas"],
  "score": 42,
  "viewCount": 18234,
  "answerCount": 3,
  "isAnswered": true,
  "authorName": "dev_jane",
  "createdAt": "2026-03-02T14:11:09.000Z"
}
```

### How to use it

1. Pick **What to export** (Questions, Search, Answers, Tags or Users).
2. Optionally add **tags**, a **search text**, a **date range** or a **minimum score**.
3. Set **Max results** and click **Start**.
4. Download the results as JSON, CSV, Excel or HTML, or connect them to Google Sheets, Zapier, Make or your own code through the Apify API.

**Tip:** The free Stack Exchange quota is 300 API requests per day per IP (about 30,000 results). For bigger jobs, register a free key at [stackapps.com](https://stackapps.com/apps/oauth/register) and paste it into **Stack Exchange API key**. That raises the limit to 10,000 requests a day.

### Pricing

You pay only for results you get, with no monthly fee. The price per 1,000 results is shown on the pricing tab.

### FAQ

**Is this legal?** Yes. It uses Stack Exchange's public, official API within its published rate limits. Content on Stack Exchange is licensed CC BY-SA, so keep the attribution links (`url`) if you republish it.

**Can I scrape other Stack Exchange sites?** Yes. Put the site's API name in **Site**, for example `serverfault`, `superuser`, `askubuntu`, `math` or `unix`.

**Why did my run stop early?** Either there were no more matching results, or the daily API quota ran out. Add a free API key to fix the latter.

**Found a bug or need a field?** Open an issue on the **Issues** tab. We usually reply within a day or two.

# Actor input Schema

## `mode` (type: `string`):

Questions (optionally filtered by tags), full-text search, answers for given questions, tags, or users.

## `site` (type: `string`):

Any Stack Exchange site's API name, e.g. stackoverflow, serverfault, superuser, askubuntu, math, datascience.

## `tags` (type: `array`):

Only questions that have ALL of these tags (Questions and Search modes).

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

Search mode: free text to search for. Tags and Users modes: filter by name.

## `questionIds` (type: `array`):

Answers mode: up to 100 question IDs to export answers for.

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

Order of results. Hot, week and month apply to Questions mode only; Answers mode supports activity, votes and creation.

## `fromDate` (type: `string`):

Only items created on or after this date (YYYY-MM-DD).

## `toDate` (type: `string`):

Only items created on or before this date (YYYY-MM-DD).

## `minScore` (type: `integer`):

Skip items with a lower vote score.

## `includeBody` (type: `boolean`):

Add the full post body as HTML (Questions, Search and Answers modes). Makes each record larger.

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

Stop after this many records. You are charged per record saved.

## `apiKey` (type: `string`):

Free key from stackapps.com. Raises the daily limit from 300 to 10,000 requests.

## Actor input object example

```json
{
  "mode": "questions",
  "site": "stackoverflow",
  "tags": [
    "python"
  ],
  "sort": "activity",
  "includeBody": false,
  "maxItems": 100
}
```

# Actor output Schema

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

Exported questions, answers, tags or users.

## `allFields` (type: `string`):

Every record with all 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 = {
    "tags": [
        "python"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ensorcelling_melilot/stackoverflow-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 = { "tags": ["python"] }

# Run the Actor and wait for it to finish
run = client.actor("ensorcelling_melilot/stackoverflow-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 '{
  "tags": [
    "python"
  ]
}' |
apify call ensorcelling_melilot/stackoverflow-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ensorcelling_melilot/stackoverflow-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/9BUVUYASzaQCbzIyU/builds/hzEWIgiHC9qg8O5YS/openapi.json
