in Coding
A common problem i have on Twitter is trying to find out who exactly the people friending me are when they have large numbers of contacts. So i wrote a simple little script to filter out anyone on their friends list who i’m not a friend with. It’s not that pretty as i wrote it in a few minutes, but it gets the job done. Feel free to make a bookmarklet or GreaseMonkey script out of it just don’t forget to change the username.
var username = 'skhisma'; var url = 'http://twitter.com/' + username; new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { // Find my friends var myFriends = []; transport.responseText.scan(/<span class="vcard">\s+<a href="http:\/\/twitter.com\/(\w+)\/?"/, function(match) { myFriends.push(match[1]); }); // Hide their friends that aren't my friends $$('span.vcard').each(function(element){ user = Element.childElements(element)[0].href.sub(/http:\/\/twitter.com\/(\w+)\/?/,'#{1}'); if( myFriends.indexOf( user ) == -1 ) { element.hide(); } }); $$('div.section-header h1').each(function(element){ if(element.innerHTML == "Following") element.innerHTML = "Common Friends"; }); } }); |
[...] bookmarks tagged user Twitter User Filtering saved by 4 others sauceteriyaki bookmarked on 07/18/08 | [...]