[go: up one dir, main page]

proxifly

2.0.2 • Public • Published




Site | NPM Module | GitHub Repo

proxifly is the official npm module of Proxifly, a free service to get SOCKS, HTTP, & HTTPS proxies as well as to check your public IP!

🌐 Proxifly Works in Node AND browser environments

Yes, this module works in both Node and browser environments, including compatibility with Webpack and Browserify!

🦄 Features

  • Getting proxy lists
    • An API to get HTTP, HTTPS, and SOCKS proxies
    • Easily filter by country, speed, and anonymity level
    • Request multiple proxies at a time
  • Check your public IP
    • Blazingly fast public IP check
    • Use this to confirm you are connected through the proxy!
    • Use option extended=true to see country, city, zip code, and latitude/longitude for the IP as well.

🔑 Getting an API key

You can use so much of proxifly for free, but if you want to do some advanced stuff, you'll need an API key. You can get one by signing up for a Proxifly account.

📦 Install Proxifly

Option 1: Install via npm

Install with npm if you plan to use proxifly in a Node project or in the browser.

npm install proxifly

If you plan to use proxifly in a browser environment, you will probably need to use Webpack, Browserify, or a similar service to compile it.

const proxifly = new (require('proxifly'))({
  // Not required, but having one removes limits (get your key at https://proxifly.dev).
  apiKey: 'api_test_key'
});

Option 2: Install via CDN

Install with CDN if you plan to use Proxifly only in a browser environment.

<script src="https://cdn.jsdelivr.net/npm/proxifly@latest/dist/index.min.js"></script>
<script type="text/javascript">
  var proxifly = new Proxifly({
    // Not required, but having one removes limits (get your key at https://proxifly.dev).
    apiKey: 'api_test_key'
  });
</script>

Option 3: Use without installation

You can use proxifly in a variety of ways that require no installation, such as curl in terminal/shell. See the Use without installation section below.

⚡️ Using Proxifly

After you have followed the install step, you can start using proxifly to get proxy lists and check your public IP!

getProxy()

Retrieves a fully filterable list of proxies in either json or plain text.

var options = {
  protocol: 'http', // http | socks4 | socks5
  anonymity: 'elite', // transparent | anonymous | elite
  country: 'US', // https://www.nationsonline.org/oneworld/country_code_list.htm
  https: true, // true | false
  speed: 10000, // 0 - 60000
  format: 'json', // json | text
  quantity: 1, // 1 - 20
};

proxifly.getProxy(options)
.then(proxy => {
  console.log('getProxy:', proxy);
  // If you specify a quantity greater than 1, the response will be an array!
  // In this case, you can access by calling response[0].ipPort, response[1].ipPort, etc...
})
.catch(e => {
  console.error(e);
})

options

The options for getProxy(options) are as follows.

  • protocol string, array (optional): Filter by the protocol
    • Values: http, socks4, socks5
    • Default: http
  • anonymity string, array (optional): Filter by anonymity level.
    • Values: transparent, anonymous, elite (elite is the most anonymous)
    • Default: null (no filter, any anonymity)
  • country string, array (optional): Filter by country.
  • https boolean (optional): Filter by https/SSL.
    • Values: true, false
    • Default: null (no filter, any level of https)
  • speed number (optional): Filter by speed, value is in milliseconds taken to connect.
    • Values: 0 - 60000
    • Default: null (no filter, any speed)
    • Note: Specifying a very low number (less than ~400) will return significantly fewer results
  • format string (optional): The response type.
    • Values: json, text
    • Default: json
  • quantity number (optional): The number of proxies to be returned. Any number greater than 1 will be returned in an array.
    • Values: 1 - 20
    • Default: 1
    • Note: Without an API key, you cannot return more than 1 result.

For most options like protocol, anonymity, and country, you can provide an array where each element in the array will act as OR logic. For example:

var options = {
  protocol: ['http', 'socks4'],
  anonymity: ['anonymous', 'elite'],
  country: ['US', 'GB', 'RU'],
}

This filter will call the API for any proxies that are either of protocol (http OR socks4) AND of anonymity (anonymous OR elite) AND from (US OR GB OR RU)!

Example output

Here is a sample response for the .getProxy() method. This is the output you will see when extended=true:

{
  proxy: 'socks4://103.99.110.222:5678',
  protocol: 'socks4',
  ip: '103.99.110.222',
  port: 5678,
  https: false,
  anonymity: 'transparent',
  score: 1,
  geolocation: { country: 'IN', city: 'Unknown' }
}

getPublicIp()

Get your public IP with a simple api call.

var options = {
  mode: 'IPv4', // IPv4 | IPv6
  format: 'json', // json | text
};

proxifly.getPublicIp(options)
.then(proxy => {
  console.log('getPublicIp:', response);
  console.log('My IP is:', response.ip);
  console.log('My country is:', response.country);
})
.catch(e => {
  console.error(e);
})

options

The options for getProxy(options) are as follows.

  • mode string (optional): IPv4 IP or IPv6 IP?
    • Values: IPv4, IPv6
    • Default: IPv4
  • format string (optional): The response type.
    • Values: json, text
    • Default: json

Example output

Here is a sample response for the .getPublicIp() method. This is the output you will see when extended=true:

{
  ip: '104.173.192.180',
  geolocation: {
    country: 'US',
    city: 'Los Angeles',
    latitude: 34.0544,
    longitude: -118.2441
  }
}

For a more in-depth documentation of this library and the Proxifly service, please visit the official Proxifly website.

🔧 Use without installation

Use Proxifly with curl

# Get public IP
# Standard
curl -X POST https://api.proxifly.dev/get-public-ip
# With options
curl -d "format=text&mode=ipv4" -X POST https://api.proxifly.dev/get-public-ip
# With options (alternative)
curl -d '{"format": "text", "mode": "ipv4"}' -H 'Content-Type: application/json' https://api.proxifly.dev/get-public-ip

# Get a proxy
# Standard
curl -X POST https://api.proxifly.dev/get-proxy
# With options
curl -d "format=text&protocol=http&quantity=3" -X POST https://api.proxifly.dev/get-proxy
# With options (alternative)
curl -d '{"format": "text", "protocol": ["http", "socks4"], "quantity": 3}' -H 'Content-Type: application/json' https://api.proxifly.dev/get-proxy

📝 What Can Proxifly do?

Proxifly is a free proxy api that helps you get free proxy lists and check your public IP.

🗨️ Final Words

If you are still having difficulty, we would love for you to post a question to the Proxifly issues page. It is much easier to answer questions that include your code and relevant files! So if you can provide them, we'd be extremely grateful (and more likely to help you find the answer!)

📚 Projects Using this Library

Somiibo: A Social Media Bot with an open-source module library.
JekyllUp: A website devoted to sharing the best Jekyll themes.
Slapform: A backend processor for your HTML forms on static sites.
SoundGrail Music App: A resource for producers, musicians, and DJs.
Hammock Report: An API for exploring and listing backyard products.

Ask us to have your project listed! :)

Package Sidebar

Install

npm i proxifly

Homepage

proxifly.dev

Weekly Downloads

30

Version

2.0.2

License

MIT

Unpacked Size

25 kB

Total Files

6

Last publish

Collaborators

  • itwcw2000