Created
November 8, 2013 23:49
-
-
Save tantalor/7379471 to your computer and use it in GitHub Desktop.
A perl script which outputs the usernames for new comments on Hacker News, preceded by the date.
This file contains 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
#!/usr/bin/perl | |
my $url = "https://news.ycombinator.com/newcomments"; | |
sub html { | |
`curl get $url 2>/dev/null`; | |
} | |
printf "# %s", `date`; | |
my @usernames; | |
for my $line (html()) { | |
my @usernames = ($line =~ m/href="user\?id=([^"]*)"/g); | |
# print $line; | |
for $username (@usernames) { | |
printf "%s\n", $username; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment