SDK de Node.js
SDK de Node.js
Sección titulada «SDK de Node.js»El SDK oficial de Node.js para HydraSkill.
Instalación
Sección titulada «Instalación»npm install hydraskillInicio rápido
Sección titulada «Inicio rápido»import { ProxyClient } from 'hydraskill';
const client = new ProxyClient({ apiKey: process.env.HYDRASKILL_API_KEY });
const proxy = await client.getProxy({ target: 'amazon.com', sessionLock: true, country: 'US',});
// Usar con fetchconst response = await fetch('https://amazon.com', { agent: proxy.toAgent(),});
// Liberarawait proxy.release();Con Puppeteer
Sección titulada «Con Puppeteer»import puppeteer from 'puppeteer';import { ProxyClient } from 'hydraskill';
const client = new ProxyClient();const proxy = await client.getProxy({ target: 'amazon.com' });
const browser = await puppeteer.launch({ args: [`--proxy-server=${proxy.toProxyUrl()}`],});
const page = await browser.newPage();await page.authenticate({ username: proxy.username, password: proxy.password });await page.goto('https://amazon.com');TypeScript
Sección titulada «TypeScript»Soporte completo de TypeScript con tipos exportados:
import { ProxyClient, Proxy, ProxyOptions } from 'hydraskill';
const options: ProxyOptions = { target: 'amazon.com', sessionLock: true,};
const proxy: Proxy = await client.getProxy(options);