requests使用splash

import requests

script = """
splash:set_user_agent('Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0')
splash:go(args.url)
splash:wait(0.6) -- js加载不出的数据可适当调整等待时间
return splash:html()
"""
resp = requests.post('http://123.6.66.166:6666/run', json={
    'lua_source': script,
    'url': 'https://www.baidu.com'
})
html_data= resp.text
print(html_data)

你可能感兴趣的:(splash)