Reddit Scraper avatar
Reddit Scraper
Try for free

1 day trial then $45.00/month - No credit card required now

View all Actors
Reddit Scraper

Reddit Scraper

trudax/reddit-scraper
Try for free

1 day trial then $45.00/month - No credit card required now

Unlimited Reddit web scraper to crawl posts, comments, communities, and users without login. Limit web scraping by number of posts or items and extract all data in a dataset in multiple formats.

The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn more

Node.js

Python

curl

1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4const client = new ApifyClient({
5    token: '<YOUR_API_TOKEN>',
6});
7
8// Prepare Actor input
9const input = {
10    "startUrls": [
11        {
12            "url": "https://www.reddit.com/r/pasta/comments/vwi6jx/pasta_peperoni_and_ricotta_cheese_how_to_make/"
13        }
14    ],
15    "maxItems": 10,
16    "maxPostCount": 10,
17    "maxComments": 10,
18    "maxCommunitiesCount": 2,
19    "maxUserCount": 2,
20    "scrollTimeout": 40,
21    "proxy": {
22        "useApifyProxy": true,
23        "apifyProxyGroups": [
24            "RESIDENTIAL"
25        ]
26    }
27};
28
29(async () => {
30    // Run the Actor and wait for it to finish
31    const run = await client.actor("trudax/reddit-scraper").call(input);
32
33    // Fetch and print Actor results from the run's dataset (if any)
34    console.log('Results from dataset');
35    console.log(`๐Ÿ’พ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
36    const { items } = await client.dataset(run.defaultDatasetId).listItems();
37    items.forEach((item) => {
38        console.dir(item);
39    });
40})();
41
42// ๐Ÿ“š Want to learn more ๐Ÿ“–? Go to โ†’ https://docs.apify.com/api/client/js/docs
Developer
Maintained by Community
Actor metrics
  • 213 monthly users
  • 98.8% runs succeeded
  • 0.4 days response time
  • Created in Feb 2022
  • Modified 21 days ago
Categories