Skip to content

Instantly share code, notes, and snippets.

@podolskyi
Created October 27, 2016 19:04
Show Gist options
  • Save podolskyi/00473bbff7bde51abe0057096c05ede2 to your computer and use it in GitHub Desktop.
Save podolskyi/00473bbff7bde51abe0057096c05ede2 to your computer and use it in GitHub Desktop.
example set proxy in spalsh lua script
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