Lua script does not work when using dynamic proxy
See original GitHub issueIn the first picture, I make the request with dynamic proxy and the endpoint is execute
In the second picture, I make the request with dynamic proxy and the endpoint is render,html
And I’m pretty sure that my proxy is ok. But why lua script does not work when using dynamic proxy? Hope you can help me. @kmike
This is my code
for x in xrange(0,3):
try:
script = """
function main(splash)
assert(splash:go(splash.args.url) )
splash:wait(2)
return splash:evaljs("document.title")
--return splash:evaljs([[
-- document.querySelector('#sf-item-list-data').innerText;
-- ]]);
-- return {html=splash:html()}
end
"""
agent = random.choice(agents)
time.sleep(1)
authHeader = self.getAuthHeader()
headers={
"User-Agent":agent,
"Proxy-Authorization":authHeader,
# "Referer":"http://www.bttt99.com/",
}
splash_args = {
'wait': 1,
"http_method":"GET",
"images":0,
"render_all":1,
"headers":headers,
'lua_source': script,
"proxy":"http://101.200.153.236:8123",
}
yield SplashRequest(self.house_pc_index_url+"&page="+str(x+1), self.parse_result, endpoint='execute',
args=splash_args,dont_filter=True)
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Lua Scripting with Reverse Proxy - IBM
Reverse proxy supports dynamic evaluation of HTTP fallback requests using Lua scripting. Lua scripts can be used to allow, reject, or modify HTTP...
Read more >Transformations using Lua scripting - KrakenD API Gateway
The introduction of Lua scripts in your Gateway does not require to recompile KrakenD, but unlike Go, Lua scripts are interpreted in real-time....
Read more >Dynamic routing with nginx, lua and redis - Stack Overflow
In my lua code try to find an exact match first. After that I try to find the best matching wildcard match. It...
Read more >5 Ways to Extend HAProxy with Lua (Guide)
Did you know that HAProxy embeds the Lua scripting language, ... You can also use the require function to load other Lua files...
Read more >if_lua.txt - Vim
Dynamic loading lua-dynamic {only available when Vim was compiled with the ... Note: This command doesn't work when the Lua feature wasn't compiled...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@playwolf719 glad to see it helped!
I think for production it makes sense to run multiple Splash containers and use a load balancer, so that if one container crashes it can be restarted without affecting clients. You can implement it yourselves, use https://github.com/TeamHG-Memex/aquarium or use hosted Splash instance which takes care of that (like Scrapinghub’s). See also: http://splash.readthedocs.io/en/stable/faq.html#how-to-run-splash-in-production
@playwolf719 see https://github.com/scrapy-plugins/scrapy-splash#responses:
response.data['title']