Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
马玮
/
carspider
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9787170f
authored
Aug 08, 2017
by
马玮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add random wait
parent
9fc79f6f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
16 deletions
+23
-16
README.md
+9
-9
captcha1.png
+0
-0
captcha2.png
+0
-0
lib/dealerspider/autohome.js
+14
-7
m1.png
+0
-0
try.png
+0
-0
No files found.
README.md
View file @
9787170f
...
@@ -2,20 +2,20 @@ Installation
...
@@ -2,20 +2,20 @@ Installation
------
------
1.
Install nvm
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
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
3.
Set environment
sudo vi /etc/profile
sudo vi /etc/profile
Add "export NODE_ENV=production" to bottom
Add "export NODE_ENV=production" to bottom
source /etc/profile
source /etc/profile
4.
Install redis
4.
Install redis
sudo yum install redis
sudo yum install redis
To do list:
To do list:
------
------
1.
Add random delay when access a page
1.
Add random delay when access a page
2.
Add error stack
2.
Add error stack
\ No newline at end of file
\ No newline at end of file
captcha1.png
View file @
9787170f
4.93 KB
|
W:
|
H:
4.93 KB
|
W:
|
H:
2-up
Swipe
Onion skin
captcha2.png
View file @
9787170f
4.93 KB
|
W:
|
H:
4.93 KB
|
W:
|
H:
2-up
Swipe
Onion skin
lib/dealerspider/autohome.js
View file @
9787170f
...
@@ -73,6 +73,15 @@ class AutoHome {
...
@@ -73,6 +73,15 @@ class AutoHome {
.
screenshot
(
'try.png'
)
.
screenshot
(
'try.png'
)
.
exists
(
'#loginout'
);
.
exists
(
'#loginout'
);
if
(
loginoutBtnExists
)
{
this
.
login
.
status
=
'success'
;
this
.
login
.
message
=
}
else
{
this
.
login
.
status
=
'error'
;
}
this
.
login
.
message
=
loginoutBtnExists
?
'登录成功'
:
'尝试登录失败'
;
await
horseman
.
close
();
await
horseman
.
close
();
return
loginoutBtnExists
;
return
loginoutBtnExists
;
// await horseman
// await horseman
...
@@ -86,12 +95,7 @@ class AutoHome {
...
@@ -86,12 +95,7 @@ class AutoHome {
async
login
()
{
async
login
()
{
try
{
try
{
let
loginMsg
;
await
this
.
tryLogin
();
let
loginStatus
=
await
this
.
login
();
if
(
loginStatus
==
'success'
)
{
console
.
log
(
'在login肚子里tryLogin'
);
return
loginStatus
;
}
const
username
=
this
.
params
.
username
;
const
username
=
this
.
params
.
username
;
const
password
=
this
.
params
.
password
;
const
password
=
this
.
params
.
password
;
...
@@ -248,11 +252,14 @@ class AutoHome {
...
@@ -248,11 +252,14 @@ class AutoHome {
console
.
log
(
'上牌地区:'
,
clue
.
LicenseCityStr
);
console
.
log
(
'上牌地区:'
,
clue
.
LicenseCityStr
);
console
.
log
(
'线索意向车型:'
,
clue
.
SpecNameStr
);
console
.
log
(
'线索意向车型:'
,
clue
.
SpecNameStr
);
console
.
log
(
'==========================================================================='
);
console
.
log
(
'==========================================================================='
);
// await Promise.delay(5000);
}
}
if
(
customerIndex
<
rowcount
)
{
if
(
customerIndex
<
rowcount
)
{
let
randomSecs
=
randomInt
(
1
,
8
);
console
.
log
(
`随机等待
${
randomSecs
}
秒`
);
await
Promise
.
delay
(
randomSecs
*
1000
).
then
(
async
function
()
{
params
.
pageIndex
++
;
params
.
pageIndex
++
;
await
fetchByPage
();
await
fetchByPage
();
});
}
}
});
});
}
}
...
...
m1.png
View file @
9787170f
This diff is collapsed.
Click to expand it.
try.png
View file @
9787170f
269 KB
|
W:
|
H:
269 KB
|
W:
|
H:
2-up
Swipe
Onion skin
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment