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
3fe3d8f0
Commit
3fe3d8f0
authored
Aug 02, 2013
by
yihua.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
901d6fde
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
8 deletions
+28
-8
ObjectPipeline.java
...java/us/codecraft/webmagic/annotation/ObjectPipeline.java
+21
-0
OschinaBlog.java
...st/java/us/codecraft/webmagic/annotation/OschinaBlog.java
+0
-7
TestFetcher.java
...st/java/us/codecraft/webmagic/annotation/TestFetcher.java
+7
-1
No files found.
webmagic-core/src/main/java/us/codecraft/webmagic/annotation/ObjectPipeline.java
0 → 100644
View file @
3fe3d8f0
package
us
.
codecraft
.
webmagic
.
annotation
;
import
us.codecraft.webmagic.ResultItems
;
import
us.codecraft.webmagic.Task
;
import
us.codecraft.webmagic.pipeline.Pipeline
;
/**
* @author yihua.huang@dianping.com <br>
* @date: 13-8-2 <br>
* Time: 上午10:47 <br>
*/
public
class
ObjectPipeline
implements
Pipeline
{
@Override
public
void
process
(
ResultItems
resultItems
,
Task
task
)
{
}
public
<
T
>
T
read
()
{
return
null
;
}
}
webmagic-core/src/test/java/us/codecraft/webmagic/annotation/OschinaBlog.java
View file @
3fe3d8f0
...
@@ -14,11 +14,4 @@ public class OschinaBlog {
...
@@ -14,11 +14,4 @@ public class OschinaBlog {
@ExtractBy
(
value
=
"div.BlogContent"
,
type
=
ExtractBy
.
Type
.
Css
)
@ExtractBy
(
value
=
"div.BlogContent"
,
type
=
ExtractBy
.
Type
.
Css
)
private
String
content
;
private
String
content
;
@Override
public
String
toString
()
{
return
"OschinaBlog{"
+
"title='"
+
title
+
'\''
+
", content='"
+
content
+
'\''
+
'}'
;
}
}
}
webmagic-core/src/test/java/us/codecraft/webmagic/annotation/TestFetcher.java
View file @
3fe3d8f0
...
@@ -15,7 +15,13 @@ public class TestFetcher {
...
@@ -15,7 +15,13 @@ public class TestFetcher {
@Ignore
(
"takes long"
)
@Ignore
(
"takes long"
)
@Test
@Test
public
void
test
()
{
public
void
test
()
{
Spider
.
create
(
ObjectPageProcessor
.
create
(
Site
.
me
().
addStartUrl
(
"http://my.oschina.net/flashsword/blog/145796"
),
OschinaBlog
.
class
)).
run
();
ObjectPipeline
objectPipeline
=
new
ObjectPipeline
();
Spider
.
create
(
ObjectPageProcessor
.
create
(
Site
.
me
().
addStartUrl
(
"http://my.oschina.net/flashsword/blog/145796"
),
OschinaBlog
.
class
))
.
pipeline
(
objectPipeline
).
runAsync
();
OschinaBlog
oschinaBlog
=
null
;
while
((
oschinaBlog
=
objectPipeline
.
read
())
!=
null
)
{
System
.
out
.
println
(
oschinaBlog
);
}
}
}
...
...
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