aboutsummaryrefslogtreecommitdiffstats
path: root/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/follow.coffee
blob: 4a7fbd4f85466a56d8a601eab24d3bc1ad326e20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# List following and followers from several accounts

users = [
  'PhantomJS'
  'ariyahidayat'
  'detronizator'
  'KDABQt'
  'lfranchi'
  'jonleighton'
  '_jamesmgreene'
  'Vitalliumm'
  ]

follow = (user, callback) ->
  page = require('webpage').create()
  page.open 'http://mobile.twitter.com/' + user, (status) ->
    if status is 'fail'
      console.log user + ': ?'
    else
      data = page.evaluate -> document.querySelector('div.profile td.stat.stat-last div.statnum').innerText;
      console.log user + ': ' + data
    page.close()
    callback.apply()

process = () ->
  if (users.length > 0)
    user = users[0]
    users.splice(0, 1)
    follow(user, process)
  else
    phantom.exit()

process()