Apify example task · whoareyouanas/reddit-scraper

Compare top posts across two data science subreddits

Sample public posts from r/datascience and r/dataengineering. Compare topics, scores and source links using a shared sorting and scope.

Actor
Reddit Scraper - Posts, Comments & Search
Result limit
10 (maxItems)
Estimated cost
Up to $0.015
Run options
Actor defaults

Example updated 2026-11-20 · actor build 2.1.5 · runs in your own Apify account

01 / About the actor

Reddit Scraper - Posts, Comments & Search

Export archived Reddit posts and nested comments from Reddit URLs or keyword searches scoped to a subreddit. Filter by date and flair and download CSV, Excel, or JSON.

URLs or subreddit search

Provide a Reddit post, subreddit, or profile URL, or search for a keyword in a particular subreddit.

Nested comments

Collect available replies alongside post records when comments are enabled.

Scoped exports

Choose filters and record caps before exporting for research.

02 / Input

The exact input this example runs.

Set startUrls for URL-based collection. For keyword searches, provide searches and a subreddit scope. Set explicit caps for the record types you need.

input.json · reddit-compare-public-data-communities
{
  "includeNSFW": false,
  "maxItems": 10,
  "proxy": {
    "useApifyProxy": true
  },
  "startUrls": [
    {
      "url": "https://www.reddit.com/r/datascience/"
    },
    {
      "url": "https://www.reddit.com/r/dataengineering/"
    }
  ],
  "sort": "top",
  "time": "month",
  "maxPostCount": 5,
  "skipComments": true
}
Input fields used by this example, their values and what they control
FieldValue in this exampleWhat it controls
includeNSFWChange thisfalseInclude adult-rated posts, associated comments, and subreddits in results.
maxItemsChange this10Hard cap on the total number of items saved to the dataset across all categories.
proxy1 settingsLegacy proxy setting retained for saved inputs. This actor uses a public archive.
startUrlsChange thishttps://www.reddit.com/r/datascience/, https://www.reddit.com/r/dataengineering/Paste Reddit post, comment, subreddit, user, or search-page URLs. Clear this field to use the keyword search form.
sortChange this"top"Rank results by recency, keyword relevance, score, activity, or comment count.
timeChange this"month"Limit results to a recent time window (most useful with sort = top or controversial).
maxPostCountChange this5Maximum posts saved for each subreddit, search term, user, or post URL. Use 0 for a comments-only or metadata-only run.
skipCommentsChange thistrueSkip scraping comments when going through posts.
Other inputs you can add (8)
Deployed actor input fields, types, defaults, and descriptions
FieldType / requiredDefaultPurpose
ignoreStartUrlsbooleanfalseSet to true to bypass the Start URLs field (used as a fix for tools like Zapier).
searchesarrayNot specifiedKeywords to search in the archive. With Start URLs, use the searchTerms API alias to run both.
searchCommunityNamestringNot specifiedSearch inside one subreddit, such as programming or r/programming. Without a scope the archive only searches communities whose names match the keyword.
searchPostsbooleantrueInclude matching posts in search results.
searchCommentsbooleanfalseSearch comment text in the selected community.
searchCommunitiesbooleanfalseInclude matching communities (subreddits) in search results.
searchUsersbooleanfalseInclude matching user profiles in search results.
skipUserPostsbooleanfalseSkip scraping a user's submitted posts when going through their profile.

03 / Make it yours

