# Stack Overflow Scraper — Questions, Tags & Answers (`dami_studio/stackexchange-scraper`) Actor

Mine the biggest developer Q\&A on earth for product research, docs gaps and training data. Search Stack Overflow, Server Fault, Super User, Ask Ubuntu, MathOverflow or Software Engineering by keyword and tags, and get score, answer count, views, answered flag, author reputation and clean body text.

- **URL**: https://apify.com/dami\_studio/stackexchange-scraper.md
- **Developed by:** [Dami's Studio](https://apify.com/dami_studio) (community)
- **Categories:** Developer tools, Integrations, Other
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $2.00 / 1,000 question returneds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## Stack Overflow / Stack Exchange Scraper

Search **Stack Overflow** — or any of the big Stack Exchange sites (Server Fault, Super User, Ask Ubuntu, MathOverflow, Software Engineering) — by keyword and/or tags, and get back clean, structured questions. No API key, no login, no anti-bot.

It talks to the public `api.stackexchange.com` API directly, so results are fast and reliable. It paginates for you, dedupes by question id, and returns the question body as plain text (HTML stripped).

### What you get per question

`questionId`, `title`, `url`, `score`, `answerCount`, `viewCount`, `isAnswered`, `tags`, `ownerName`, `ownerReputation`, `createdAt` (ISO), and `body` (the question text, HTML stripped).

### Input

| Field | Notes |
|---|---|
| `query` | Keywords (title + body). Optional if you give `tags`. |
| `site` | `stackoverflow`, `serverfault`, `superuser`, `askubuntu`, `mathoverflow`, `softwareengineering`. |
| `tags` | Comma-separated, e.g. `javascript,promise`. A question must carry **all** of them. |
| `sortBy` | `votes` (default), `relevance`, `creation`, `activity`. |
| `maxItems` | How many questions to collect (paginates the API in pages of 100). |

You must provide a `query` **or** at least one `tag`.

### Output

One dataset row per question. Empty searches return a single diagnostic row and **are not charged**.

### Example

```json
{ "query": "async await", "site": "stackoverflow", "tags": "javascript", "sortBy": "votes", "maxItems": 50 }
```

### Notes

The unauthenticated Stack Exchange API allows ~300 requests/day per IP. The actor respects the API's `backoff` directive (sleeps when asked) and stops cleanly when the daily quota is exhausted, returning a clear diagnostic instead of failing silently. For very large jobs, split by tag, keyword, or site.

# Actor input Schema

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

Keywords to search for in question titles and bodies (e.g. "async await", "git rebase conflict"). Can be left empty if you provide one or more Tags instead.

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

Which Stack Exchange network site to search.

## `tags` (type: `string`):

Comma-separated tags to filter by, e.g. "javascript,promise" or "python,pandas". Optional. A question must carry ALL listed tags. You can search by tags alone with an empty query.

## `sortBy` (type: `string`):

Ordering of results. "votes" = highest score first, "relevance" = best keyword match, "creation" = newest, "activity" = most recently active.

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

Maximum number of questions to return. The actor paginates the API (100 per page) until this many are collected or there are no more results.

## `notionConnector` (type: `string`):

Optional. Write each question as a page into your Notion when the run finishes. Authorize a Notion connector once in Settings → API & Integrations → MCP connectors, then pick it here. Leave empty to skip (default) — results are always saved to the dataset regardless.

## `notionParentId` (type: `string`):

Optional. The Notion data source ID of the database to write into (only used if a Notion connector is set). Leave empty to create the pages privately in your workspace instead.

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

Proxy used for the API requests. The Stack Exchange API is open (no anti-bot), so a proxy is optional; Apify Proxy is fine if you want one.

## Actor input object example

```json
{
  "query": "async await",
  "site": "stackoverflow",
  "tags": "javascript",
  "sortBy": "votes",
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Scraped rows are stored in the default dataset (one row per result). Blocked/empty/error runs return a single uncharged diagnostic row instead.

# 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 = {
    "query": "async await",
    "tags": "javascript"
};

// Run the Actor and wait for it to finish
const run = await client.actor("dami_studio/stackexchange-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 = {
    "query": "async await",
    "tags": "javascript",
}

# Run the Actor and wait for it to finish
run = client.actor("dami_studio/stackexchange-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 '{
  "query": "async await",
  "tags": "javascript"
}' |
apify call dami_studio/stackexchange-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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