Skip to content

Instantly share code, notes, and snippets.

@christopherdebeer
Created October 6, 2011 14:12
Show Gist options
  • Select an option

  • Save christopherdebeer/1267489 to your computer and use it in GitHub Desktop.

Select an option

Save christopherdebeer/1267489 to your computer and use it in GitHub Desktop.
Hackernews scan for users that mention a twitter username in their bio
(function(){
$("a[href^='user?id']").each(function(i,e){
var username = $(e).text();
$.get("/user?id=" + username, function(data){
//console.log(data);
var twitternames = data.match(/(?:twitter\.com\/([a-zAZ0-9]+))|(?:[^a-z,^A-Z,^0-9]@([a-z,A-z,-9]+))/gi);
if (twitternames) {
$.each(twitternames,function(i,e) {
twitternames[i] = twitternames[i].replace(/[^a-zA-Z0-9]+@([a-zA-Z0-9]+)/gi,"@$1");
twitternames[i] = twitternames[i].replace(/twitter\.com\//gi,"@");
console.log(twitternames[i]);
});
}
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment