[GET] iMacros Instagram script, scrape commenters from popular accounts (VIDEO)

mynameisfrankenstein

Regular Member
Joined
Apr 2, 2015
Messages
429
Reaction score
385
Hello BHW,

Someone wanted me to develop this script for them and I decided I would release it to the community for free since Instagram is pretty hot right now.

This is an iMacros script which can be used with Chrome or Firefox, though I've only developed it with Firefox, it should also work with Chrome.

Here's a video demonstrating what it does. I'll show you how to install it below.


Create the following files inside your iMacros/Macros folder

insta_commenters.js
Code:
var ret;
// !!!!!!
//
//
//     change 'var x='
//    to how many usernames are in Datasources/instagram_leaders
//
//
// !!!!!!
var x=11;



for (var i = 1; i <= x; i++) {

    iimSet("i", i);
    iimPlay ("insta_scroll")


    for (var b = 1; b <= 150; b++) {
        iimSet("i", i);
        iimSet("b", b);
        iimPlay("insta_scrape")
    }


    for (var b = 1; b <= 150; b++) {
        iimSet("i", i);
        iimSet("b", b);
        iimPlay("insta_goto")


        for (var n = 1; n <= 100; n++) {
            // 1) search for the word in source of the page i run it
            ret = iimPlay('CODE:SEARCH SOURCE=TXT:"load more comments" IGNORE_CASE=YES');

            // 2)if it find the word to play macro1
            if (ret == 1) {   // Text was found
                ret = iimPlay("insta_loadmore");
            }
       
            // 3)if it will not find the word to play macro2 
            else if (ret != -101) {
                break;
            }

        }


        for (var z = 1; z <= 1000; z++) {
            iimSet("z", z);
            iimPlay("insta_getusers")
        }

    }
    ret = iimPlay('CODE:FILEDELETE NAME=instagram_urls');

}

insta_getusers.iim
Code:
SET !TIMEOUT_STEP 0
SET !ERRORIGNORE YES
SET !TIMEOUT_TAG 0
TAG POS={{z}} TYPE=A ATTR=CLASS:_*<SP>notranslate<SP>_*&&TITLE:*&&HREF:/*/ EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=scraped

insta_goto.iim
note: you have to change the first line to correspond with your computers iMacros location
example: "C:\\My iMacros Path\\Downloads\\instagram_urls"
Code:
SET !DATASOURCE "**********************\\Downloads\\instagram_urls"
SET !DATASOURCE_LINE {{b}}
URL GOTO={{!COL1}}
wait seconds=1
TAG POS=1 TYPE=BUTTON ATTR=CLASS:_l086v<SP>_ifrvy

insta_loadmore.iim
Code:
TAG POS=1 TYPE=BUTTON ATTR=CLASS:_l086v<SP>_ifrvy
wait seconds=1

insta_scrape.iim
Code:
SET !DATASOURCE instagram_leaders
SET !DATASOURCE_LINE {{i}}
TAG POS={{b}} TYPE=A ATTR=HREF:https://www.instagram.com/p/*/?taken-by=* EXTRACT=HREF
SAVEAS TYPE=EXTRACT FOLDER=* FILE=instagram_urls

insta_scroll.iim
Code:
SET !DATASOURCE instagram_leaders.txt
SET !DATASOURCE_LINE {{i}}
URL GOTO=https://www.instagram.com/{{!COL1}}/
TAG POS=1 TYPE=A ATTR=CLASS:_oidfu&&HREF:/{{!COL1}}/?max_id=*
wait seconds=2
URL GOTO=javascript:window.scrollBy(0,20000)
wait seconds=2
URL GOTO=javascript:window.scrollBy(0,20000)
wait seconds=2
URL GOTO=javascript:window.scrollBy(0,20000)
wait seconds=2
URL GOTO=javascript:window.scrollBy(0,20000)
wait seconds=2
URL GOTO=javascript:window.scrollBy(0,20000)
wait seconds=2
URL GOTO=javascript:window.scrollBy(0,20000)
wait seconds=2
URL GOTO=javascript:window.scrollBy(0,20000)
wait seconds=2
URL GOTO=javascript:window.scrollBy(0,20000)
wait seconds=2
URL GOTO=javascript:window.scrollBy(0,20000)
wait seconds=2
URL GOTO=javascript:window.scrollBy(0,20000)
wait seconds=2
URL GOTO=javascript:window.scrollBy(0,20000)
wait seconds=2
URL GOTO=javascript:window.scrollBy(0,20000)
wait seconds=2
URL GOTO=javascript:window.scrollBy(0,20000)
wait seconds=2


Create the following file inside your iMacros/Datasources folder

instagram_leaders.txt
Code:
tailopez
justnbieber
justintimberlake

That's all there is to it!

Make sure you edit the instagram_leaders.txt to include the usernames you want to scrape.

Once you've added them all, make sure you change the number amount in the insta_commenters.js file:

Code:
var x=3;
(3 users in the instagram_leaders.txt file)


Of course, to launch the script... run insta_commenters.js


Cheers,
Franky
 
aye baby im having problems with this script, I keep catching a -930 saying insta_scrape.iim was not found and I've gone through and set the whole thing up to the best of my knowledge

heres praying to the internet gods you around to help me out, much obliged my dude
 
Erro: element A specified by CLASS:_oidfu&&HREF:/{{!COL1}}/?max_id=* was not found, line: 4 (Error code: -921)
 
Back
Top