Change these fields for your own research.

  1. 01 · includeNSFW

    Include NSFW content

    Include adult-rated posts, associated comments, and subreddits in results.

    Example: false

  2. 02 · maxItems

    Max items (total)

    Hard cap on the total number of items saved to the dataset across all categories.

    Example: 10

  3. 03 · startUrls

    Start URLs

    Paste Reddit post, comment, subreddit, user, or search-page URLs. Clear this field to use the keyword search form.

    Example: https://www.reddit.com/r/datascience/, https://www.reddit.com/r/dataengineering/

  4. 04 · sort

    Sort

    Rank results by recency, keyword relevance, score, activity, or comment count.

    Example: "top"

  5. 05 · time

    Time filter

    Limit results to a recent time window (most useful with sort = top or controversial).

    Example: "month"

  6. 06 · maxPostCount

    Max posts per target

    Maximum posts saved for each subreddit, search term, user, or post URL. Use 0 for a comments-only or metadata-only run.

    Example: 5

  7. 07 · skipComments

    Skip comments

    Skip scraping comments when going through posts.

    Example: true

Run it in three steps

  1. Open the example on Apify and select Try for free to copy it into your Apify account.
  2. Replace the sample values above with your own target and keep the limit small.
  3. Start the run, then export the dataset as JSON, CSV or Excel.

04 / Output

What the results table shows.

Columns in the “Post columns” view

id

ID

username

Author

title

Title

communityName

Community

body

Body

flair

Flair

postType

Post type

upVotes

Up votes

numberOfComments

Comments

isVideo

Video

over18

NSFW

url

URL

createdAt

Created

A view selects columns for the table. The full JSON export keeps every field, including nested arrays and objects.

05 / Cost

What this example costs to run.

At most about $0.015: up to 10 results at $0.0015 each (Reddit result) plus $0.0005 per GB of memory for the start event. Fewer results cost less. The live Pricing tab on Apify is authoritative.

Prices checked 2026-11-23. Set a run spending limit in Apify when you widen the input.

06 / API

Run the same input from your code.

This call starts a billable run of Reddit Scraper - Posts, Comments & Search with this example's input and returns the dataset items when it finishes. Synchronous calls wait up to five minutes; for longer runs, POST to /runs instead and read the run's default dataset when it succeeds. Keep the token in an environment variable.

cURL · run and return the results
curl --request POST \
  'https://api.apify.com/v2/acts/whoareyouanas~reddit-scraper/run-sync-get-dataset-items?format=json' \
  --header "Authorization: Bearer $APIFY_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{"includeNSFW":false,"maxItems":10,"proxy":{"useApifyProxy":true},"startUrls":[{"url":"https://www.reddit.com/r/datascience/"},{"url":"https://www.reddit.com/r/dataengineering/"}],"sort":"top","time":"month","maxPostCount":5,"skipComments":true}'

Coverage & interpretation

Check the result before relying on it.

Questions

About this example.

What does the "Compare top posts across two data science subreddits" example collect?

Sample public posts from r/datascience and r/dataengineering. Compare topics, scores and source links using a shared sorting and scope. It runs Reddit Scraper - Posts, Comments & Search, published by whoareyouanas on Apify.

Which input does this example use?

Include NSFW content (includeNSFW) set to false; Max items (total) (maxItems) set to 10; Start URLs (startUrls) set to https://www.reddit.com/r/datascience/, https://www.reddit.com/r/dataengineering/; Sort (sort) set to "top"; Time filter (time) set to "month"; Max posts per target (maxPostCount) set to 5. The full JSON input is shown on this page.

How much does it cost to run this example?

At most about $0.015: up to 10 results at $0.0015 each (Reddit result) plus $0.0005 per GB of memory for the start event. Fewer results cost less. The live Pricing tab on Apify is authoritative.

How do I change it for my own research?

Open the example on Apify and select Try for free to copy it into your account, then edit Include NSFW content, Max items (total), Start URLs, Sort, Time filter, Max posts per target, Skip comments. Keep the result limit small for the first run and check the output before scaling up.

Can I run it from the API or on a schedule?

Yes. Send the same JSON input to the Reddit Scraper - Posts, Comments & Search run endpoint with your Apify API token, or save the copied task in your Apify account and add a schedule. Results land in the run's default dataset as JSON, CSV or Excel.

More examples

Related tasks you can copy.

Guides

Read more about this workflow.