Commit adc5a286 authored by wang's avatar wang

1

parent e4f58eaf
......@@ -38,6 +38,7 @@ class Reese84ByPass(object):
}
Path(log_dir).joinpath(thread_name).mkdir(exist_ok=True, parents=True)
self.log = logger.bind(module_name=thread_name)
self.thread_name = thread_name
self.log.info(f'proxy:{proxy} target:{target}')
self._cache_md5 = ''
......@@ -76,16 +77,17 @@ class Reese84ByPass(object):
r1 = self._session.get(
'https://beta.makeabooking.flyscoot.com/Two-discharted-Not-ere-int-when-is-are-Poss-A-Sa')
self.log.log('REQU', f'JSURL: code:{r1.status_code} cost:{(time.time() - t1):.3f}s')
a, filename = tempfile.mkstemp()
cache_md5 = md5(r1.text)
if self._cache_md5 != cache_md5:
self._cache_md5 = cache_md5
self.log.log('VMJS', f'JS变化')
envCode = open(work_dir + 'src/run.js', 'r').read()
with open(work_dir + 'src/vm_env.js', 'w') as f:
with open(work_dir + f'src/vm_env_{self.thread_name}.js', 'w') as f:
f.write(envCode + r1.text)
a, filename = tempfile.mkstemp()
t2 = time.time()
p = subprocess.Popen(['node', f'{work_dir}src/vm_env.js', filename], stdin=subprocess.PIPE,
p = subprocess.Popen(['node', f'{work_dir}src/vm_env_{self.thread_name}.js', filename], stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
output, err = p.communicate(timeout=10)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment