Created
October 6, 2011 14:12
-
-
Save christopherdebeer/1267489 to your computer and use it in GitHub Desktop.
Hackernews scan for users that mention a twitter username in their bio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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