这是浏览LinkedIn页面后在Python中使用scrapy-splash的结果。这是它的开始。
b'<html><head></head><body>\x1f\xef\xbf\xbd\x08\x03\xef\xbf\xbd\xef\xbf\xbdko+I\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\x0f1\x1cT]]\xef\xbf[...]
我不知道该如何阅读?谢谢。
答案 0 :(得分:0)
所以看起来好像是我评论的那一行...不知道为什么。
lua_script = """
function main(splash)
splash.private_mode_enabled = false
assert(splash:go{
splash.args.url,
headers=splash.args.headers,
})
assert(splash:wait(5))
return {html=splash:html()}
end
"""
yield SplashRequest(url=self.url, callback=self.parse,
endpoint='render.html',
args={'lua_source': lua_script,
'wait': 5,
'private_mode_enabled': 'false',
},
headers={
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
'accept-language': 'en-US,en;q=0.9,fr;q=0.8',
#'accept-encoding': 'gzip, deflate, br', # if used then file looks like shit
'referer': 'https://www.google.com/',
'upgrade-insecure-requests': 1,
},
)