Skip to main content

What is Superagent?

Superagent is a lightweight HTTP request library for Node.js. It is highly extensible through a plugin system, allowing it to handle complex tasks like proxy authentication or retries while maintaining a cleaner, more readable syntax than older libraries like request. Using Oculus proxies allows you to mimic requests coming from different locations, preventing rate-limiting on your main IP.
If you’re using Oculus to scrape search engines like Google, Bing, or Yandex and facing connection issues, your proxy type may need adjustment. ISP Premium Proxies provide stable and unrestricted access, preventing blocks that standard proxies may encounter. Switching to ISP Premium Proxies can improve performance.

How to Use Oculus Proxies With Superagent

1

Install package

Install via cmd:
npm install superagent superagent-proxy
2

Example code

Use the following code as an example for Superagent. Make sure to replace proxyUri with the correct proxy credentials from your dashboard.
const superagent = require('superagent');
require('superagent-proxy')(superagent); 

const proxyUri = 'http://USERNAME:[email protected]:PORT';

superagent
.get('http://httpbin.org/ip')
.proxy(proxyUri)
.end((err, res) => {
if (err) return console.error(err);
console.log('IP via Superagent:', res.text);
});