Social media · Coming soon

Stack Overflow & Stack Exchange Q&A Scraper

Pick a site and a tag, a search or a list of question links. Get one row per question with the answers inside. It works with Stack Overflow and 170+ other sites.

Built and tested. Prices will be shown after release.

Coming soon to the Apify StoreFollow us on Apify

What you get, for example

sitestackoverflow
questionId77823456
titleApify: weird costs for using key-value stores

How it will work: 3 steps

  1. Follow us on ApifyThe tool is built and waits in the queue for the Apify Store. Apify is the cloud platform where our tools run.
  2. Paste your input and press StartNo code needed: you fill in a form (the input). It already has a working example. For example: apify in Tags. Each start is one run.
  3. Download the resultsWhen the run ends, the results are in a table (the dataset). Open Output, press Export and pick Excel or CSV. JSON and the API are there too.

This tool is an Apify Actor: a small program that runs on Apify. You can also run it on a schedule, for example every Monday. New to it? Read how it works, step by step and the 8 words you need first.

What it does

Stack Overflow & Stack Exchange Q&A Scraper exports questions with their answers from Stack Overflow and the other Stack Exchange sites (Super User, Server Fault, Ask Ubuntu, Mathematics and 170+ more). You pick a site and a tag, a search query or a list of question links, and get one table row per question with the title, body, tags, votes, author and the answers inside the same row.

Good for

  • Watch new questions about your product tag on Stack Overflow.
  • Build a question-and-answer dataset in Markdown for search, RAG or an LLM.
  • Save a list of known threads with all answers and votes.
  • Find the most-voted questions on a topic on any Stack Exchange site.

Not a good fit

  • No comments, user profiles, badges or chat. Only questions and their answers.
  • No private or deleted content. Deleted questions come back as not_found rows.
  • Answer links (/a/<id>) are not looked up. Use the question link instead.
  • The data is live: votes, views and answers can change between runs.

Who uses it

Product teams

Watch new questions about your product tag.

AI builders

Build a Q&A dataset in Markdown for search, RAG or an LLM.

Researchers

Find the most-voted questions on a topic on any Stack Exchange site.

Price

Prices will be shown after release.

Questions

Do I need a Stack Overflow account or API key?

No. It uses the official public API. The key field is optional and only raises the quota.

Are answers charged separately?

No. Answers are inside the question row. One question row is one charge.

Which sites work?

Stack Overflow, Super User, Server Fault, Ask Ubuntu, Mathematics and many more public sites.

Does it get comments or user profiles?

No. It gets questions and their answers only.

Are the numbers live?

Yes. Each run reads the API at that moment; fetchedAt shows when. Votes, views and answers change over time.

Is personal data included?

Only public profile data shown on the site: the author's user ID, display name, reputation and profile link. No email, location or other profile details.

Details

Step by step on Apify
  1. Open the Input tab.
  2. Keep Site at the prefilled stackoverflow and Tags at the prefilled apify, or type your own tag.
  3. Keep Max questions at the prefilled 10. Mode stays at the default tag.
  4. Click Start.
  5. Open the Questions view of the output and check title, score and answers.
Use cases
TaskInputYou getKey fieldsNext step
Follow questions about your producttags: ["your-tag"], sort: newest, scheduledquestion rowstitle, link, createdAt, isAnsweredSend unanswered ones to your support channel
Build an LLM or RAG datasettags, sort: votes, bodyFormat: markdownrows with answersbody, answers[].body, answers[].isAccepted, attributionLoad into a vector store, keep the credit line
Research a topicmode: search, query, fromDatequestion rowsscore, viewCount, tagsCount questions per month or per tag
Save known threadsmode: question, questionsone row per threadanswers, acceptedAnswerId, lastActivityAtArchive or compare over time
Tips for better results
  • Use your own tag on a daily schedule to see new questions.
  • Add a free Stack Apps key to raise the daily quota.
  • Use question links when you need known threads with answers.
Limits and good to know
  • Up to 1,000 questions per run. We tested 1,000 questions with 16,522 answers in one run: COMPLETE in 150–220 seconds
  • Without an API key, the Stack Exchange API gives about 300 requests per day per IP address. One request reads up to 100 questions with answers, so normal runs use a few requests. RUN_SUMMARY shows the remaining quota
  • The API asks clients to wait between some requests. The Actor follows this, so big runs take minutes, not seconds
  • If the daily quota runs out, the run stops as CAPPED with reason QUOTA_LIMIT, keeps saved rows and suggests an apiKey. If nothing was saved yet, the run is ERROR
  • The Actor stops reading at about 270 seconds so it can save the results within the 300-second timeout (CAPPED, DEADLINE)

For developers

Sample result

One result from a real test run, in JSON. Real values change from run to run. In Excel or CSV each field is a column.

