zoukankan      html  css  js  c++  java
  • splash

    function main(splash, args)
      splash.images_enabled = false //不加载图片
      assert(splash:go(args.url))
      assert(splash:wait(1.5))
    
      return {
        html = splash:html(),
        png = splash:png(),
        har = splash:har(),
      }
    end
    

      

    <form id="login" action="/login">
        <input type="text" name="username" />
        <input type="password" name="password" />
        <input type="checkbox" name="remember" />
        <button type="submit">Submit</button>
    </form>
    
    function main(splash)
        -- ...
        local form = splash:select('#login')
        assert(form:fill({ username='admin', password='pass', remember=true }))
        assert(form:submit())
        -- ...
    end
    

      

    function main(splash, args)
      splash:set_viewport_size(800, 600)
      splash:set_user_agent('Splash bot')
      local example_urls = {"www.google.com", "www.bbc.co.uk", "scrapinghub.com"}
      local urls = args.urls or example_urls
      local results = {}
      for _, url in ipairs(urls) do
        local ok, reason = splash:go("http://" .. url)
        if ok then
          splash:wait(0.2)
          results[url] = splash:png()
        end
      end
      return results
    end
    

      

    function main(splash, args)
      splash:set_user_agent('Mozilla') 
      splash:add_cookie("_ujz", "MTc3ODc5Nzkw", "/", ".51job.com")
        
      assert(splash:go(args.url))
      assert(splash:wait(0.5))
    
      return {
        html = splash:html(),
        png = splash:png(),
        har = splash:har(),
      }
    end
    

      

  • 相关阅读:
    Apache httpd和JBoss构建高可用集群环境
    Ubuntu 14.04下NFS安装配置
    Ubuntu 14.04 安装 JDK 7.0
    Docker第三方项目小结
    Shipyard远程API
    Linux软件管理——yum命令详解
    Quartz集群原理及配置应用
    Rsync原理介绍及配置应用
    python构造wireshark可以解析的LTE空口数据
    A Simple Web Server
  • 原文地址:https://www.cnblogs.com/ahuo/p/10607205.html
Copyright © 2011-2022 走看看