Stack Overflow & Stack Exchange Q&A Scraper avatar

Stack Overflow & Stack Exchange Q&A Scraper

Pricing

from $0.30 / 1,000 questions

Go to Apify Store
Stack Overflow & Stack Exchange Q&A Scraper

Stack Overflow & Stack Exchange Q&A Scraper

Search Stack Overflow or any Stack Exchange site's free public API by keyword or tag and get one row per question — score, tags, author, view/answer counts and the accepted answer's text.

Pricing

from $0.30 / 1,000 questions

Rating

0.0

(0)

Developer

Murat Uzun

Murat Uzun

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

5 days ago

Last modified

Features

Limited permissions

Share

What is Stack Overflow & Stack Exchange Q&A Scraper?

Stack Overflow & Stack Exchange Q&A Scraper is an Apify Actor that searches Stack Overflow — or any of the 170+ other Stack Exchange sites (Super User, Server Fault, Ask Ubuntu, Math Stack Exchange, and more) — through their free, official StackExchange API v2.3. Give it one or more search phrases and/or tags, and it returns one clean row per question: title, score, view/answer counts, tags, author reputation, the question body, and — optionally — the accepted answer's full text. No scraping of stackoverflow.com pages, no API key required. Runs on Apify's schedule, webhook and API infrastructure, so a weekly "new questions in my niche" digest is a five-minute setup.

Closed and duplicate questions flagged: every row says whether moderators closed the question (isClosed, closedReason, closedAt), and a question closed as a duplicate links to its canonical question(s) in duplicateOf. Turn on Skip closed questions and the API drops them at the source, so you never pay for them. In a 28 November 2026 check, 10 of the 100 most recently active Stack Overflow questions matching "python" were closed.

Question comments included on request: turn on Include question comments and every row carries commentCount and the full comments list (author, reputation, score, date, text). Comments are where people ask for the missing version number, point to the duplicate, or post the one-line fix that never became an answer. In the same 28 November 2026 check, 80 of those 100 questions had at least one comment (343 comments in total). They arrive in the same API call, so there is no extra request and no extra charge.

Pricing: $0.50 per 1,000 questions on the Free plan ($0.30 on Gold and above), plus a $0.00005 start fee.

Why use Stack Overflow & Stack Exchange Q&A Scraper?

  • Documentation and support teams track newly asked questions about their product's tags (e.g. a library or framework name) to spot gaps worth writing a guide for.
  • Content researchers pull the highest-voted questions on a topic across Stack Overflow to see what developers actually struggle with.
  • Community managers monitor a Stack Exchange site other than Stack Overflow — Super User, Server Fault, a language-specific SE site — for their own brand or product mentions.
  • Dataset builders and LLM fine-tuners collect question/accepted-answer pairs on a topic in one flat, ready-to-import table, and keep closed or duplicate questions out of the training set with skipClosed, or map each duplicate to its canonical question with duplicateOf. With includeComments the clarifications under each question come along too.

How to use Stack Overflow & Stack Exchange Q&A Scraper

  1. Fill Search queries with one phrase per row, e.g. web scraping, playwright timeout.
  2. Set Site to the Stack Exchange site's API slug (stackoverflow by default; see the full list at stackexchange.com/sites).
  3. Optionally add Tags to narrow every query, e.g. python.
  4. Choose Sort by and set Minimum score and Max results per query.
  5. Turn on Include accepted answer if you want each question's accepted answer text too.
  6. Turn on Include question comments to add each question's comment thread.
  7. Turn on Skip closed questions to get open questions only. Leave it off to keep closed ones, flagged with their close reason.
  8. Click Start and export the dataset as JSON, CSV, Excel or HTML from the Output tab.

Example input

{
"queries": ["web scraping", "playwright timeout"],
"site": "stackoverflow",
"sortBy": "votes",
"minScore": 0,
"includeAnswers": false,
"skipClosed": false,
"maxResults": 50
}

Example output

