Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
webmagic
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
沈俊林
webmagic
Commits
21f81bb8
Commit
21f81bb8
authored
Sep 18, 2015
by
Qiannan Lu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update deprecated method
parent
56e0cd51
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
QuickStarter.java
...rc/main/java/us/codecraft/webmagic/main/QuickStarter.java
+2
-2
SpiderTest.java
...mples/src/test/java/us/codecraft/webmagic/SpiderTest.java
+2
-2
No files found.
webmagic-samples/src/main/java/us/codecraft/webmagic/main/QuickStarter.java
View file @
21f81bb8
...
@@ -38,7 +38,7 @@ public class QuickStarter {
...
@@ -38,7 +38,7 @@ public class QuickStarter {
key
=
readKey
(
key
);
key
=
readKey
(
key
);
System
.
out
.
println
(
"The demo started and will last 20 seconds..."
);
System
.
out
.
println
(
"The demo started and will last 20 seconds..."
);
//Start spider
//Start spider
OOSpider
.
create
(
Site
.
me
()
.
addStartUrl
(
urlMap
.
get
(
key
)),
clazzMap
.
get
(
key
)).
pipeline
(
new
MultiPagePipeline
()).
p
ipeline
(
new
ConsolePipeline
()).
runAsync
();
OOSpider
.
create
(
Site
.
me
()
,
clazzMap
.
get
(
key
)).
addUrl
(
urlMap
.
get
(
key
)).
addPipeline
(
new
MultiPagePipeline
()).
addP
ipeline
(
new
ConsolePipeline
()).
runAsync
();
try
{
try
{
Thread
.
sleep
(
20000
);
Thread
.
sleep
(
20000
);
...
@@ -57,7 +57,7 @@ public class QuickStarter {
...
@@ -57,7 +57,7 @@ public class QuickStarter {
System
.
out
.
println
(
classEntry
.
getKey
()+
"\t"
+
classEntry
.
getValue
()
+
"\t"
+
urlMap
.
get
(
classEntry
.
getKey
()));
System
.
out
.
println
(
classEntry
.
getKey
()+
"\t"
+
classEntry
.
getValue
()
+
"\t"
+
urlMap
.
get
(
classEntry
.
getKey
()));
}
}
while
(
key
==
null
)
{
while
(
key
==
null
)
{
key
=
new
String
(
stdin
.
nextLine
()
);
key
=
stdin
.
nextLine
(
);
if
(
clazzMap
.
get
(
key
)
==
null
)
{
if
(
clazzMap
.
get
(
key
)
==
null
)
{
System
.
out
.
println
(
"Invalid choice!"
);
System
.
out
.
println
(
"Invalid choice!"
);
key
=
null
;
key
=
null
;
...
...
webmagic-samples/src/test/java/us/codecraft/webmagic/SpiderTest.java
View file @
21f81bb8
...
@@ -18,7 +18,7 @@ public class SpiderTest {
...
@@ -18,7 +18,7 @@ public class SpiderTest {
@Ignore
@Ignore
@Test
@Test
public
void
testSpider
()
throws
InterruptedException
{
public
void
testSpider
()
throws
InterruptedException
{
Spider
me
=
Spider
.
create
(
new
HuxiuProcessor
()).
p
ipeline
(
new
FilePipeline
());
Spider
me
=
Spider
.
create
(
new
HuxiuProcessor
()).
addP
ipeline
(
new
FilePipeline
());
me
.
run
();
me
.
run
();
}
}
...
@@ -31,7 +31,7 @@ public class SpiderTest {
...
@@ -31,7 +31,7 @@ public class SpiderTest {
SimplePageProcessor
pageProcessor2
=
new
SimplePageProcessor
(
"http://www.diaoyuweng.com/home.php?mod=space&uid=88304&do=thread&view=me&type=thread&from=space"
,
"http://www.diaoyuweng.com/thread-*-1-1.html"
);
SimplePageProcessor
pageProcessor2
=
new
SimplePageProcessor
(
"http://www.diaoyuweng.com/home.php?mod=space&uid=88304&do=thread&view=me&type=thread&from=space"
,
"http://www.diaoyuweng.com/thread-*-1-1.html"
);
System
.
out
.
println
(
pageProcessor2
.
getSite
().
getCharset
());
System
.
out
.
println
(
pageProcessor2
.
getSite
().
getCharset
());
pageProcessor2
.
getSite
().
setSleepTime
(
500
);
pageProcessor2
.
getSite
().
setSleepTime
(
500
);
Spider
.
create
(
pageProcessor2
).
p
ipeline
(
new
FilePipeline
()).
scheduler
(
new
FileCacheQueueScheduler
(
"/data/temp/webmagic/cache/"
)).
Spider
.
create
(
pageProcessor2
).
addP
ipeline
(
new
FilePipeline
()).
scheduler
(
new
FileCacheQueueScheduler
(
"/data/temp/webmagic/cache/"
)).
run
();
run
();
...
...
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