diff --git a/webmagic-scripts/README.md b/webmagic-scripts/README.md
old mode 100644
new mode 100755
diff --git a/webmagic-scripts/deploy.sh b/webmagic-scripts/deploy.sh
old mode 100644
new mode 100755
diff --git a/webmagic-scripts/pom.xml b/webmagic-scripts/pom.xml
old mode 100644
new mode 100755
index 5c211609..41c79ea0
--- a/webmagic-scripts/pom.xml
+++ b/webmagic-scripts/pom.xml
@@ -16,6 +16,10 @@
jruby
1.7.6
+ org.python
+ jython
+ 2.5.3
+
commons-cli
commons-cli
diff --git a/webmagic-scripts/src/main/java/us/codecraft/webmagic/scripts/Language.java b/webmagic-scripts/src/main/java/us/codecraft/webmagic/scripts/Language.java
old mode 100644
new mode 100755
index c7ddcda9..2f9d22d5
--- a/webmagic-scripts/src/main/java/us/codecraft/webmagic/scripts/Language.java
+++ b/webmagic-scripts/src/main/java/us/codecraft/webmagic/scripts/Language.java
@@ -7,7 +7,9 @@ public enum Language {
JavaScript("javascript","js/defines.js",""),
- JRuby("jruby","ruby/defines.rb","");
+ JRuby("jruby","ruby/defines.rb",""),
+
+ Jython("jython","python/defines.py","");
private String engineName;
diff --git a/webmagic-scripts/src/main/java/us/codecraft/webmagic/scripts/ScriptConsole.java b/webmagic-scripts/src/main/java/us/codecraft/webmagic/scripts/ScriptConsole.java
old mode 100644
new mode 100755
diff --git a/webmagic-scripts/src/main/java/us/codecraft/webmagic/scripts/ScriptEnginePool.java b/webmagic-scripts/src/main/java/us/codecraft/webmagic/scripts/ScriptEnginePool.java
old mode 100644
new mode 100755
diff --git a/webmagic-scripts/src/main/java/us/codecraft/webmagic/scripts/ScriptProcessor.java b/webmagic-scripts/src/main/java/us/codecraft/webmagic/scripts/ScriptProcessor.java
old mode 100644
new mode 100755
index 58018511..0214e8a9
--- a/webmagic-scripts/src/main/java/us/codecraft/webmagic/scripts/ScriptProcessor.java
+++ b/webmagic-scripts/src/main/java/us/codecraft/webmagic/scripts/ScriptProcessor.java
@@ -1,6 +1,9 @@
package us.codecraft.webmagic.scripts;
import org.apache.commons.io.IOUtils;
+import org.jruby.RubyHash;
+import org.python.core.PyDictionary;
+import sun.org.mozilla.javascript.internal.NativeObject;
import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.processor.PageProcessor;
@@ -10,6 +13,8 @@ import javax.script.ScriptEngine;
import javax.script.ScriptException;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Iterator;
+import java.util.Map;
/**
* @author code4crafter@gmail.com
@@ -50,20 +55,34 @@ public class ScriptProcessor implements PageProcessor {
context.setAttribute("page", page, ScriptContext.ENGINE_SCOPE);
context.setAttribute("config", site, ScriptContext.ENGINE_SCOPE);
try {
- engine.eval(defines + "\n" + script, context);
-// switch (language) {
-// case JavaScript:
-// NativeObject o = (NativeObject) engine.get("result");
-// if (o != null) {
-// for (Map.Entry