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

Using iMacros to favorite tweets and follow/unfollow

Discussion in 'Twitter' started by dabski, Nov 19, 2014.

  1. dabski

    dabski Newbie

    Joined:
    Nov 19, 2014
    Messages:
    23
    Likes Received:
    2
    I was wondering if anyone had a good working iMacros script that favorites tweets. I am looking for one that would just favorite 100 tweets at a time. So basically I want to just search for the tweets I want to favorite then just have to press play on the script for that to happen.

    Also, I want a script that can follow/unfollow. For the unfollow one I would want it to go from the bottom of my following list and unfollow from there. Is there a way to do this?
     
  2. KipesoftINC

    KipesoftINC Registered Member

    Joined:
    Sep 18, 2014
    Messages:
    51
    Likes Received:
    35
    There was one made by FireScripts but only works on a older version of iMacros and i think it got patched, i'm not sure. but you should try

    TweetSter By Firescripts
     
  3. dabski

    dabski Newbie

    Joined:
    Nov 19, 2014
    Messages:
    23
    Likes Received:
    2
    Does anyone have any other information on this
     
  4. MrBlue

    MrBlue Senior Member

    Joined:
    Dec 18, 2009
    Messages:
    950
    Likes Received:
    662
    Occupation:
    Web/Bot Developer
    Just download the iMacros browser plugin and make it. You don't need to be a programmer to create and run iMacros scripts.
     
  5. Bot Solutions

    Bot Solutions Regular Member

    Joined:
    Aug 19, 2014
    Messages:
    215
    Likes Received:
    361
    Occupation:
    Bot maker
    Location:
    Hungary
    Home Page:
    Here it is op.
    I created it for a client.

    Code:
        var refresh;
        refresh =  "CODE:";
        refresh +=  "refresh" + "\n"; 
    
    
    function LoadLog() {
        
        var LoadLogIim;
        LoadLogIim =  "CODE:";
        LoadLogIim +=  "set !datasource_delimiter ," + "\n"; 
        LoadLogIim +=  "set !datasource logTwitter.csv" + "\n"; 
        LoadLogIim +=  "set !datasource_line {{LoadLogLoop}}" + "\n"; 
        LoadLogIim +=  "set !extract {{!col1}}" + "\n"; 
        
        var users = [];
        
        iimDisplay("Loading log file...");
        for (var LoadLogLoop = 1; true; LoadLogLoop++) {
        
            iimSet("LoadLogLoop",LoadLogLoop);
            iimPlay(LoadLogIim);
            
            if (iimGetLastError(1) != "OK") {
                iimDisplay("Loading log file...");
                break;
            } else {
                users.push(iimGetLastExtract(1));
            }
            
        }
        
        return users;
        
    }
    
    
    function LoadDatasource() {
        
        var LoadDatasourceIim;
        LoadDatasourceIim =  "CODE:";
        LoadDatasourceIim +=  "set !datasource_delimiter ," + "\n"; 
        LoadDatasourceIim +=  "set !datasource datasourceTwitter.csv" + "\n"; 
        LoadDatasourceIim +=  "set !datasource_line {{LoadDatasourceLoop}}" + "\n"; 
        LoadDatasourceIim +=  "set !extract {{!col1}}" + "\n"; 
        LoadDatasourceIim +=  "add !extract {{!col2}}" + "\n"; 
        LoadDatasourceIim +=  "add !extract {{!col3}}" + "\n"; 
        LoadDatasourceIim +=  "add !extract {{!col4}}" + "\n"; 
        LoadDatasourceIim +=  "add !extract {{!col5}}" + "\n"; 
        
        var lines = [];
        
        iimDisplay("Loading datasource file...");
        for (var LoadDatasourceLoop = 2; true; LoadDatasourceLoop++) {
        
            iimSet("LoadDatasourceLoop",LoadDatasourceLoop);
            iimPlay(LoadDatasourceIim);
            
            if (iimGetLastError(1) != "OK") {
                iimDisplay("Loading datasource file...");
                break;
            } else {
                lines.push(iimGetLastExtract());
            }
            
        }
        
        return lines;
        
    }
    
    
    function Login(username,password) {
        
        var login;
        login =  "CODE:";
        login +=  "clear" + "\n";
        login +=  "filter type=images status=on" + "\n"; 
        login +=  "set !useragent undefined" + "\n"; 
        login +=  "url goto=https://mobile.twitter.com/session/new" + "\n"; 
        login +=  "tag pos=1 type=input attr=name:username content={{username}}" + "\n"; 
        login +=  "tag pos=1 type=input attr=name:password content={{password}}" + "\n"; 
        login +=  "tag pos=1 type=input attr=name:commit" + "\n";
        
        iimSet("username",username);
        iimSet("password",password);
        iimDisplay("Logging in to account \"" + username + "\"...");
        iimPlay(login);
    }
    
    
    function Fav(loopNumberOfActions, line, endPage) {
        
        var extractUser;
        extractUser =  "CODE:";
        extractUser +=  "set !timeout_step 0" + "\n"; 
        extractUser +=  "tag pos={{LoopFav}} type=button attr=class:ProfileTweet-actionButtonUndo*&&title:Undo<sp>Favorite extract=txt" + "\n"; 
        extractUser +=  "set !extract null" + "\n"; 
        extractUser +=  "tag pos=r-1 type=span attr=class:username<sp>js-action-profile-name extract=txt" + "\n"; 
        
        var fav;
        fav =  "CODE:";
        fav +=  "set !timeout_step 0" + "\n";
        fav +=  "tag pos={{LoopFav}} type=button attr=class:ProfileTweet-actionButtonUndo*&&title:Undo<sp>Favorite" + "\n"; 
        fav +=  "wait seconds={{delay}}" + "\n";
    
    
        var saveLog;
        saveLog =  "CODE:";
        saveLog +=  "set !extract {{user}}" + "\n"; 
        saveLog +=  "saveas type=extract folder={{path}}\\Datasources file=logTwitter.csv" + "\n"; 
        
    /*    if (loopNumberOfActions == 0) {
            NextPage();
        } */
        
        iimSet("LoopFav",LoopFav);
        iimPlay(extractUser);
        
        if (iimGetLastExtract(1) != '#EANF#') {
        
            var user = iimGetLastExtract(1).replace('@','').replace(/ /g,'').replace(/\n/g,'');
            
            if (users.join().indexOf(user) == -1) {
                
                loopNumberOfActions++;
                iimSet("LoopFav",LoopFav);
                iimSet("delay",Math.floor(Math.random()*5 + 1) );
                iimDisplay("Favoriting " + line[3] + " tweets...");
                iimPlay(fav);
                
                users.push(user);
                
                iimSet("user",user);
                iimSet("path",path);
                iimPlay(saveLog);
                
            } else {
                LoopFav++;
            }
        
        } else {
        
            if (endPage == true || loopNumberOfActions == parseInt(line[3])) {
                var endPage = "end";
            }
        
            if (endPage != "end") {
                var endPage = true;
            }
        }
        
        return [endPage, LoopFav];
        
    }
    
    
    function NextPage() {
        /*
        var nextPage;
        nextPage =  "CODE:";
        nextPage +=  "set !useragent undefined" + "\n"; 
        nextPage +=  "set !timeout_step 0" + "\n"; 
        nextPage +=  "tag pos=1 type=a attr=href:*search?prev_cursor=*q={{keyword}}" + "\n"; 
        
        iimSet("keyword",keyword.replace(/ /g,'+') );
        iimPlay(nextPage);
        
        if (iimGetLastError(1) != 'OK') {
            iimPlay(refresh);
        }
        
        */
        
        window.scrollBy(0,9999999999);
        
    }
    
    
    function UnFav(loopNumberOfActions,line,errorUnFav) {
    
    
        var unFav;
        unFav =  "CODE:";
        unFav +=  "set !timeout_step 0" + "\n"; 
        unFav +=  "tag pos=1 type=img attr=src:*tweet_fav_active.gif" + "\n"; 
        
        iimPlay(refresh);
        
        
        do {
            
            iimDisplay("Unfavoriting " + line[3] + " tweets...");
            iimPlay(unFav);
            
            loopNumberOfActions++;
            
            if (iimGetLastError(1) != "OK" && errorUnFav == true) {
                var errorUnFav = "end";
            } else if (iimGetLastError(1) == "OK") {
                var errorUnFav = false;
            } else {
                var errorUnFav = true;
            }
            
        } while (iimGetLastError(1) == 'OK' && loopNumberOfActions < parseInt(line[3]));
        
        var loopNumberOfActions = loopNumberOfActions - 1;
        
        return [loopNumberOfActions, errorUnFav];
        
    }
    
    
    function Go(action,keyword) {
    
    
        if (action == "fav") {
            iimSet("url","https://twitter.com/search?f=realtime&q=" + keyword.replace(/ /g,'+') );
        } else if (action == "unfav") {
            iimSet("url","https://mobile.twitter.com/favorites");
        }
        
        var go;
        go = "CODE:";
        go +=  "filter type=images status=on" + "\n";
        go +=  "set !useragent undefined" + "\n";
        go +=  "url goto={{*****}" + "\n";
        
        iimPlay(go);
        
    }
    
    
    /* functions end */
    
    
    var path = prompt("Path to your iMacros folder. Please use _ instead of \\\nFor example:\n\nC:_Users_Tamas_Documents_iMacros").replace(/_/g,"\\");
    var users = LoadLog();
    var lines = LoadDatasource();
    
    
    for (var loopGlobal = 0; loopGlobal < lines.length; loopGlobal++) {
        var line = lines[loopGlobal].split("\[EXTRACT\]");
        Login(line[0],line[1]);
        
        Go(line[2],line[4]);
        
        var errorUnFav = false;
        var endPage = false;
        var LoopFav = 1;
        for (var loopNumberOfActions = 0; loopNumberOfActions < parseInt(line[3]);loopNumberOfActions++) {
            if (line[2] == "fav") {
                var ReturnFav = Fav(loopNumberOfActions, line, endPage);
                var endPage = ReturnFav[0]
                
                if (ReturnFav[0] == true) {
                    NextPage();
                    var LoopFav = 1;
                    var endPage = false;
                } else if (ReturnFav[0] == "end") break;
            } else if (line[2] == "unfav") {
                var returnUnfav = UnFav(loopNumberOfActions, line, errorUnFav);
                var loopNumberOfActions = returnUnfav[0];
                var errorUnFav = returnUnfav[1]
                if (errorUnFav == "end") break;
            }
        }
    }
    
    
    iimDisplay("Job done Sir!");
    
    
    It runs from a csv datasource called "datasourceTwitter.csv". Just create it in your Datasources folder with UTF-8 coding
    the first line should be this:
    "username","password","fav OR unfav","numberOfActions","keyword","DONT DELETE THIS LINE"

    Also it writes a log file, so no duplicate fav from 1 user.

    I hope that helps
     
  6. inspiredandthesleep

    inspiredandthesleep Newbie

    Joined:
    Feb 11, 2016
    Messages:
    20
    Likes Received:
    1
    Hi there.
    I'm curious Bot Solutions what does your Imacro do exactly? Cause there's a lot of code here and it doesn't look like any previous imacros I've seen? the datasourceTwitter.csv is just a blank file you make?
    Do you have anything for instagram on Ink 361?