summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Knispel <gknispel@avencall.com>2012-09-17 15:44:50 +0200
committerGuillaume Knispel <gknispel@avencall.com>2012-09-17 15:44:50 +0200
commit982a3c52c1184d620b43cf70a2331a4ce5f10f21 (patch)
tree9ebc45c46f8647604aca5c8fb1e7a5fb13f8dc98
parent512f61698e63756928d8be35dd870ddb92c0ad79 (diff)
Script for downloading a page from digikey
-rwxr-xr-xdigikey.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/digikey.js b/digikey.js
new file mode 100755
index 0000000..ec452a3
--- /dev/null
+++ b/digikey.js
@@ -0,0 +1,19 @@
+#!/home/xilun/phantomjs-1.6.1-linux-x86_64-dynamic/bin/phantomjs
+
+var page = require('webpage').create();
+
+var url = 'http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=IRF7455PBFTR-ND';
+
+page.open(url, function (status) {
+ if(status !== "success") {
+ console.log("MORT ET DESOLATION")
+ } else {
+ if(page.evaluate(function () { return (typeof test === "function"); })) {
+ page.evaluate(function(){test();})
+ console.log("TRY AGAIN")
+ } else {
+ console.log(page.content)
+ phantom.exit()
+ }
+ }
+});