1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Instagram' started by mynameisfrankenstein, Jan 8, 2017.

  1. mynameisfrankenstein

    mynameisfrankenstein Regular Member

    Joined:
    Apr 2, 2015
    Messages:
    431
    Likes Received:
    339
    Gender:
    Male
    Location:
    BC, Canada
    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
     
    • Thanks Thanks x 4
  2. Sicknigajay

    Sicknigajay Junior Member

    Joined:
    Oct 24, 2016
    Messages:
    135
    Likes Received:
    7
    Gender:
    Male
    Location:
    India
    Looks good
    Giving it a try.
    Thanks.
     
  3. kapatikora

    kapatikora Newbie

    Joined:
    Dec 4, 2013
    Messages:
    2
    Likes Received:
    0
    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
     
  4. Bernardo Junior

    Bernardo Junior Newbie

    Joined:
    Jun 24, 2017
    Messages:
    2
    Likes Received:
    0
    Gender:
    Male
    Erro: element A specified by CLASS:_oidfu&&HREF:/{{!COL1}}/?max_id=* was not found, line: 4 (Error code: -921)
     
  5. Kick

    Kick Newbie

    Joined:
    Jan 4, 2017
    Messages:
    6
    Likes Received:
    0
    Could You record a tutorial on YouTube please? :)