proxifly

    1.0.11 • 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 compatability 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, zipcode, 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 an account at https://proxifly.com/signup.

    Install Proxifly

    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'))({
      apiKey: 'api_test_key' // Not required, but having one removes limits (get your key at https://proxifly.com).
    });

    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({
        apiKey: 'api_test_Key' // Not required, but having one removes limits (get your key at https://proxifly.com).
      });
    </script>

    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:

    {
      "ip": "209.99.133.59",
      "port": "12345",
      "anonymity": "anonymous",
      "userAgent": true,
      "country": "US",
      "get": true,
      "post": true,
      "ipPort": "209.99.133.59:12345",
      "cookies": true,
      "protocol": "http",
      "https": true,
      "referrer": true
    }

    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": "73.111.121.217",
      "country": "US",
      "state": "California",
      "city": "San Francisco",
      "district": "Lower Nob Hill",
      "zipcode": "94109",
      "latitude": "37.88619",
      "longitude": "-122.42311",
      "isp": "Comcast Cable Communications, LLC"
    }

    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.com/get-public-ip
    # With options
    curl -d "format=text&mode=ipv4" -X POST https://api.proxifly.com/get-public-ip
    # With options (alternative)
    curl -d '{"format": "text", "mode": "ipv4"}' -H 'Content-Type: application/json' https://api.proxifly.com/get-public-ip
    
    # Get a proxy
    # Standard
    curl -X POST https://api.proxifly.com/get-proxy
    # With options
    curl -d "format=text&protocol=http&quantity=3" -X POST https://api.proxifly.com/get-proxy
    # With options (alternative)
    curl -d '{"format": "text", "protocol": ["http", "socks4"], "quantity": 3}' -H 'Content-Type: application/json' https://api.proxifly.com/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! :)

      This feature is exclusive to Teams

      Illustration of wombats

      The package file explorer is only available for Teams at the moment.

      We may support exploring this package in the future. Check back soon.

      Install

      npm i proxifly

      Homepage

      proxifly.com

      DownloadsWeekly Downloads

      19

      Version

      1.0.11

      License

      MIT

      Unpacked Size

      25 kB

      Total Files

      6

      Last publish

      Collaborators

      • itwcw2000