phantomjs/examples/follow.coffee

55 lines
998 B
CoffeeScript
Raw Normal View History

# List following and followers from several accounts
users= [
'sencha'
'aconran'
2011-08-21 11:16:30 +04:00
'adityabansod'
2011-12-19 13:14:31 +04:00
'ambisinister'
'arnebech'
'ariyahidayat'
2011-12-19 13:14:31 +04:00
'arthurakay'
2011-08-21 11:16:30 +04:00
'bmoeskau'
'darrellmeyer'
2011-12-19 13:14:31 +04:00
'davidfoelber'
'DavidKaneda'
'donovanerba'
'edspencer'
2011-09-21 08:55:24 +04:00
'evantrimboli'
2011-08-21 11:16:30 +04:00
'ExtAnimal'
'jamieavins'
'jarrednicholls'
'jayrobinson'
'lojjic'
2011-08-21 11:16:30 +04:00
'luckymethod'
'merrells'
'mmullany'
'philogb'
2011-08-21 11:16:30 +04:00
'philstrong'
'rdougan'
2011-08-21 11:16:30 +04:00
'SubtleGradient'
2011-12-19 13:14:31 +04:00
'__ted__'
'tmaintz'
2011-12-19 13:14:31 +04:00
'WesleyMoy'
'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()