mifi / SimpleInstaBot

Simple Instagram bot GUI
MIT License
598 stars 85 forks source link

Connecting a Proxy for Multiple Accounts #272

Open sagirab opened 6 months ago

sagirab commented 6 months ago

When we open multiple accounts, our IP is used for multiple accounts. Lets say I want to use 100 accounts at the same time, so Instagram will automaticly flag all of the accounts in the same IP because 100 is a lot.

I cannot see any proxy settings in the application. Would be great to set different proxies for different accounts.

davidmartinrius commented 5 months ago

You can use instagrapi Much better for the same tasks. I started using SimpleInstabot because it is easy to use. But it is limited to few features. Instagrapi provides a complete instagram unofficial api wrapper, also you can use proxies.

On the other hand, sometimes SimpleInstaBot stops working unexpectedly, it requires a lot of supervision. For example, with instagrapi you can relogin if needed automatically with try excepts, it is more autonomous

davidmartinrius commented 5 months ago

But if you really want to use this project and with a proxy, you could try something like this. I have not tried the code.

Inside https://github.com/mifi/SimpleInstaBot/blob/master/public/electron.js

const isDev = require('electron-is-dev');
const path = require('path');
const pie = require('puppeteer-in-electron');
const puppeteer = require('puppeteer-core');
const { join } = require('path');
const assert = require('assert');
const fs = require('fs-extra');
const filenamify = require('filenamify');
const yargsParser = require('yargs-parser');

const Instauto = require('instauto');
const moment = require('moment');
const electronRemote = require('@electron/remote/main');

let mainWindow;
let instautoDb;
let instauto;
let instautoWindow;
let logger = console;
let powerSaveBlockerId;

// Proxy configuration
const proxyServer = 'http://your_proxy_address:your_proxy_port';

// Must be called before electron is ready
const pieConnectPromise = (async () => {
  // Launch Puppeteer with proxy configuration
  const browser = await pie.launch(puppeteer, {
    args: [`--proxy-server=${proxyServer}`],
  });

  await pie.initialize(app, browser);
})();

pieConnectPromise.catch(console.error);

electronRemote.initialize();