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
dafd2b77
Commit
dafd2b77
authored
Nov 24, 2016
by
yihua.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix GithubRepoPageProcessor in example
parent
cfed860f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
GithubRepoPageProcessor.java
...t/webmagic/processor/example/GithubRepoPageProcessor.java
+2
-2
No files found.
webmagic-core/src/main/java/us/codecraft/webmagic/processor/example/GithubRepoPageProcessor.java
View file @
dafd2b77
...
@@ -11,11 +11,11 @@ import us.codecraft.webmagic.processor.PageProcessor;
...
@@ -11,11 +11,11 @@ import us.codecraft.webmagic.processor.PageProcessor;
*/
*/
public
class
GithubRepoPageProcessor
implements
PageProcessor
{
public
class
GithubRepoPageProcessor
implements
PageProcessor
{
private
Site
site
=
Site
.
me
().
setRetryTimes
(
3
).
setSleepTime
(
0
);
private
Site
site
=
Site
.
me
().
setRetryTimes
(
3
).
setSleepTime
(
100
0
);
@Override
@Override
public
void
process
(
Page
page
)
{
public
void
process
(
Page
page
)
{
page
.
addTargetRequests
(
page
.
getHtml
().
links
().
regex
(
"(https://github\\.com/[\\w\\-]+/[\\w\\-])"
).
all
());
page
.
addTargetRequests
(
page
.
getHtml
().
links
().
regex
(
"(https://github\\.com/[\\w\\-]+/[\\w\\-]
+
)"
).
all
());
page
.
addTargetRequests
(
page
.
getHtml
().
links
().
regex
(
"(https://github\\.com/[\\w\\-])"
).
all
());
page
.
addTargetRequests
(
page
.
getHtml
().
links
().
regex
(
"(https://github\\.com/[\\w\\-])"
).
all
());
page
.
putField
(
"author"
,
page
.
getUrl
().
regex
(
"https://github\\.com/(\\w+)/.*"
).
toString
());
page
.
putField
(
"author"
,
page
.
getUrl
().
regex
(
"https://github\\.com/(\\w+)/.*"
).
toString
());
page
.
putField
(
"name"
,
page
.
getHtml
().
xpath
(
"//h1[@class='entry-title public']/strong/a/text()"
).
toString
());
page
.
putField
(
"name"
,
page
.
getHtml
().
xpath
(
"//h1[@class='entry-title public']/strong/a/text()"
).
toString
());
...
...
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