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
4cd3e1d8
Commit
4cd3e1d8
authored
Nov 12, 2013
by
yihua.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add build script
parent
81bb809d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
2 deletions
+8
-2
deploy.sh
webmagic-scripts/deploy.sh
+5
-0
ScriptConsole.java
...ain/java/us/codecraft/webmagic/scripts/ScriptConsole.java
+1
-0
ScriptProcessor.java
...n/java/us/codecraft/webmagic/scripts/ScriptProcessor.java
+1
-1
defines.js
webmagic-scripts/src/main/resources/js/defines.js
+1
-1
No files found.
webmagic-scripts/deploy.sh
0 → 100644
View file @
4cd3e1d8
#!/bin/sh
VERSION
=
"0.4.1-SNAPTHOS"
mvn clean package
cp
target/webmagic-scripts-
${
VERSION
}
.jar /usr/local/webmagic/webmagic-console.jar
rsync
-avz
--delete
target/lib/ /usr/local/webmagic/lib/
webmagic-scripts/src/main/java/us/codecraft/webmagic/scripts/ScriptConsole.java
View file @
4cd3e1d8
...
...
@@ -105,6 +105,7 @@ public class ScriptConsole {
options
.
addOption
(
new
Option
(
"l"
,
true
,
"language"
));
options
.
addOption
(
new
Option
(
"t"
,
true
,
"thread"
));
options
.
addOption
(
new
Option
(
"f"
,
true
,
"script file"
));
options
.
addOption
(
new
Option
(
"s"
,
true
,
"sleep time"
));
CommandLineParser
commandLineParser
=
new
PosixParser
();
CommandLine
commandLine
=
commandLineParser
.
parse
(
options
,
args
);
return
readOptions
(
commandLine
);
...
...
webmagic-scripts/src/main/java/us/codecraft/webmagic/scripts/ScriptProcessor.java
View file @
4cd3e1d8
...
...
@@ -50,7 +50,7 @@ public class ScriptProcessor implements PageProcessor {
context
.
setAttribute
(
"page"
,
page
,
ScriptContext
.
ENGINE_SCOPE
);
context
.
setAttribute
(
"config"
,
site
,
ScriptContext
.
ENGINE_SCOPE
);
try
{
engine
.
eval
(
defines
+
script
,
context
);
engine
.
eval
(
defines
+
"\n"
+
script
,
context
);
}
catch
(
ScriptException
e
)
{
e
.
printStackTrace
();
}
...
...
webmagic-scripts/src/main/resources/js/defines.js
View file @
4cd3e1d8
...
...
@@ -7,4 +7,4 @@ function xpath(str){
function
urls
(
str
){
links
=
page
.
getHtml
().
links
().
regex
(
str
).
all
();
page
.
addTargetRequests
(
links
);
}
\ No newline at end of file
}
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