Commit 9787170f by 马玮

add random wait

parent 9fc79f6f
......@@ -2,20 +2,20 @@ Installation
------
1.Install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
2.Install node-v8.2.1-linux-x64.tar.xz by nvm
nvm install v8.2.1
nvm install v8.2.1
3.Set environment
sudo vi /etc/profile
Add "export NODE_ENV=production" to bottom
source /etc/profile
sudo vi /etc/profile
Add "export NODE_ENV=production" to bottom
source /etc/profile
4.Install redis
sudo yum install redis
sudo yum install redis
To do list:
------
1.Add random delay when access a page
2.Add error stack
\ No newline at end of file
1.Add random delay when access a page
2.Add error stack
\ No newline at end of file

4.93 KB | W: | H:

4.93 KB | W: | H:

captcha1.png
captcha1.png
captcha1.png
captcha1.png
  • 2-up
  • Swipe
  • Onion skin

4.93 KB | W: | H:

4.93 KB | W: | H:

captcha2.png
captcha2.png
captcha2.png
captcha2.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -73,6 +73,15 @@ class AutoHome {
.screenshot('try.png')
.exists('#loginout');
if (loginoutBtnExists) {
this.login.status = 'success';
this.login.message =
} else {
this.login.status = 'error';
}
this.login.message = loginoutBtnExists ? '登录成功' : '尝试登录失败';
await horseman.close();
return loginoutBtnExists;
// await horseman
......@@ -86,12 +95,7 @@ class AutoHome {
async login() {
try {
let loginMsg;
let loginStatus = await this.login();
if (loginStatus == 'success') {
console.log('在login肚子里tryLogin');
return loginStatus;
}
await this.tryLogin();
const username = this.params.username;
const password = this.params.password;
......@@ -248,11 +252,14 @@ class AutoHome {
console.log('上牌地区:', clue.LicenseCityStr);
console.log('线索意向车型:', clue.SpecNameStr);
console.log('===========================================================================');
// await Promise.delay(5000);
}
if (customerIndex < rowcount) {
let randomSecs = randomInt(1, 8);
console.log(`随机等待${randomSecs}秒`);
await Promise.delay(randomSecs*1000).then(async function() {
params.pageIndex++;
await fetchByPage();
});
}
});
}
......

269 KB | W: | H:

269 KB | W: | H:

try.png
try.png
try.png
try.png
  • 2-up
  • Swipe
  • Onion skin
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 sign in to comment