one result · JSON
{
  "site": "stackoverflow",
  "questionId": 77823456,
  "title": "Apify: weird costs for using key-value stores",
  "link": "https://stackoverflow.com/questions/77823456/apify-weird-costs-for-using-key-value-stores",
  "tags": ["node.js", "apify"],
  "score": 0,
  "upVotes": 1,
  "downVotes": 1,
  "viewCount": 213,
  "answerCount": 1,
  "isAnswered": true,
  "acceptedAnswerId": null,
  "commentCount": null,
  "bountyAmount": null,
  "isClosed": false,
  "closedReason": null,
  "closedAt": null,
  "createdAt": "2024-01-16T04:20:59.000Z",
  "lastActivityAt": "2024-01-16T13:03:25.000Z",
  "lastEditedAt": null,
  "author": {
    "userId": 2486638,
    "displayName": "Alvein",
    "reputation": 217,
    "userType": "registered",
    "profileUrl": "https://stackoverflow.com/users/2486638/alvein"
  },
  "bodyFormat": "markdown",
  "body": "I'm working with Node.js but I think my question is language-agnostic.\n\nIn my Apify actor, First I do a few long scrapes…",
  "answers": [
    {
      "answerId": 77825927,
      "link": "https://stackoverflow.com/questions/77823456/apify-weird-costs-for-using-key-value-stores/77825927#77825927",
      "score": 1,
      "upVotes": 1,
      "downVotes": 0,
      "isAccepted": false,
      "commentCount": 1,
      "createdAt": "2024-01-16T13:03:25.000Z",
      "lastActivityAt": "2024-01-16T13:03:25.000Z",
      "lastEditedAt": null,
      "author": {
        "userId": 9898465,
        "displayName": "Lukáš Křivka",
        "reputation": 983,
        "userType": "registered",
        "profileUrl": "https://stackoverflow.com/users/9898465/luk%c3%a1%c5%a1-k%c5%99ivka"
      },
      "body": "Apify doesn't charge for how big the writes are. Apify charges for number of writes and then for time based storage…",
      "license": "CC BY-SA 4.0",
      "licenseUrl": "https://creativecommons.org/licenses/by-sa/4.0/"
    }
  ],
  "answersIncluded": 1,
  "answersComplete": true,
  "license": "CC BY-SA 4.0",
  "licenseUrl": "https://creativecommons.org/licenses/by-sa/4.0/",
  "attribution": "\"Apify: weird costs for using key-value stores\" by Alvein (https://stackoverflow.com/users/2486638/alvein), https://stackoverflow.com/questions/77823456/apify-weird-costs-for-using-key-value-stores, licensed under CC BY-SA 4.0",
  "rank": 8
}
Data fields (37)
FieldTypeMeaning
sitestringSite as requested, e.g. stackoverflow or math.stackexchange.com.
questionIdintegerQuestion ID on that site.
titlestringQuestion title, HTML entities decoded.
linkstringQuestion URL.
tagsarrayQuestion tags.
scoreintegerScore (up minus down votes).
upVotesintegerUp votes.
downVotesintegerDown votes.
viewCountintegerViews.
answerCountintegerTotal answers on the site (0 = none, null = unknown).
isAnsweredbooleantrue when the question has an accepted or upvoted answer (Stack Exchange definition).
acceptedAnswerIdintegerID of the accepted answer, null if none.
commentCountintegerComments on the question.
bountyAmountintegerOpen bounty in reputation, null if none.
isClosedbooleantrue if the question is closed.
closedReasonstringReason the question was closed.
closedAtstringWhen it was closed, ISO 8601 UTC.
createdAtstringCreated, ISO 8601 UTC.
lastActivityAtstringLast activity, ISO 8601 UTC.
lastEditedAtstringLast edit, ISO 8601 UTC; null if never edited.
authorobjectPublic author profile: userId, displayName, reputation, userType, profileUrl. null for deleted users.
bodyFormatstringFormat of body fields in this row.
bodystringQuestion body in bodyFormat.
answersarrayAnswers (accepted first, then score). null when includeAnswers is off.
answersIncludedintegerAnswers in this row; null when answers are off.
answersCompletebooleantrue when every answer of the question is included.
licensestringQuestion licence from the API, e.g. CC BY-SA 4.0.
licenseUrlstringCreative Commons licence URL.
attributionstringReady-made CC BY-SA attribution line: title, author, link, licence.
rankintegerPosition in tag/search results (1 = first); null in question mode.
inputstringYour question ID or URL as given (question mode).
inputsarraynot_found and error rows: every question ID or URL this row covers (one row per batch with the same outcome). null on question rows.
statusstringRow result. complete and partial rows are charged; not_found and error rows are free.
statusReasonstringPlain-English reason for partial, not_found or error rows.
errorCodestringMachine code for error rows, e.g. INVALID_INPUT, QUOTA_EXHAUSTED.
sourceUrlstringOfficial API request that produced the row (no key).
fetchedAtstringWhen the row was fetched, ISO 8601 UTC.
Input settings (13)

The main fields of the input form. With the API you send them as JSON.

SettingName in the APITypeExample value
Modemodestring"tag"
Sitesitestring"stackoverflow"
Tagstagsarray["apify"]
Search queryquerystring
Question IDs or URLsquestionsarray
Sortsortstring"newest"
Max questionsmaxQuestionsinteger10
Include answersincludeAnswersbooleantrue
Max answers per questionmaxAnswersPerQuestioninteger30
Body formatbodyFormatstring"markdown"
Created fromfromDatestring
Created untiltoDatestring
Stack Exchange API key (optional)apiKeystring

Start on Apify

Make a free Apify account: you get $5 of free usage every month. Missing a tool? Suggest it. We read every idea, but we do not promise to build it.

Apify links on this page are affiliate links. We may earn a commission. You pay the same price. Affiliate disclosure