forked from luyishisi/Anti-Anti-Spider
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import time | ||
import sys | ||
import os | ||
def restart_program(): | ||
python = sys.executable | ||
os.execl(python, python, * sys.argv) | ||
|
||
if __name__ == "__main__": | ||
print 'start...' | ||
# answer = raw_input("Do you want to restart this program ? ") | ||
# if answer.strip() in "y Y yes Yes YES".split(): | ||
# restart_program() | ||
print u"3秒后,程序将结束...".encode("utf8") | ||
time.sleep(3) | ||
restart_program() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var system = require('system'); | ||
var args = system.args; | ||
var url = args[1]; | ||
var page = require('webpage').create(); | ||
page.settings.resourceTimeout = 5000; // 等待5秒 | ||
page.onResourceTimeout = function(e) { | ||
console.log(e.errorCode); //打印错误码 | ||
console.log(e.errorString); // 打印错误语句 | ||
console.log(e.url); //打印错误url | ||
phantom.exit(1); | ||
}; | ||
page.open(url, function(status) { | ||
if (status === 'success') { | ||
var html = page.evaluate(function() { | ||
return document.documentElement.outerHTML; | ||
}); | ||
console.log(html); | ||
} | ||
phantom.exit(); | ||
}); | ||
//$phantomjs xx.js http://bbs.pcbaby.com.cn/topic-2149414.html |