Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Chad phantom #52

Merged
merged 2 commits into from

1 participant

Chad Arimura
Chad Arimura
Owner

PhantomJS example ready to roll in.... will writeup tutorial around this now.

Chad Arimura carimura merged commit 5e9a75a into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 28, 2012
  1. Chad Arimura

    adding phantom js example

    carimura authored
  2. Chad Arimura

    modified creds

    carimura authored
This page is out of date. Refresh to see the latest.
4 binary/phantomjs/.iron.json
View
@@ -0,0 +1,4 @@
+{
+ "token": "TOKEN",
+ "project_id": "PROJECT_ID"
+}
21 binary/phantomjs/nearme.js
View
@@ -0,0 +1,21 @@
+var page = require('webpage').create(),
+ url = 'https://maps.google.com/maps?q='+phantom.args[0]+'+near+san+francisco';
+ console.log("Finding "+phantom.args[0]+" near San Francisco")
+ console.log('URL: '+url)
+
+ page.open(url, function (status) {
+ if (status !== 'success') {
+ console.log('Unable to access network');
+ } else {
+ var results = page.evaluate(function() {
+ var list = document.querySelectorAll('span.pp-place-title'), stuffs = [], i;
+ for (i = 0; i < list.length; i++) {
+ stuffs.push(list[i].innerText);
+ }
+ return stuffs;
+ });
+ console.log(results.join('\n'));
+ }
+ phantom.exit();
+ });
+
8 binary/phantomjs/phantom.worker
View
@@ -0,0 +1,8 @@
+runtime "binary"
+exec "run.sh"
+
+# Include the Javascript file that Phantom will execute
+file "nearme.js"
+
+# This line will grab Phantom JS 1.6.0 (the proper version), compile it, and include it with your code package
+remote_build_command 'curl http://phantomjs.googlecode.com/files/phantomjs-1.6.0-linux-x86_64-dynamic.tar.bz2 -o p.tar.bz2 && tar xf p.tar.bz2 && rm p.tar.bz2'
1  binary/phantomjs/run.sh
View
@@ -0,0 +1 @@
+phantomjs-1.6.0-linux-x86_64-dynamic/bin/phantomjs nearme.js pizza
Something went wrong with that request. Please try again.