def load_data(self, ws, result, payload):
data = json.loads(result['result']['result']['value'])
if data is None:
raise ChromeEmptyException('data is null')
charset = data['charset']
data['body'] = self.beautify(html.unescape(data['body']), charset)
data['head'] = self.beautify(data['head'], charset)
data['text'] = self.beautify(data['text'], charset)
effect = self.effect_url(data)
hostname = urlparse(effect).hostname if effect else None
data['ip'] = socket.gethostbyname(hostname) if hostname else None
if len(data['body']) <= len('<body></body>'):
raise ChromeShortException('too short in retry')
if payload.get('need_screenshot', True):
screen = self.screenshot(ws, payload.get('shot_quality', 40), payload.get('shot_format', 'jpeg'))
else:
screen = None
data['screenshot'] = screen
current_cookies = self.get_cookies(ws)
data['cookies'] = current_cookies
data['state']='normal'
return data
评论列表
文章目录