aboutsummaryrefslogtreecommitdiffstats
path: root/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/follow.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/follow.js')
-rw-r--r--vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/follow.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/follow.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/follow.js
new file mode 100644
index 00000000..7d826f72
--- /dev/null
+++ b/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/follow.js
@@ -0,0 +1,38 @@
+// List following and followers from several accounts
+
+var users = ['PhantomJS',
+ 'ariyahidayat',
+ 'detronizator',
+ 'KDABQt',
+ 'lfranchi',
+ 'jonleighton',
+ '_jamesmgreene',
+ 'Vitalliumm'];
+
+function follow(user, callback) {
+ var page = require('webpage').create();
+ page.open('http://mobile.twitter.com/' + user, function (status) {
+ if (status === 'fail') {
+ console.log(user + ': ?');
+ } else {
+ var data = page.evaluate(function () {
+ return document.querySelector('div.profile td.stat.stat-last div.statnum').innerText;
+ });
+ console.log(user + ': ' + data);
+ }
+ page.close();
+ callback.apply();
+ });
+}
+
+function process() {
+ if (users.length > 0) {
+ var user = users[0];
+ users.splice(0, 1);
+ follow(user, process);
+ } else {
+ phantom.exit();
+ }
+}
+
+process();