{
"site": "stackoverflow",
"questionId": "76310103",
"title": "Cannot run Playwright test \"--ui\"",
"link": "https://stackoverflow.com/questions/76310103",
"score": 5,
"viewCount": 10151,
"answerCount": 2,
"isAnswered": true,
"acceptedAnswerId": "76583732",
"tags": ["reactjs", "playwright"],
"author": "Kode_12",
"authorReputation": 5016,
"createdAt": "2023-05-22T18:48:52.000Z",
"lastActivityAt": "2025-01-13T20:19:54.000Z",
"body": "I'm trying to run npx playwright test --ui to run the playwright e2e test files…",
"acceptedAnswerBody": null,
"isClosed": false,
"closedReason": null,
"closedAt": null,
"duplicateOf": [],
"query": "playwright timeout",
"scrapedAt": "2026-09-14T01:26:37.933Z",
"error": null
}

A question closed as a duplicate (live row, 28 November 2026, other fields as above):

{
"questionId": "80019100",
"isClosed": true,
"closedReason": "Duplicate",
"duplicateOf": [
{
"questionId": "240178",
"title": "List of lists changes reflected across sublists unexpectedly",
"link": "https://stackoverflow.com/questions/240178",
"acceptedAnswerId": "240205"
}
]
}

Data table

Stack Overflow & Stack Exchange Q&A Scraper extracts 21 fields per row:

FieldTypeDescription
site, questionId, title, linkstringSite slug, numeric id, title and public question URL
score, viewCount, answerCountnumberUpvotes minus downvotes, view count and answer count
isAnswered, acceptedAnswerIdboolean, stringWhether it has any answer, and the accepted one's id
tagsarrayThe question's tags
author, authorReputationstring, numberDisplay name and reputation of the question's owner
createdAt, lastActivityAtstringISO 8601 UTC timestamps
bodystringQuestion body, plain text, up to 5000 characters
acceptedAnswerBodystringAccepted answer text, plain text, up to 5000 characters (only with Include accepted answer)
isClosed, closedReason, closedAtboolean, string, stringWhether moderators closed the question, the Stack Exchange close reason (e.g. Duplicate, Needs details or clarity, Not suitable for this site) and when; null reason/date when open
duplicateOfarrayFor a duplicate: the canonical question(s) with questionId, title, link, acceptedAnswerId; empty otherwise
commentCount, commentsnumber, arrayWith Include question comments: how many comments the question has, and each comment as commentId, author, authorReputation, score, createdAt, edited, text (plain text). Without it: null and []
query, error, scrapedAtstringThe search that produced this row, error (always null on saved rows; failed queries go to ERRORS) and the run timestamp

Input parameters

ParameterTypeDefaultDescription
queriesarray["web scraping"]One search phrase per query
sitestringstackoverflowStack Exchange site API slug
taggedarray[]Tags applied to every query
sortBystringvotesrelevance, votes, creation or activity
minScoreinteger0Drop questions scoring below this
includeAnswersbooleanfalseAdd the accepted answer's full text
includeCommentsbooleanfalseAdd the question's comments (commentCount, comments); same request, no extra charge
skipClosedbooleanfalseReturn open questions only; closed ones are filtered by the API and never charged
maxResultsinteger50Max questions per query (1-500)
apiKeystring—Optional StackApps app key; raises the shared daily quota from 300 to 10,000 requests

Pricing

Stack Overflow & Stack Exchange Q&A Scraper uses pay-per-event pricing: $0.50 per 1,000 result rows on the free plan ($0.0005 per row), with volume tiers down to $0.30 per 1,000 on the top Apify plans, plus a negligible actor-start fee. A default run (one query, 50 questions) costs about 2.5 cents. Set Maximum cost per run and the Actor trims the work to what the budget covers instead of overspending.

Stack Overflow & Stack Exchange Q&A Scraper vs. the Stack Overflow search page

