proxy configuration object with your request.
Basic Setup
To route your requests through our gateway, you need to provide thehost, port, and auth details in the proxy object.
You’ll need to have
axios installed in your project: npm install axiosbasic_setup.js
Real-World Example: Scraping Reddit API for subreddit data
A common task is to collect structured data from public APIs. Let’s use Axios to scrape data from Reddit’s JSON API for a highly relevant subreddit: /r/webscraping. Reddit, like many sites, may serve different content or ads based on geography. We’ll check the “hot” posts from both the US and Great Britain (GB) to demonstrate this capability. This example shows how to create a reusable function to dynamically change the proxy’s country for each request.reddit_scraper.js
Expected Output
Running this script will produce an output similar to this:Terminal