【问题标题】:how to have an iMacros script expand a Facebook wall and then expand all comments如何让 iMacros 脚本扩展 Facebook 墙,然后扩展所有评论
【发布时间】:2014-10-03 18:07:17
【问题描述】:

我正在尝试扩展 Facebook 墙,然后在该扩展墙上显示所有 cmets。

手动,这将通过访问墙上的链接然后连续向下滚动来实现,从而逐渐显示更多页面,直到显示所有页面。然后,将选择View * more comments 形式的可选文本的每个实例,从而使页面中的所有 cmets 完全显示。

我试图让向下滚动事件注册到 iMacros 但没有成功,并且使用以下脚本选择文本 View 1 more comments 基本成功:

VERSION BUILD=8820413 RECORDER=FX
TAB T=1
URL GOTO=https://www.facebook.com/FACEBOOKID1?and=FACEBOOKID2
TAG POS={{!LOOP}} TYPE=SPAN ATTR=TXT:View<SP>1<SP>more<SP>comments

如何使向下滚动行为自动化,如何改进我目前尝试扩展 cmets 以更通用的方式操作?

【问题讨论】:

    标签: facebook firefox imacros


    【解决方案1】:

    我使用下面的js脚本:

    // set the number of scrolls you prefer
    var scrollNumber = 1;
    // scroll
    for (i = 1; i <= scrollNumber; i++) {
        window.scrollTo(0, i*10000);
        iimPlayCode("WAIT SECONDS=2");
    }
    // expand comment boxes with 50 less comments
    var doc = window.document;
    var cmtBoxes = doc.getElementsByClassName("UFIBlingBox uiBlingBox feedbackBling");
    for (i = 1; i <= cmtBoxes.length; i++) {
        var cmtLabel = cmtBoxes[i - 1].getAttribute("aria-label");
        var cmtNumber = cmtLabel.match(/.*\s(\d+)\scomments.*/)[1];
        if (cmtNumber < 50)
            iimPlayCode('TAG POS=' + i + ' TYPE=A ATTR=CLASS:"UFIBlingBox uiBlingBox feedbackBling"');
    }
    // count
    var cmtPostNumber = 0;
    for (i = 0; i < doc.links.length; i++) {
        if (doc.links[i].innerHTML.match(/View\s\d+\smore\scomment/) != null)
            cmtPostNumber++;
    }
    // view
    for (i = 1; i <= cmtPostNumber; i++) {
        var M = "SET !TIMEOUT_STEP 1" + "\n";
        M += "TAG POS=1 TYPE=A ATTR=TXT:View<SP>*<SP>more<SP>comment*" + "\n";
        M += "WAIT SECONDS=1";
        var ret = iimPlayCode(M);
        if (ret != 1) break;
    }
    // go to the top
    window.scrollTo(0, 0);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-08-10
      • 2012-08-16
      • 2013-06-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多