├── cookies └── to.keep ├── README.md ├── package.json ├── .gitignore └── app.js /cookies/to.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Instagram approve pending followers 2 | Approve all pending followers ( for private accounts ) 3 | 4 | Install this package globally: 5 | 6 | npm install https://github.com/qrpike/instagram-approve-pending-followers -g 7 | 8 | Once you have done that, you should be able to run the cli: 9 | 10 | approvePendingFollowers -u myusername -p 'mypassword' 11 | 12 | 13 | It approves 200 requests in sequential order. It's on a continuous loop of 55minutes. So just leave it running on a machine somewhere and you'll never have to hit 'approve' again. 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "instagram-approve-pending-followers", 3 | "version": "1.0.0", 4 | "description": "Approve all pending followers", 5 | "main": "./app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "bin": { 10 | "approvePendingFollowers": "app.js" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/qrpike/instagram-approve-pending-followers.git" 15 | }, 16 | "author": "", 17 | "license": "ISC", 18 | "preferGlobal": true, 19 | "bugs": { 20 | "url": "https://github.com/qrpike/instagram-approve-pending-followers/issues" 21 | }, 22 | "homepage": "https://github.com/qrpike/instagram-approve-pending-followers#readme", 23 | "dependencies": { 24 | "bluebird": "^3.5.3", 25 | "commander": "^2.19.0", 26 | "instagram-private-api": "^1.39.2", 27 | "lodash": "^4.17.11" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | cookies/ 61 | cookie-* -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const lodash = require('lodash') 4 | const Promise = require('bluebird') 5 | const IgApiClient = require('instagram-private-api').IgApiClient 6 | const ig = new IgApiClient() 7 | 8 | var program = require('commander') 9 | let session = null 10 | 11 | const everyMinutes = 10 12 | let intervalFunc = null 13 | 14 | program 15 | .version('0.1.0') 16 | .option('-u, --username [username]', 'Username', '') 17 | .option('-p, --password [password]', 'Password', '') 18 | .parse( process.argv ) 19 | 20 | if( lodash.isEmpty( program.username ) || lodash.isEmpty( program.password ) ){ 21 | throw(new Error('Must supply -u {username} and -p {password}')) 22 | } 23 | 24 | ig.state.generateDevice(program.username) 25 | 26 | let pendingCount = 0 27 | async function DoApprovals(){ 28 | 29 | const pendFriend = ig.feed.pendingFriendships(session.pk) 30 | const pendFriendItems = await pendFriend.items() 31 | 32 | console.log('Awaiting Approval: ', pendFriendItems.length) 33 | 34 | return Promise.mapSeries(pendFriendItems, async ( friend ) => { 35 | console.log('Approving: ', friend.username) 36 | const body = await ig.friendship.approve(friend.pk) 37 | return Promise.delay( randomIntFromInterval(350, 1450) ) 38 | }).then(() => { 39 | if( pendFriendItems.length != 0 ){ 40 | return DoApprovals() 41 | } 42 | setTimeoutContinue() 43 | }).catch(( err ) => { 44 | console.log('Do approvals error:', err) 45 | console.log('Waiting 11sec before starting again...') 46 | return Promise.delay(11500).then(() => { 47 | console.log('Starting again...') 48 | DoApprovals() 49 | }) 50 | }) 51 | 52 | } 53 | 54 | function randomIntFromInterval(min, max) { // min and max included 55 | return Math.floor(Math.random() * (max - min + 1) + min); 56 | } 57 | 58 | function setTimeoutContinue(){ 59 | clearTimeout( intervalFunc ) 60 | intervalFunc = setTimeout(() => { 61 | console.log('interval') 62 | DoApprovals().catch(( err ) => { 63 | console.log('Set timeouts error:', err) 64 | setTimeoutContinue() 65 | }) 66 | }, 1000 * 60 * everyMinutes ) 67 | } 68 | 69 | 70 | // Login and go 71 | async function main(){ 72 | 73 | await ig.simulate.preLoginFlow() 74 | 75 | ig.account.login(program.username, program.password) 76 | .then(( ses ) => { 77 | console.log(`Logged In! ${ses.username} - ${ses.full_name}`) 78 | process.nextTick(async () => await ig.simulate.postLoginFlow()) 79 | session = ses 80 | DoApprovals().catch(( err ) => { 81 | console.log('Create sessions error:', err) 82 | setTimeoutContinue() 83 | }) 84 | }) 85 | .catch(( err ) => { 86 | console.log('err:', err) 87 | }) 88 | } 89 | 90 | main() 91 | --------------------------------------------------------------------------------