Download posts from Reddit with Node.js
Use Reddit Scraper to get posts from Reddit with Node.js. Want to grab posts from Reddit? Reddit Scraper makes it quick and easy. Just tell it what to download and you’ll get your Reddit post available offline, for whenever you want it.
1Get an Apify account
You can’t get data from the inside of the platform if you’re not authorized in it. So to get started, create an Apify account. It only takes a minute and it's free of charge.
Sign up for free2Initialize the API using your token
After you’ve registered, it’s time to add your secret authentication token. You can find your API token on the Integrations page in Apify Console.
Get your token in Console3Define input and copy it in JSON
To get the data from Reddit you first need to use Reddit Scraper to extract it. So let’s add a simple input and transfer it to your code. You can copy your input as a JSON from the Reddit Scraper’s Input tab in Console.
4Integrate Apify into your codebase
Finally, call the Reddit Scraper from your Node.js project. Use Apify Client or Endpoints. You’ll be able to export scraped Reddit data in no time by running the sample code below ↓.
5Monitor your Reddit Scraper runs
Head over to our dashboard and see how Reddit Scraper runs are executed in real time. Here you can also download the run logs and keep an eye on the API’s performance.
Go to dashboardGet your Node.js project up and running
Add-on to step 4: start your Node.js project by executing this code snippet in your go-to environment.
1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4// Replace the '<YOUR_API_TOKEN>' with your token
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9// Prepare Actor input
10const input = {
11 "startUrls": [
12 {
13 "url": "https://www.reddit.com/r/pasta/comments/vwi6jx/pasta_peperoni_and_ricotta_cheese_how_to_make/"
14 }
15 ],
16 "sort": "new",
17 "maxItems": 10,
18 "maxPostCount": 10,
19 "maxComments": 10,
20 "maxCommunitiesCount": 2,
21 "maxUserCount": 2,
22 "scrollTimeout": 40,
23 "proxy": {
24 "useApifyProxy": true,
25 "apifyProxyGroups": [
26 "RESIDENTIAL"
27 ]
28 }
29};
30
31// Run the Actor and wait for it to finish
32const run = await client.actor("trudax/reddit-scraper").call(input);
33
34// Fetch and print Actor results from the run's dataset (if any)
35console.log('Results from dataset');
36console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
37const { items } = await client.dataset(run.defaultDatasetId).listItems();
38items.forEach((item) => {
39 console.dir(item);
40});
41
42// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs
Enjoy $5 of free platform usage every month to explore and kickstart your projects.
Get started on Apify instantly without the hassle of entering your credit card information.
Join our Discord community to ask questions, share ideas, and connect with developers.
Reddit Scraper Lite
trudax/reddit-scraper-lite
Pay Per Result, 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.
4k
57
Reddit Scraper
trudax/reddit-scraper
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.
5k
66
Reddit API Scraper
comchat/reddit-api-scraper
Reddit Scraper is a powerful tool that allows you to extract data from Reddit such as posts by keyword. With Reddit Scraper, you can easily gather valuable information from Reddit without the need to log in. You can easily use this Reddit scraper as an alternative API.
521
10
Ready to start downloading Reddit posts?
You just need a free Apify account
Instagram video downloader
pocesar/download-instagram-video
Download Instagram videos in bulk
414
5
Instagram Photos Downloader
easyapi/instagram-photos-downloader
Effortlessly save high-quality images from Instagram posts and profiles. Simply copy the photo URL, paste it into our tool, and download your favorite images in HD. Enjoy a user-friendly experience without the need for an Instagram account. Start preserving your favorite moments today!
30
4
Instagram Videos Downloader
easyapi/instagram-videos-downloader
A powerful Instagram video downloader that helps you download videos from Instagram posts, reels, and stories. Support batch downloading with multiple URLs.
10
0
Apify’s wide range of tools use a technique called web scraping to extract public data from websites. These scrapers access the website the same way as you would with a browser, find the image, video, or text you want, and download it for you. They’re a fast and efficient way to get data at scale.
Web scraping is a handy method for collecting information from various websites. It's like having a digital assistant that visits web pages on your behalf, pulling out the details you need such as prices, descriptions, addresses, and contact information. But it's more than just text; this tool can also download images and videos, making it a comprehensive way to gather content from the online world. It takes care of all the complex, technical parts, so you don't have to.
Web scraping is a method where you choose websites to collect specific content, including text, images, and videos. You begin by identifying the web pages that host the visual media you're interested in. Next, you use a web scraping tool tailored to locate the parts of the page containing the images or videos you want to download. Once the tool is set up and run, it navigates to the chosen web pages, identifies the images and videos, and downloads them for you. It's a streamlined way to gather pictures and videos from online sources without having to manually download each item.
Yes, web scraping is legal for gathering public information from websites. But be careful with personal or confidential data, as well as intellectual property, because laws and regulations might protect them. It's good practice to check the website's rules or terms of service to know what's allowed. If you're not sure, getting legal advice can help ensure you're using web scraping correctly and within the law.
Actors are serverless cloud programs that run on the Apify platform and do computing jobs. They’re called Actors because, like human actors, they perform actions based on a script. They can perform anything from simple actions (such as filling out a web form or sending an email) to complex operations (such as crawling an entire website or removing duplicates from a large dataset). Actor runs can be as short or as long as necessary. They could last seconds, hours, or even run infinitely.