美文网首页服务端其他
[Crawl]渲染并网络监听

[Crawl]渲染并网络监听

作者: _小老虎_ | 来源:发表于2018-08-16 15:07 被阅读17次
    // 网络监听
    //url='http://www.realrace.cn/';
    url = 'https://api.47ks.com/webcloud/?v=http%3a%2f%2fm.pptv.com%2fshow%2ficee3NJwCcrATkfk.html';
    var page = require('webpage').create();
    page.captureContent = ['/config/webmain.php', '/config/webmain.php'];
    page.customHeaders = {
      "User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.75 Safari/537.36",
        //"Referer":"http://wiki.xiaodutv.com/display/~changyanlong/tmp"
      "Referer":url
    };
    page.onResourceRequested = function(request) {
      console.log('[Start_Request] ' + JSON.stringify(request, undefined, 4) + '[END_Request]');
    };
    page.onResourceReceived = function(response) {
      console.log('[Get_Receive] ' + JSON.stringify(response, undefined, 4) + '[END_Receive]');
    };
    //page.open(url);
    page.open(url, function (status) {
      var content = page.content;
      console.log('Content: ' + content);
      phantom.exit();
    });
    

    相关文章

      网友评论

        本文标题:[Crawl]渲染并网络监听

        本文链接:https://www.haomeiwen.com/subject/kfcobftx.html