Steffest Digitale Pulptuur

Twitter Follower Wonderwall

The übercool @bnox hopped over 1000 twitter-followers yesterday and posted her wonderwall of twitter-followers on her blog.
It was generated by a script by Walter Higgins. Cool! Only one thing: I noticed it had only 700 peeps on it. (Actually, I miscounted so thanks @StefaanLesage for the recount )
It's stupid things like this that bug me (litteraly)
I'm conditioned by my job of course: when I see a software bug I automatically switch to "Can we fix it? YES WE CAN!" mode.
I created a little script that gets your followers and displays them in a grid. It turned out to be piece of cake thanks to Twitter's excellent API.
Here's the script if you want to make your own Wonderwall or adapt it.

<%
twitterAccount = "steffest"
twitterPass    = "******"
twitterUser    = "Bnox"
page=1
colcount=1

response.write("<h1>"&twitterUser&"</h1>")
response.write("<table><tr>")
twitter_getfollowers()
response.write("</tr></table>")

function twitter_getfollowers()
	twitterurl = "http://twitter.com/statuses/followers/"&twitterUser&".xml?page=" & page
	set objXMLHTTP = Server.CreateObject("MSXML2.SERVERXMLHTTP")
	objXMLHTTP.Open "GET", twitterurl, false,twitterAccount,twitterPass
	
	objXMLHTTP.Send
	Set objXML = Server.CreateObject("MSXML2.DOMDocument")
	bAns = objXML.loadXML(objXMLHTTP.responseText)
	
	if bAns then
		set objItemNodes = objXML.DocumentElement.SelectNodes("user")
		if objItemNodes.length>0 and page<50 then
			for each oNode in objItemNodes
				user_name = ""
				user_image = ""
				if not oNode.selectSingleNode("screen_name") is nothing then user_name = oNode.selectSingleNode("screen_name").Text
				if not oNode.selectSingleNode("profile_image_url") is nothing then user_image = oNode.selectSingleNode("profile_image_url").Text
				response.write("<td><a href=""http://twitter.com/"&user_name&"""><img src="""&user_image&""" border=""0"" width=""48"" height=""48""></a></td>")
				colcount=colcount+1
				if colcount>15 then 
					response.write("</tr><tr>")
					colcount=1
				end if
			next
			
			page=page+1
			twitter_getfollowers()
		end if
	end if
	
	set objXMLHTTP=nothing
	twitter_getfollowers = true

end function
%>
Tags: in English, Scripting, TwitterGeef je reactie (0)