phantomjs/examples/follow.coffee

51 lines
943 B
CoffeeScript

# List following and followers from several accounts
users= [
'sencha'
'aconran'
'adityabansod'
'arnebech',
'ariyahidayat'
'bmoeskau'
'darrellmeyer'
'DavidKaneda'
'DmitryBaranovsk'
'donovanerba'
'edspencer'
'ExtAnimal'
'jamespearce'
'jamieavins'
'jarrednicholls'
'jayrobinson'
'lojjic'
'luckymethod'
'merrells'
'mmullany'
'philogb'
'philstrong'
'rdougan'
'SubtleGradient'
'tmaintz'
'whereisthysting'
]
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.timeline-following').innerText
console.log user + ': ' + data
callback.apply()
process = () ->
if (users.length > 0)
user = users[0]
users.splice(0, 1)
follow(user, process)
else
phantom.exit()
process()