Stack Overflow's own search UI shows 15 results per page with no structured export, and searching a niche Stack Exchange site means visiting it separately. This Actor runs any number of queries — against Stack Overflow or any other Stack Exchange site — in one batch, and returns every result as a flat, typed row, ready to sort, filter or join with other data.

Dated Store check, 28 November 2026 (public Store API pricing, FREE tier per 1,000 rows; each row is one question or result):

ActorFREE priceUnitSource
This Actor$0.50 per 1,000one question rowhttps://apify.com/webdatatools/stackexchange-scraper
sian.agency/stack-exchange-scraper$6.00 per 1,000one extracted questionhttps://apify.com/sian.agency/stack-exchange-scraper
logiover/stack-exchange-questions-scraper$5.00 per 1,000one resulthttps://apify.com/logiover/stack-exchange-questions-scraper
hichemdev/stackoverflow-scraper$2.00 per 1,000one resulthttps://apify.com/hichemdev/stackoverflow-scraper
automation-lab/stackexchange-questions-answers-export$1.84 per 1,000 + $0.001 startone question or answerhttps://apify.com/automation-lab/stackexchange-questions-answers-export
brunofin/stack-exchange-question-stats$1.00 per 1,000one questionhttps://apify.com/brunofin/stack-exchange-question-stats
bgfc97/stack-exchange-scraper$0.75 per 1,000 + platform usageone questionhttps://apify.com/bgfc97/stack-exchange-scraper
chrisp1211/stackexchange-scraper-max$0.60 per 1,000one questionhttps://apify.com/chrisp1211/stackexchange-scraper-max

