0.0.4 • Published 1 year ago

@scrapechain/oxylabs v0.0.4

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

@scrapechain/oxylabs

A lightweight, unofficial SDK for using Oxylabs proxies. Includes helper methods for rotating sessions, generating endpoints, and more — all provided through a consistent interface shared across proxy providers.

🚀 Features

  • Converts proxy options into a ready-to-use URL
  • Built-in defaults for protocol, endpoint, port, and session behavior
  • Easy session rotation to change IP addresses
  • Normalized configuration interface across all ScrapeChain proxy SDKs

📦 Installation

  npm install @scrapechain/oxylabs

⚡ Quickstart

Init proxy

import { OxylabsResidentialProxy } from '@scrapechain/oxylabs';

const proxy = new OxylabsResidentialProxy({
  username: 'yourOxylabsUsername',
  password: 'yourPassword',
  country: 'United States of America',
  sticky: true,
});

Construct your proxy with Proxy Properties.

.toUrl()

const proxyUrl = proxy.toUrl();

console.log(proxyUrl);
http://customer-yourOxylabsUsername-cc-US-sessid-3469265147-sesstime-10:yourPassword@pr.oxylabs.io:7777

Returns a full proxy URL string.

Since the sticky property is truthy, it embeds a random sessionid in the username.

The session length defaults to 10 min, but can be changed with stickySessionDurationMinutes (max 30 min). The sessionid will stay the same until .rotate() is invoked or manually overridden with the property stickySessionId.

.rotate()

proxy.rotate();

Sets sessionid to a random number, which will point to a new IP address.

.pingIP()

const ipDetails = await proxy.pingIp();

console.log(ipDetails)
{
  success: true,
  ip: "76.91.176.189",
  latencyMs: 714,
}

Verifies the proxy is working and returns the IP and latency.

This will make a quick request to https://api.ipify.org/?format=json

.details

console.log(proxy.details)
{
  protocol: "http",
  endpoint: "pr.oxylabs.io",
  port: 7777,
  username: "customer-yourOxylabsUsername-cc-US-sessid-5245948176-sesstime-10",
  password: "yourPassword",
}

Returns a structured object with proxy connection details.

This is part of a common interface shared across all providers.

⚙️ Proxy properties

PropertyTypeRequiredDefaultDescription
usernamestringYour Oxylabs customer username.
passwordstringYour Oxylabs password.
countryCountry (string enum)Country to geo-target the proxy IP.
stickybooleanfalseEnables sticky sessions (same IP across requests).
stickySessionIdnumberAuto-generatedCustom session ID for sticky mode (optional override).
stickySessionDurationMinutesnumber10Duration of sticky session in minutes.
portnumber7777Proxy port.
endpointstringpr.oxylabs.ioProxy hostname.
protocol"http", "https", "socks5""http"Proxy protocol to use.

License

This project is licensed under the MIT. See the LICENSE file for details.

0.2.7

1 year ago

0.2.6

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago