# Stack Exchange Scraper — Questions, Scores & Tags (`eins332570/stackexchange-scraper`) Actor

Scrape Stack Overflow & Stack Exchange questions — title, score, views, answers, tags, owner & dates — via the official Stack Exchange API. Full-text search any site or fetch by question ID. Great for developer research, tag trends & content monitoring. No login, no key, no proxy.

- **URL**: https://apify.com/eins332570/stackexchange-scraper.md
- **Developed by:** [thanachit singruang](https://apify.com/eins332570) (community)
- **Categories:** Developer tools
- **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.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#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 Exchange Scraper — Questions, Scores & Tags

Scrape **Stack Overflow** and any **Stack Exchange** site — question titles, scores, views, answer counts, tags, owners, and dates — into **one unified dataset** using the official Stack Exchange API. No login, no proxies, no browser, no API key.

Full-text search any site (Stack Overflow, Super User, Server Fault, Math, …) or fetch specific questions by ID.

### What you get

Every question is one row (`recordType: "question"`):

| Field | Description |
|---|---|
| `questionId` | question ID |
| `title` | question title |
| `link` | link to the question |
| `score` | net votes |
| `viewCount` | view count |
| `answerCount` | number of answers |
| `isAnswered` / `hasAcceptedAnswer` | answered flags |
| `tags` | list of tags |
| `owner` | asker's display name |
| `createdAt` / `lastActivityAt` | ISO timestamps |
| `site` | the Stack Exchange site |

### Sample output

```json
{
  "recordType": "question",
  "questionId": "37576685",
  "title": "Using async/await with a forEach loop",
  "link": "https://stackoverflow.com/questions/37576685/using-async-await-with-a-foreach-loop",
  "score": 3353,
  "viewCount": 2480549,
  "answerCount": 35,
  "isAnswered": true,
  "hasAcceptedAnswer": true,
  "tags": ["javascript", "node.js", "promise"],
  "owner": "Saad",
  "createdAt": "2016-06-01T18:55:58.000Z",
  "site": "stackoverflow"
}
```

### Input

```json
{
  "search": ["async await"],
  "questionIds": [],
  "site": "stackoverflow",
  "sort": "votes",
  "tagged": "javascript",
  "pageSize": 30
}
```

- **search** — full-text queries.
- **questionIds** — specific question IDs to fetch.
- **site** — Stack Exchange site (default `stackoverflow`).
- **sort** — `votes` / `activity` / `creation` / `relevance`.
- **tagged** — optional tag filter (e.g. `javascript` or `javascript;node.js`).
- **pageSize** — max questions per query (1–100).

### Use cases

- **Developer research** — find the highest-voted questions on a topic or tag
- **Tag & trend monitoring** — track activity around a technology
- **Content & SEO** — mine popular questions for articles, docs, or FAQs
- **Support triage** — surface unanswered high-view questions in your domain

### FAQ

**Do I need an API key or login?** No — the Stack Exchange API is public and works key-free for reasonable volumes.

**Is it free to try?** Yes — click **Try for free** and run the prefilled search (`async await`) in seconds.

**Can I scrape sites other than Stack Overflow?** Yes — set `site` to any Stack Exchange site (e.g. `superuser`, `math`, `serverfault`).

**Is this allowed?** It uses the official Stack Exchange API, which is provided for exactly this kind of use.

### Pricing

**Pay per result — $5 per 1,000 questions.** Runs that return nothing cost nothing. No monthly fee, no proxy costs.

# Actor input Schema

## `search` (type: `array`):

Full-text search a Stack Exchange site. Each query returns up to `pageSize` questions. Example: \["async await", "pandas merge"].

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

Fetch specific questions by their numeric ID.

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

Stack Exchange site (e.g. stackoverflow, superuser, serverfault, math).

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

Sort order for search.

## `tagged` (type: `string`):

Optional tag(s) to require (e.g. javascript or javascript;node.js).

## `pageSize` (type: `integer`):

Cap questions per search query (1–100).

## Actor input object example

```json
{
  "search": [
    "async await"
  ],
  "site": "stackoverflow",
  "sort": "votes",
  "pageSize": 30
}
```

# Actor output Schema

## `items` (type: `string`):

All scraped question records as dataset items.

# 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": [
        "async await"
    ]
};

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

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

```

## MCP server setup

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