Closed-question status (28 November 2026, read from each Actor's input schema and documented output): sian.agency's output has an is_closed flag. None of sian.agency, logiover, ryanclinton, hichemdev, automation-lab, northglasslabs, chrisp1211, bgfc97 or brunofin documents a close reason, close date or duplicate-of link to the canonical question, and none has an input to skip closed questions before they are charged. ryanclinton's semanticDedup drops look-alike questions with OpenAI embeddings (your own OpenAI key). That is a similarity guess. It is not the moderators' closed-as-duplicate decision.

Question comments (28 November 2026, same sources): none of the nine documents an input or an output field for question comments. sian.agency and automation-lab return answers, not the comments under the question.

The Store entries are not identical in scope: some cover Stack Overflow only, and the rows may carry different fields. The Stack Exchange API used here covers all 170+ sites.

Use it from code

JavaScript (npm i apify-client):

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('webdatatools/stackexchange-scraper').call({
queries: ['web scraping'],
site: 'stackoverflow',
maxResults: 5,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.map((q) => [q.title, q.score, q.link]));

Python (pip install apify-client):

from apify_client import ApifyClient
client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("webdatatools/stackexchange-scraper").call(run_input={"queries": ["web scraping"], "site": "stackoverflow", "maxResults": 5})
for q in client.dataset(run["defaultDatasetId"]).iterate_items():
print(q["title"], q["score"], q["link"])

CLI (curl, or the Apify CLI with apify call webdatatools/stackexchange-scraper --silent --output-dataset):

curl -s -X POST "https://api.apify.com/v2/acts/webdatatools~stackexchange-scraper/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"queries": ["web scraping"], "site": "stackoverflow", "maxResults": 5}'

Using Stack Overflow & Stack Exchange Q&A Scraper with AI agents and MCP

Stack Overflow & Stack Exchange Q&A Scraper is pay-per-event with limited permissions — the two requirements for an Actor to be callable through the Apify MCP server at mcp.apify.com. An agent passes a queries list and gets back structured question rows — including, on request, the accepted answer's own text — ready to summarise "what are the top-voted answers about X" without the agent visiting stackoverflow.com itself.

FAQ

Does this need an API key? No. The StackExchange API's /search/advanced endpoint is free and unauthenticated, shared at 300 requests per IP per day. An optional apiKey (free at stackapps.com/apps/oauth/register) raises that to 10,000 requests per day — worth it for large or frequent runs.

Why is acceptedAnswerBody null even with Include accepted answer on? Many questions have no accepted answer at all (acceptedAnswerId is also null in that case) — isAnswered can still be true from an unaccepted answer.

What counts as the body? The question's own text (body_markdown from the API), HTML-decoded and with any inline HTML tags stripped down to plain text, truncated at 5000 characters. Markdown syntax like **bold** or `code` is left as-is.

How does tagged combine with queries? Every tag in tagged is applied to every query as an additional filter — a query of web scraping with tagged: ["python"] returns only Python-tagged questions matching that text.

What happens on the API's rate-limit backoff? When a response carries a backoff field (seconds), this Actor sleeps that long before its next request — automatically, with no configuration needed.

What are the limitations? minScore is applied after fetching, so a query can legitimately return fewer rows than maxResults once low-scoring questions are dropped. A query that fails or finds nothing produces no dataset row: it is listed in the ERRORS record (free) and named in the run's status message, while the other queries' rows are kept.

Do closed questions cost money? With Skip closed questions on, no: the Stack Exchange API filters them out (closed=False) before they reach the Actor, and maxResults is filled with open questions. With it off, a closed question is a normal row and is charged like any other. The OUTPUT record counts them in closedQuestions and duplicateQuestions.

Do comments cost extra? No. With Include question comments on, the comments come back in the same Stack Exchange API call as the question, so the run makes the same number of requests and each question is still one charged row. Only the response gets bigger. commentCount is the API's own count; OUTPUT adds questionsWithComments and commentsSaved. Comments under answers are not included.

Why is duplicateOf empty on a closed question? Only questions closed with the reason Duplicate point to a canonical question. Other close reasons (needs details, off-topic, opinion-based) have none.

How much does a run cost? You pay per result: $0.0005 per question on the Free plan, $0.0003 on Gold and above, plus a $0.00005 start fee. Failed queries and empty searches are not charged, and Maximum cost per run caps the spend.

Is this legal to run? Yes. The StackExchange API is a public, documented, officially supported endpoint built for third-party use, and all content returned is licensed CC BY-SA by its authors — this Actor collects no private or personal data beyond public display names.

Error codes

Each failed query is one ERRORS entry with an errorCode and costs nothing. The OUTPUT record has zeroResultReason, stoppedForTime and deadlineSource.

errorCodeMeaningWhat to do
INVALID_SITEThe site is not a Stack Exchange site slugUse the slug from stackexchange.com/sites
SOURCE_FAILEDThe StackExchange API failed or returned an unreadable answer (HTTP error, timeout, quota)Run again later, or add an apiKey
NO_QUESTIONSThe search matched no questions (No open questions found with skipClosed)Broaden the queries or tags, or turn skipClosed off
NO_SCORED_QUESTIONSQuestions matched, but none reached minScoreLower minScore
INVALID_INPUTThe input failed the schema, or no query or tag was givenFix the input
CHARGE_LIMITMaximum cost per run leaves no budget for one questionRaise Maximum cost per run
NO_RESULTSThe run saved no question; the reason is in OUTPUT.zeroResultReasonSee the reason

zeroResultReason: TIME_LIMIT means the run stopped before its timeout and saved no question with no source failure. Raise Timeout in Run options. A run that stops with saved questions ends SUCCEEDED with stoppedForTime: true.

Limitations

  • The free anonymous quota is 300 API requests per IP per day; add apiKey for 10,000.
  • minScore is applied after fetching, so a query can return fewer rows than maxResults.
  • sortBy follows the Stack Exchange API. It does not reproduce every ordering of the website search page.
  • Question bodies are truncated at 5,000 characters.

The full webdatatools suite is listed on the publisher profile.

Support

Open an issue on the Actor's Issues tab on Apify. Include the site, the query, the run ID and the ERRORS record if one exists.

If this Actor saved you time, a short review on its Apify Store page helps others find it.