Closed ghost closed 4 years ago
I reviewed code of Scrapy-Splash and didn't find any code related to response.data['script'] handling. So I thought that it's probably Splash problem. I tried to do a direct request without Scrapy-Splash and got the same result: response.data does not contain 'script' field Code:
if __name__ == '__main__':
import requests
resp = requests.post('http://localhost:8050/render.json',
json={
'wait': 3.5,
'script': 1,
'js_source': 'document.title="My Title";return document.title;',
'url': 'https://www.fonbet.ru/#!/live',
})
data = resp.json() # data does not contain 'script' field
print(data)
I've similar problem. I need to execute similar js code, without lua.
I tried to do a direct request without Scrapy-Splash and got the same result
Then please close this issue and report it on https://github.com/scrapinghub/splash
I try to execute JavaScript code and return value, so I added 'script': 1 to splash args, therefore, returned value must store in response.data['script']. But when I try to access 'script' field in response.data, Python raise KeyError. I checked it in debug mode and there is no field 'script' in response.data. I also tried to execute other scripts and even don't use 'js_source' option, but got the same result. Spider: