机械化浏览器和汤 - 使用相同的代码生成不同的结果

时间:2017-12-31 11:32:05

标签: javascript python beautifulsoup mechanize

我正在使用机械化浏览器和汤来恢复一些信息。 用户名和密码在我的csv文件中。 当我测试我的脚本时,只测试csv文件中的account1,它可以工作。我有我想要的所有HTML代码。 现在,当我在csv文件中用account2覆盖account1时,没有我想要的html代码。数据现在是javascript标记。

我的代码:

br2.open("URL")
res2 = br2.open("URL")
html2 = res2.read()
print html2

我想要的HTML代码就在这个脚本中

<script>
var cacheKillerVersion = "131203105521";
function launch() {
    // quit if this function has already been called
    if (arguments.callee.done) {return;}

    // flag this function so we don't do the same thing twice
    arguments.callee.done = true;

    // kill the timer
    if (_timer) {
        clearInterval(_timer);
        _timer = null;
    }

    var prodMode = true;
    var debugLevel = "";
    var debugLogTarget = "";
    window.DBG = new AjxDebug({level:AjxDebug.NONE, target:debugLogTarget});
    // figure out the debug level
    if (debugLevel == 't') {
        DBG.showTiming(true);
    } else if (debugLevel) {
        DBG.setDebugLevel(debugLevel);
    }

    AjxHistoryMgr.BLANK_FILE = "/public/blankHistory.html";
    var noSplashScreen = "";
    var protocolMode = "http";


    var batchInfoResponse = ALL THE HTML CODE I WANT TO SCRAP

怎么可能?

0 个答案:

没有答案