Created
October 27, 2016 19:04
-
-
Save podolskyi/00473bbff7bde51abe0057096c05ede2 to your computer and use it in GitHub Desktop.
example set proxy in spalsh lua script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main(splash) | |
local url = splash.args.url | |
splash:set_user_agent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36") | |
local host = 'host' | |
local port = port | |
local user = nil | |
local password = nil | |
splash:on_request(function (request) | |
request:set_proxy{host, port, username=user, password=password} | |
end) | |
splash:go(splash.args.url) | |
assert(splash:wait(5)) | |
return { | |
html = splash:html(), | |
png = splash:png(), | |
har = splash:har(), | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment