wget + JavaScript?

前端 未结 3 1691
傲寒
傲寒 2020-11-28 11:41

I have this webpage that uses client-side JavaScript to format data on the page before it\'s displayed to the user.

Is it possible to somehow use wget t

3条回答
  •  鱼传尺愫
    2020-11-28 12:27

    Here is a simple little phantomjs script that triggers javascript on a webpage and allows you to pull it down locally:

    file: get.js

    var page = require('webpage').create(),
      system = require('system'), address;
    
    address = system.args[1];
    page.scrollPosition= { top: 4000, left: 0}  
    page.open(address, function(status) {
      if (status !== 'success') {
        console.log('** Error loading url.');
      } else {
        console.log(page.content);
      }
      phantom.exit();
    });
    

    Use it as follows:
    $> phantomjs /path/to/get.js "http://www.google.com" > "google.html"

    Changing /path/to, url and filename to what you want.

提交回复
热议问题