Actor picture

Find IPs from Proxy Groups

lukaskrivka/find-ips-from-proxy-groups

Simple actor to list IPs that you have allocated in any of your proxy groups. You have to specify the total count of the IPs you have in the groups you want to test for this to work properly.

No credit card required

Author's avatarLukáš Křivka
  • Modified
  • Users17
  • Runs47
Actor picture

Find IPs from Proxy Groups

Based on the apify/actor-node-basic:v0.21.10 Docker image (see docs).

const Apify = require('apify');
const request = require('request-promise');

Apify.main(async () => {
    // Get input of your actor
    const input = await Apify.getValue('INPUT');
    const { groups, count } = input;

    let ips = {};

    for (let i = 0; i < count * 2; i++) {
        const proxy = Apify.getApifyProxyUrl({ groups, session: Math.random().toString() })
        const { clientIp } = await request({ url: 'https://api.apify.com/v2/browser-info', proxy, json: true });
        await Apify.utils.sleep(1000);
        console.log(clientIp);
        ips[clientIp] = true;
    }
    await Apify.setValue('OUTPUT', Object.keys(ips));
});